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
    • Storage
    • Events
    • Handle errors
    • Utilities
  • 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
  • toEvmAddress
  • generateRandomHex

Was this helpful?

Edit on GitHub
  1. ink! Smart Contracts

Utilities

PreviousHandle errorsNextCLI

Last updated 4 days ago

Was this helpful?

toEvmAddress

Convert a Substrate address (32 bytes / H256) to an EVM address (20 bytes / H160).

import { toEvmAddress } from 'dedot/contracts'

const ALICE = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const ALICE_EVM = toEvmAddress(ALICE); // 0x9621dde636de098b43efb0fa9b61facfe328f99d

generateRandomHex

Generate a random hex as deployment salt, by default a 32-byte hex will be generated.

import { generateRandomHex } from 'dedot/utils'

const salt = generateRandomHex(); // 32 bytes
const salt64 = generateRandomHex(64); // 64 bytes

More utilities can be found in e.g: , , , ...

utilities page
formatBalance
isEvmAddress
hash functions