Closed taitruong closed 11 months ago
To do this kind of conversion you can't operate on the address only. You need to derive the keypair using e.g. Secp256k1HdWallet. The "Hd" in there means it can generate kerpairs from a secret key phase (aka. mnemonic). Without the private key, you can't convert between the two.
Hi, given e.g. a
stars
address we need to convert to aterra
address. Only problem is thattoBech32()
uses coin type 118 ("Cosmos), whereas Terra uses coin type 330 ("Luna"). So it ends up with a different address.https://github.com/cosmos/cosmjs/blob/4e6d54b6cf5ef50bbf6f6c238980c4431ff7b401/packages/encoding/src/bech32.ts#L3