@aeternity/aepp-sdk
Version:
SDK for the æternity blockchain
29 lines (28 loc) • 938 B
JavaScript
/**
* A factory class that generates instances of AccountBase by index.
* @category account
*/
export default class AccountBaseFactory {
/**
* Get an instance of AccountBase for a given account index.
* @param accountIndex - Index of account
*/
/**
* Discovers accounts in set that already have been used (has any on-chain transactions).
* It returns an empty array if none of accounts been used.
* If a used account is preceded by an unused account then it would be ignored.
* @param node - Instance of Node to get account information from
*/
async discover(node) {
let index = 0;
const result = [];
let account;
do {
if (account != null) result.push(account);
account = await this.initialize(index);
index += 1;
} while (await node.getAccountByPubkey(account.address).then(() => true, () => false));
return result;
}
}
//# sourceMappingURL=BaseFactory.js.map