diff --git a/index.js b/index.js index 6368909..3e99c26 100644 --- a/index.js +++ b/index.js @@ -518,15 +518,15 @@ class TICrypto { * @return {String} address * @memberof TICrypto */ - static secword2address(secword, { coin, pass, path, tool, hasher } = {}) { + static secword2address(secword, { coin, world, pass, path, tool, hasher } = {}) { coin = my.COIN_LIST.indexOf(coin?.toUpperCase()) >= 0 ? coin.toUpperCase() : my.COIN let kp = this.secword2keypair(secword, { coin, pass, path, tool, hasher }) if (kp) { let address if (coin === 'ETH') { - address = this.pubkey2address(this.decompressPubkey(kp.pubkey), { coin: 'ETH' }) + address = this.pubkey2address(this.decompressPubkey(kp.pubkey), { coin: 'ETH', world }) } else { - address = this.pubkey2address(kp.pubkey, { coin }) + address = this.pubkey2address(kp.pubkey, { coin, world }) } return address } @@ -574,17 +574,17 @@ class TICrypto { * @return {*} * @memberof TICrypto */ - static seckey2address(seckey, { coin } = {}) { + static seckey2address(seckey, { coin, world } = {}) { coin = my.COIN_LIST.indexOf(coin?.toUpperCase()) >= 0 ? coin.toUpperCase() : my.COIN if (this.isSeckey(seckey)) { /** @type {*} */ let pubkey if (coin === 'ETH') { pubkey = this.seckey2pubkey(seckey, { compress: false }) - return this.pubkey2address(pubkey, { coin }) + return this.pubkey2address(pubkey, { coin, world }) } else { pubkey = this.seckey2pubkey(seckey, { compress: true }) - return this.pubkey2address(pubkey, { coin }) + return this.pubkey2address(pubkey, { coin, world }) } } return null @@ -765,10 +765,10 @@ class TICrypto { * @return {*} * @memberof TICrypto */ - static pubkey2address(pubkey, { coin } = {}) { + static pubkey2address(pubkey, { coin, world } = {}) { // pubkey 应当是string类型 coin = my.COIN_LIST.indexOf(coin?.toUpperCase()) >= 0 ? coin.toUpperCase() : my.COIN - return this.position2address(this.pubkey2position(pubkey, { coin }), { coin }) + return this.position2address(this.pubkey2position(pubkey, { coin }), { coin, world }) } /**