formatPrivateKey
formatPrivateKey(
chain,privateKey,options?):FormattedPrivateKey
Defined in: keys.ts:148
The inverse of parsePrivateKey, in the format each chain’s wallets import:
- EVM:
0x+ 64 hex (MetaMask, Rabby); Tron: 64 hex (TronLink). - BTC, Zcash: compressed WIF (
K…/L…; testnetc…). Electrum needs ap2wpkh:prefix to land on the same SegWit address. - Solana: base58 of the 64-byte secret key (seed ‖ public key), as Phantom exports.
- NEAR:
ed25519:+ base58 of the 64-byte secret key (near-cli, MyNearWallet). - TON: hex of the 64-byte secret key (seed ‖ public key). TON wallets themselves import only 24-word phrases.
Parameters
Section titled “Parameters”privateKey
Section titled “privateKey”Uint8Array
options?
Section titled “options?”testnet?
Section titled “testnet?”boolean