Address
A 0x-prefixed hex string identifying an account or contract on Dango.
Definition
type Address = `0x${string}`Construction
import type { Address } from "@left-curve/sdk"
import { isValidAddress } from "@left-curve/sdk"
const addr: Address = "0x1234567890abcdef1234567890abcdef12345678"
if (!isValidAddress(candidate)) {
throw new Error(`invalid address: ${candidate}`)
}Notes
- A valid address is exactly 42 characters:
"0x"plus 40 hex digits (20 bytes). - The branded
0x${string}template literal type prevents arbitrary strings from being passed where addresses are expected. - The SDK exports two helpers:
computeAddressderives an address from(deployer, codeHash, salt), andisValidAddressvalidates a string at runtime.