dotbit
Version:
A complete .bit SDK and utilities in TypeScript
72 lines • 2.79 kB
JavaScript
import { Networking } from '../tools/Networking';
import { graphemesAccount } from '../tools/account';
export function toEditingRecord(record) {
return Object.assign(Object.assign({}, record), { type: record.key.split('.')[0], key: record.key.split('.')[1] });
}
export class RegisterAPI {
constructor(baseUri) {
this.baseUri = baseUri;
this.net = new Networking(baseUri);
}
editAccountManager(params) {
return this.net.post('account/edit/manager', Object.assign(Object.assign({ type: 'blockchain' }, params), { key_info: params.keyInfo }));
}
editAccountOwner(params) {
return this.net.post('account/edit/owner', Object.assign(Object.assign({ type: 'blockchain' }, params), { key_info: params.keyInfo }));
}
editAccountRecords(params) {
return this.net.post('account/edit/records', Object.assign(Object.assign({ type: 'blockchain' }, params), { key_info: params.keyInfo }));
}
submitRegisterAccountOrder(params) {
const address = params.keyInfo.key;
const coinType = params.keyInfo.coin_type;
const account = params.account;
return this.net.post('account/order/register', {
type: 'blockchain',
key_info: params.keyInfo,
account,
pay_token_id: params.paymentMethodID,
pay_address: address,
register_years: params.registerYears,
coin_type: coinType,
inviter_account: params.inviterAccount,
channel_account: params.channelAccount,
account_char_str: graphemesAccount(account.split('.')[0], true)
});
}
submitRenewAccountOrder(params) {
const address = params.keyInfo.key;
const account = params.account;
return this.net.post('account/order/renew', {
type: 'blockchain',
key_info: params.keyInfo,
account,
pay_token_id: params.paymentMethodID,
pay_address: address,
renew_years: params.renewYears
});
}
payWithDotbitBalance(params) {
return this.net.post('balance/pay', {
type: 'blockchain',
key_info: params.keyInfo,
evm_chain_id: params.evmChainId,
order_id: params.orderId
});
}
returnTrxHashToService(params) {
return this.net.post('account/order/pay/hash', {
type: 'blockchain',
key_info: params.keyInfo,
account: params.account,
order_id: params.orderId,
pay_hash: params.txHash
});
}
sendTransaction(params) {
return this.net.post('transaction/send', params);
}
}
export function fromSplitRecordToUnifiedRecord() {
}
//# sourceMappingURL=RegisterAPI.js.map