dotbit
Version:
A complete .bit SDK and utilities in TypeScript
73 lines • 2.35 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.BitIndexer = void 0;
const JSON_RPC_1 = require("../tools/JSON-RPC");
class BitIndexer {
constructor({ uri }) {
this.rpc = new JSON_RPC_1.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);
}
subAccountVerify(address, account, subAccount, verifyType) {
return this.request('das_subAccountVerify', [{
address,
account,
sub_account: subAccount,
verify_type: verifyType ? 1 : 0,
}])
.then(result => result.is_subdid);
}
validDotbitAliasAddresses(account) {
return this.request('das_accountReverseAddress', [{ account }])
.then(result => result.list);
}
batchAccountInfo(accounts) {
return this.request('das_batchRegisterInfo', [{ batch_account: accounts }])
.then(result => result.list);
}
dobList({ keyInfo, didType, page, size }) {
return this.request('das_didCellList', [{
type: 'blockchain',
key_info: keyInfo,
did_type: didType,
page,
size
}])
.then(result => result.did_list);
}
}
exports.BitIndexer = BitIndexer;
//# sourceMappingURL=BitIndexer.js.map
;