mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
Request accounts in parallel
This commit is contained in:
parent
ca103bfedb
commit
7acc0e4ef8
@ -102,20 +102,21 @@ export class Faucet {
|
||||
public async loadAccounts(): Promise<ReadonlyArray<MinimalAccount>> {
|
||||
const addresses = [this.holderAddress, ...this.distributorAddresses];
|
||||
|
||||
const out: MinimalAccount[] = [];
|
||||
for (const address of addresses) {
|
||||
const response = await this.readOnlyClient.getAccount(address);
|
||||
if (response) {
|
||||
out.push(response);
|
||||
} else {
|
||||
out.push({
|
||||
address: address,
|
||||
balance: [],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
return Promise.all(
|
||||
addresses.map(
|
||||
async (address): Promise<MinimalAccount> => {
|
||||
const response = await this.readOnlyClient.getAccount(address);
|
||||
if (response) {
|
||||
return response;
|
||||
} else {
|
||||
return {
|
||||
address: address,
|
||||
balance: [],
|
||||
};
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public async refill(): Promise<void> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user