UNPKG

dotbit-sdk-allin

Version:

A complete .bit SDK and utilities in TypeScript

88 lines 3.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromSplitRecordToUnifiedRecord = exports.RegisterAPI = exports.toEditingRecord = void 0; const Networking_1 = require("../tools/Networking"); const common_1 = require("../tools/common"); 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', params); } editAccountOwner(params) { return this.net.post('account/edit/owner', params); } editAccountRecords(params) { return this.net.post('account/edit/records', params); } submitRegisterAccountOrder(params) { const address = params.keyInfo.key; const coinType = params.keyInfo.coin_type; const account = params.account; return this.net.post('account/order/register', { chain_type: (0, common_1.computeChainTypeByCoinType)(coinType), address, 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), cross_coin_type: params.crossTo }); } submitRenewAccountOrder(params) { const address = params.keyInfo.key; const coinType = params.keyInfo.coin_type; const account = params.account; return this.net.post('account/order/renew', { chain_type: (0, common_1.computeChainTypeByCoinType)(coinType), address, account, pay_token_id: params.paymentMethodID, pay_address: address, renew_years: params.renewYears }); } payWithDotbitBalance(params) { const address = params.keyInfo.key; const coinType = params.keyInfo.coin_type; return this.net.post('balance/pay', { chain_type: (0, common_1.computeChainTypeByCoinType)(coinType), address, evm_chain_id: params.evmChainId, order_id: params.orderId }); } returnTrxHashToService(params) { const address = params.keyInfo.key; const coinType = params.keyInfo.coin_type; return this.net.post('account/order/pay/hash', { chain_type: (0, common_1.computeChainTypeByCoinType)(coinType), address, account: params.account, order_id: params.orderId, pay_hash: params.txHash }); } sendTransaction(params) { return this.net.post('transaction/send', { sign_key: params.sign_key, sign_list: params.sign_list, }); } } exports.RegisterAPI = RegisterAPI; function fromSplitRecordToUnifiedRecord() { } exports.fromSplitRecordToUnifiedRecord = fromSplitRecordToUnifiedRecord; //# sourceMappingURL=RegisterAPI.js.map