From 90e66f2e8852a07ec45dde8f4293aff403b92224 Mon Sep 17 00:00:00 2001 From: neeboo Date: Thu, 31 Oct 2019 17:29:42 +0800 Subject: [PATCH] fix(contract): fix getContractAddress --- .env => .env.example | 0 package.json | 5 +---- packages/harmony-account/package.json | 2 +- packages/harmony-staking/package.json | 2 +- packages/harmony-transaction/src/factory.ts | 4 +++- 5 files changed, 6 insertions(+), 7 deletions(-) rename .env => .env.example (100%) diff --git a/.env b/.env.example similarity index 100% rename from .env rename to .env.example diff --git a/package.json b/package.json index aea2685..c61cb49 100644 --- a/package.json +++ b/package.json @@ -138,8 +138,5 @@ "pre-commit": "pretty-quick --staged" } }, - "name": "harmony-sdk-core", - "dependencies": { - "text-encoding": "^0.7.0" - } + "name": "harmony-sdk-core" } diff --git a/packages/harmony-account/package.json b/packages/harmony-account/package.json index 9b3f0a1..c14887d 100644 --- a/packages/harmony-account/package.json +++ b/packages/harmony-account/package.json @@ -22,7 +22,7 @@ "@harmony-js/crypto": "0.1.28", "@harmony-js/network": "0.1.31", "@harmony-js/staking": "0.1.31", - "@harmony-js/transaction": "0.1.29", + "@harmony-js/transaction": "0.1.31", "@harmony-js/utils": "0.1.28" }, "gitHead": "0f2c4f00383611397ba83182322be3394451f8d6" diff --git a/packages/harmony-staking/package.json b/packages/harmony-staking/package.json index 48d0f44..d8cde1b 100644 --- a/packages/harmony-staking/package.json +++ b/packages/harmony-staking/package.json @@ -20,7 +20,7 @@ "dependencies": { "@harmony-js/crypto": "0.1.28", "@harmony-js/network": "0.1.31", - "@harmony-js/transaction": "0.1.29", + "@harmony-js/transaction": "0.1.31", "@harmony-js/utils": "0.1.28", "text-encoding": "^0.7.0" }, diff --git a/packages/harmony-transaction/src/factory.ts b/packages/harmony-transaction/src/factory.ts index c2b3a1c..5bcda8a 100644 --- a/packages/harmony-transaction/src/factory.ts +++ b/packages/harmony-transaction/src/factory.ts @@ -7,7 +7,9 @@ import { TxParams, TxStatus } from './types'; export class TransactionFactory { static getContractAddress(tx: Transaction) { const { from, nonce } = tx.txParams; - return getAddress(getContractAddress(from, Number.parseInt(`${nonce}`, 10))).checksum; + return getAddress( + getContractAddress(getAddress(from).checksum, Number.parseInt(`${nonce}`, 10)), + ).checksum; } messenger: Messenger;