From 7b72afc74c0fffa152325c5acb27959221f167e9 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 12 Feb 2020 15:01:38 +0100 Subject: [PATCH] Rename to primarySignerAddress --- packages/bcp/src/cosmwasmconnection.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/bcp/src/cosmwasmconnection.ts b/packages/bcp/src/cosmwasmconnection.ts index 1c95ef9c..d7c9e893 100644 --- a/packages/bcp/src/cosmwasmconnection.ts +++ b/packages/bcp/src/cosmwasmconnection.ts @@ -368,21 +368,22 @@ export class CosmWasmConnection implements BlockchainConnection { const firstMsg = response.tx.value.msg.find(() => true); if (!firstMsg) throw new Error("Got transaction without a first message. What is going on here?"); - let senderAddress: string; + // needed to get the (account_number, sequence) for the primary signature + let primarySignerAddress: string; if (types.isMsgSend(firstMsg)) { - senderAddress = firstMsg.value.from_address; + primarySignerAddress = firstMsg.value.from_address; } else if ( types.isMsgStoreCode(firstMsg) || types.isMsgInstantiateContract(firstMsg) || types.isMsgExecuteContract(firstMsg) ) { - senderAddress = firstMsg.value.sender; + primarySignerAddress = firstMsg.value.sender; } else { throw new Error(`Got unsupported type of message: ${firstMsg.type}`); } // tslint:disable-next-line: deprecation - const accountForHeight = await this.restClient.authAccounts(senderAddress, response.height); + const accountForHeight = await this.restClient.authAccounts(primarySignerAddress, response.height); const accountNumber = accountForHeight.result.value.account_number; // this is technically not the proper sequence. maybe this causes issues for sig validation? // leaving for now unless it causes issues