UNPKG

dotbit

Version:

A complete .bit SDK and utilities in TypeScript

78 lines 3.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromSplitRecordToUnifiedRecord = exports.RegisterAPI = exports.toEditingRecord = void 0; const Networking_1 = require("../tools/Networking"); const account_1 = require("../tools/account"); function toEditingRecord(record) { return Object.assign(Object.assign({}, record), { type: record.key.split('.')[0], key: record.key.split('.')[1] }); } exports.toEditingRecord = toEditingRecord; class RegisterAPI { constructor(baseUri) { this.baseUri = baseUri; this.net = new Networking_1.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: (0, account_1.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); } } exports.RegisterAPI = RegisterAPI; function fromSplitRecordToUnifiedRecord() { } exports.fromSplitRecordToUnifiedRecord = fromSplitRecordToUnifiedRecord; //# sourceMappingURL=RegisterAPI.js.map