I have a Public key (hex) and would like to convert it to an SS58 Address. What is the right function to use?
I found the docs here with an code-sniped: https://substrate-developer-hub.github.io/docs/en/knowledgebase/advanced/ss58-address-format
👇
Public key (hex): 0x46ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a
SS58 Address: 12bzRJfh7arnnfPPUZHeJUaE62QLEwhK48QnH9LXeK2m1iZU
👇
// Import Polkadot.js API dependencies.
const { decodeAddress, encodeAddress } = require("@polkadot/keyring");
const { hexToU8a, isHex } = require("@polkadot/util");
isHex(address)
hexToU8a(address)
decodeAddress(address)
encodeAddress(address)
But these functions do not bring the right results..
Any suggestions?