docs ⦿ dedot 🧑‍💻
TypinkXTelegramGithub
dedot 🧑‍💻
dedot 🧑‍💻
  • Welcome to Dedot
  • Why Dedot?
  • Getting started
    • Installation
    • Connect to network
    • @polkadot/api -> dedot
    • Packages structure
  • Clients & Providers
    • Providers
    • Clients
  • Client API
    • ChainApi
    • Constants
    • Runtime APIs
    • Storage Queries
    • Transactions
    • Events
    • Errors
  • ink! Smart Contracts
    • Introduction
    • Generate Types & APIs
    • Deploy contracts
    • Queries
    • Transactions
    • Events
    • Handle errors
  • CLI
  • Keyring & Signer
  • Runtime upgrades
  • Type system
  • Utilities
    • HexString
    • Uint8Array (U8a)
    • String
    • Hash functions
    • Address
    • BigInt & number
    • Balances
    • Merkleized Metadata
  • Help & FAQ
    • Tutorials
      • Develop ink! dApp using Typink
    • Built with Dedot
    • Forum Posts
    • Telegram
    • Github
    • API Reference
Powered by GitBook
On this page
  • SS58 Address
  • EVM Address

Was this helpful?

Edit on GitHub
  1. Utilities

Address

SS58 Address

decodeAddress

import { decodeAddress } from 'dedot/utils';

decodeAddress('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY') // return alice raw public key

encodeAddress

import { encodeAddress } from 'dedot/utils';

encodeAddress('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', 2) // convert to Kusama address (prefix: 2)

const ALICE_PUBLIC_KEY = new Uint8Array([...]);
encodeAddress(ALICE_PUBLIC_KEY) // 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY

EVM Address

isEvmAddress

import { isEvmAddress } from 'dedot/utils';

isEvmAddress('0x00a329c0648769A73afAc7F9381E08FB43dBEA72') // true
isEvmAddress('0xInvalidAddress') // false
PreviousHash functionsNextBigInt & number

Last updated 8 months ago

Was this helpful?