Skip to content

EIP-3770

A set of utilies for parsing and verifying EIP-3770 addresses.

parseEip3770Address

Parses an address and returns the address and chain prefix. It doesn't validate the chain or the address.

ts
import { parseEip3770Address } from '@stauro/piggybank/utils'

console.log(parseEip3770Address('gor:0x1234567890000000000000000000000000000000'))

// { prefix: 'gor', address: '0x1234567890000000000000000000000000000000' }
import { parseEip3770Address } from '@stauro/piggybank/utils'

console.log(parseEip3770Address('gor:0x1234567890000000000000000000000000000000'))

// { prefix: 'gor', address: '0x1234567890000000000000000000000000000000' }

getEip3770Address

Retrieves the EIP-3770 address while validating the chain prefix and Ethereum address.

ts
import { getEip3770Address } from '@stauro/piggybank/utils'

console.log(parseEip3770Address({ chainId: 5, fullAddress: 'gor:0x1234567890000000000000000000000000000000' }))
import { getEip3770Address } from '@stauro/piggybank/utils'

console.log(parseEip3770Address({ chainId: 5, fullAddress: 'gor:0x1234567890000000000000000000000000000000' }))

WARNING

Currently only mainnet and goerli are validated, soon there will be added a global list of all chain prefixes.