buf fix: 把 options 换成 {...} 写法后,secword2address 没能把 world 参数传递到 position2address,导致生成地址错误。
This commit is contained in:
parent
d0500a9730
commit
7ac41c9f32
16
index.js
16
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 })
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user