UNPKG

dotbit-sdk-allin

Version:

A complete .bit SDK and utilities in TypeScript

42 lines 1.3 kB
import { JSONRPC } from '../tools/JSON-RPC'; export class BitIndexer { constructor({ uri }) { this.rpc = new JSONRPC(uri); } request(method, params) { return this.rpc.request(method, params).then(result => result.data); } serverInfo() { return this.request('das_serverInfo'); } accountInfo(account) { return this.request('das_accountInfo', [{ account, }]); } accountInfoById(accountId) { return this.request('das_accountInfo', [{ account_id: accountId, }]); } accountRecords(account) { return this.request('das_accountRecords', [{ account, }]).then(result => result.records); } reverseRecord(keyInfo) { return this.request('das_reverseRecord', [{ type: 'blockchain', key_info: keyInfo, }]); } accountList(keyInfo, role = 'owner') { return this.request('das_accountList', [{ type: 'blockchain', key_info: keyInfo, role, }]) .then(result => result.account_list.map(item => item.account)); } } //# sourceMappingURL=BitIndexer.js.map