Accounts
Address conversion
import { getInjectiveAddress, getEthereumAddress } from '@injectivelabs/sdk-ts'
const injectiveAddress = 'inj1...'
const ethereumAddress = '0x..'
console.log('Injective address from Ethereum address => ', getInjectiveAddress(ethereumAddress))
console.log('Ethereum address from Injective address => ', getEthereumAddress(injectiveAddress))Deriving wallets
import { PrivateKey } from '@injectivelabs/sdk-ts'
const mnemonic = "indoor dish desk flag debris potato excuse depart ticket judge file exit"
const privateKey = "afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890"
const privateKeyFromMnemonic = PrivateKey.fromMnemonic(mnemonic)
const privateKeyFromHex = PrivateKey.fromPrivateKey(privateKey)
const address = privateKeyFromMnemonic.toAddress() /* or privateKeyFromHex.toAddress() */
console.log({ injectiveAddress: address.toBech32(), ethereumAddress: address.toHex() })Convert Cosmos address to Injective Address
Last updated
