Overview
TransactionUrl is a brandedstring type implementing the ERC-681 standard for representing Ethereum transactions as URLs. This enables QR code generation, deep linking, and wallet integrations.
URL Format
ERC-681 defines the format:ethereum:<address>[@<chainId>][/<function>][?<params>]
Examples:
ethereum:0x1234...- Simple transfer to addressethereum:0x1234@1- Transfer on mainnet (chainId 1)ethereum:0x1234@1?value=1000000000000000000- Transfer 1 ETHethereum:0x1234/transfer?address=0x5678&uint256=100- ERC-20 transfer call
Type Definitions
Creating TransactionUrls
from
Create a branded TransactionUrl from a string. Validates the URL format.InvalidTransactionUrlError if the URL is malformed.
format
Build a URL from transaction parameters.Parsing TransactionUrls
parse
Parse a URL string into its components.value- Wei amount (decimal or hex with 0x)gas- Gas limitgasPrice- Gas price in weidata- Hex-encoded calldata (0x…)- Other parameters are stored in
functionParams
InvalidTransactionUrlError for:
- Missing
ethereum:scheme - Invalid address
- Invalid chain ID
- Malformed numeric parameters
- Invalid hex data
Error Handling
InvalidTransactionUrlError
Thrown when URL operations fail. ExtendsInvalidFormatError from the error hierarchy.
| Property | Type | Description |
|---|---|---|
name | string | Always "InvalidTransactionUrlError" |
code | string | Always "INVALID_TRANSACTION_URL" |
value | unknown | The invalid value that caused the error |
expected | string | Description of what was expected |
details | Record<string, unknown> | Additional contextual information |
docsPath | string | Link to documentation |
url- The malformed URLscheme- For scheme errorsaddress- For address errorschainId- For chain ID errors
Use Cases
QR Code Generation
Payment Links
ERC-20 Token Transfers
Parsing Deep Links
See Also
- Address - Ethereum address type
- Transaction - Transaction encoding/decoding
- EIP-681 - Transaction URL specification

