fix(contract): fix getContractAddress

datastructure-update
neeboo 5 years ago
parent 15eed0e6ef
commit 90e66f2e88
  1. 0
      .env.example
  2. 5
      package.json
  3. 2
      packages/harmony-account/package.json
  4. 2
      packages/harmony-staking/package.json
  5. 4
      packages/harmony-transaction/src/factory.ts

@ -138,8 +138,5 @@
"pre-commit": "pretty-quick --staged" "pre-commit": "pretty-quick --staged"
} }
}, },
"name": "harmony-sdk-core", "name": "harmony-sdk-core"
"dependencies": {
"text-encoding": "^0.7.0"
}
} }

@ -22,7 +22,7 @@
"@harmony-js/crypto": "0.1.28", "@harmony-js/crypto": "0.1.28",
"@harmony-js/network": "0.1.31", "@harmony-js/network": "0.1.31",
"@harmony-js/staking": "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" "@harmony-js/utils": "0.1.28"
}, },
"gitHead": "0f2c4f00383611397ba83182322be3394451f8d6" "gitHead": "0f2c4f00383611397ba83182322be3394451f8d6"

@ -20,7 +20,7 @@
"dependencies": { "dependencies": {
"@harmony-js/crypto": "0.1.28", "@harmony-js/crypto": "0.1.28",
"@harmony-js/network": "0.1.31", "@harmony-js/network": "0.1.31",
"@harmony-js/transaction": "0.1.29", "@harmony-js/transaction": "0.1.31",
"@harmony-js/utils": "0.1.28", "@harmony-js/utils": "0.1.28",
"text-encoding": "^0.7.0" "text-encoding": "^0.7.0"
}, },

@ -7,7 +7,9 @@ import { TxParams, TxStatus } from './types';
export class TransactionFactory { export class TransactionFactory {
static getContractAddress(tx: Transaction) { static getContractAddress(tx: Transaction) {
const { from, nonce } = tx.txParams; 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; messenger: Messenger;

Loading…
Cancel
Save