From a39d0cea852161f3cd162641563b1320bf1408fb Mon Sep 17 00:00:00 2001 From: neeboo Date: Tue, 3 Sep 2019 00:43:34 +0800 Subject: [PATCH] chore(Account):remove setShardProvider on constructor --- packages/harmony-account/src/account.ts | 3 ++- packages/harmony-network/src/messenger/messenger.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/harmony-account/src/account.ts b/packages/harmony-account/src/account.ts index 1308619..df1dc0f 100644 --- a/packages/harmony-account/src/account.ts +++ b/packages/harmony-account/src/account.ts @@ -162,7 +162,6 @@ class Account { async updateBalances(blockNumber: string = 'latest'): Promise { // this.messenger.setShardingProviders(); const shardProviders = this.messenger.shardProviders; - if (shardProviders.size > 1) { for (const [name, val] of shardProviders) { const balanceObject = await this.getShardBalance(val.shardID, blockNumber); @@ -248,12 +247,14 @@ class Account { this.messenger.chainPrefix, shardID, ); + const nonce = await this.messenger.send( RPCMethod.GetTransactionCount, [this.address, blockNumber], this.messenger.chainPrefix, shardID, ); + if (balance.isError()) { throw balance.error.message; } diff --git a/packages/harmony-network/src/messenger/messenger.ts b/packages/harmony-network/src/messenger/messenger.ts index 0aae817..61fccef 100644 --- a/packages/harmony-network/src/messenger/messenger.ts +++ b/packages/harmony-network/src/messenger/messenger.ts @@ -70,7 +70,7 @@ class Messenger extends HarmonyCore { // set shardingProviders this.shardProviders = new Map(); - this.setShardingProviders(); + // this.setShardingProviders(); } get currentShard(): number | undefined { return this.getCurrentShardID(); @@ -266,6 +266,7 @@ class Messenger extends HarmonyCore { } try { const response = await this.send(RPCMethod.GetShardingStructure, [], this.chainPrefix); + if (response.result) { const shardingStructures: ShardingItem[] = response.result; for (const shard of shardingStructures) {