Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ethernauta/erc

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethernauta/erc

[![bundlejs](https://deno.bundlejs.com/badge?q=@ethernauta/erc&treeshake=[*])](https://deno.bundlejs.com/?q=@ethernauta/erc&treeshake=[*])

Source
npmnpm
Version
0.0.44
Version published
Weekly downloads
345
89.56%
Maintainers
1
Weekly downloads
 
Created
Source

bundlejs

Philosophy

This module ships ERC method bindings ready to be used to read or write the blockchain. Each method is generated from the standard's reference ABI and is either a Callable<T> (view / pure) or a Signable<Bytes> (state-changing). One ERC per subpath, one method per file — so a dapp pays only for what it imports.

References:

Currently supports

StandardSubpathWhat it covers
ERC-20@ethernauta/erc/20Token Standard + burnable, capped, metadata, mintable, pausable, wrapper extensions
ERC-137@ethernauta/erc/137ENS registry + resolver + namehash / normalize
ERC-165@ethernauta/erc/165Standard Interface Detection
ERC-181@ethernauta/erc/181ENS reverse resolution
ERC-634@ethernauta/erc/634ENS text records
ERC-721@ethernauta/erc/721Non-Fungible Token Standard + burnable, enumerable, metadata, pausable extensions
ERC-1155@ethernauta/erc/1155Multi Token Standard + metadata-uri extension
ERC-1577@ethernauta/erc/1577ENS contenthash records
ERC-2304@ethernauta/erc/2304ENS multi-coin addr
ERC-2612@ethernauta/erc/2612ERC-20 permit
ERC-2981@ethernauta/erc/2981NFT royalty info
ERC-3156@ethernauta/erc/3156Flash loans (flash-borrower, flash-lender)
ERC-4494@ethernauta/erc/4494ERC-721 permit
ERC-4626@ethernauta/erc/4626Tokenized Vault Standard
ERC-5564@ethernauta/erc/5564Stealth address announcer + scheme-1
ERC-5805@ethernauta/erc/5805Voting with delegation
ERC-6372@ethernauta/erc/6372Contract clock mode
ERC-7683@ethernauta/erc/7683Cross-chain intents (origin / destination settler, order hash, sign-order)

Want one added?

Please file an issue.

Want to generate them yourself?

You can generate methods from any valid ABI .json file. See @ethernauta/cli.

Modules

API

Reading an ERC-20 view method — balanceOf

import { balanceOf } from "@ethernauta/erc/20"
import { contract, SEPOLIA_CHAIN_ID } from "./contract"

const TOKEN_ADDRESS = "0x…"
const balance = await balanceOf({ owner: account })(
  contract({ chain_id: SEPOLIA_CHAIN_ID, to: TOKEN_ADDRESS }),
)

Writing an ERC-20 state-changing method — transfer

import { transfer } from "@ethernauta/erc/20"
import { eth_sendRawTransaction } from "@ethernauta/eth"
import { number_to_hex } from "@ethernauta/utils"
import { signer, writer, SEPOLIA_CHAIN_ID } from "./resolvers"

const signed = await transfer([
  "0x636c0fcd6da2207abfa80427b556695a4ad0af94",
  number_to_hex(1),
])(signer({ chain_id: SEPOLIA_CHAIN_ID, to: TOKEN_ADDRESS }))

const hash = await eth_sendRawTransaction([signed])(
  writer({ chain_id: SEPOLIA_CHAIN_ID }),
)

Executing an ERC-721 method — approve

import { approve } from "@ethernauta/erc/721"

const signed = await approve([
  "0x636c0fcd6da2207abfa80427b556695a4ad0af94",
  "1",
])(signer({ chain_id: SEPOLIA_CHAIN_ID, to: NFT_ADDRESS }))

const hash = await eth_sendRawTransaction([signed])(
  writer({ chain_id: SEPOLIA_CHAIN_ID }),
)

Detecting interface support — ERC-165

import { supportsInterface } from "@ethernauta/erc/165"

const ERC721_INTERFACE_ID = "0x80ac58cd"
const supported = await supportsInterface({ interfaceId: ERC721_INTERFACE_ID })(
  contract({ chain_id: SEPOLIA_CHAIN_ID, to: NFT_ADDRESS }),
)

Reading a tokenized vault — ERC-4626

import { totalAssets, convertToShares } from "@ethernauta/erc/4626"

const tvl = await totalAssets()(contract({ chain_id, to: VAULT }))
const shares = await convertToShares({ assets: number_to_hex(1n * 10n ** 18n) })(
  contract({ chain_id, to: VAULT }),
)

ENS forward + reverse resolution — ERC-137 / ERC-181

import { addr, namehash, normalize, resolver, get_registry_address, ZERO_ADDRESS } from "@ethernauta/erc/137"
import { name } from "@ethernauta/erc/181"

const node = namehash(normalize("vitalik.eth"))
const resolver_address = await resolver({ node })(
  contract({ chain_id, to: get_registry_address(chain_id) }),
)
const address = await addr({ node })(
  contract({ chain_id, to: resolver_address }),
)

For the high-level multi-step orchestrators (get_ens_address, get_ens_name, get_ens_text, get_ens_avatar), see @ethernauta/ens.

ERC-7683 — cross-chain intents

import {
  hash_gasless_order, sign_gasless_order,
  build_gasless_order, compute_deadlines, random_nonce,
  address_to_bytes32, strip_hex_zeros,
  open, openFor, resolve, resolveFor,        // origin-settler methods
  fill,                                       // destination-settler method
  GASLESS_PRIMARY_TYPE, GASLESS_CROSS_CHAIN_ORDER_FIELDS,
  make_gasless_order_typed_data,
  type GaslessCrossChainOrder, type OnchainCrossChainOrder,
  type ResolvedCrossChainOrder, type Output, type FillInstruction,
} from "@ethernauta/erc/7683"

const order = build_gasless_order({ /* … */ })
const hash = hash_gasless_order({ order, settler })
const signed = await sign_gasless_order({ order })(signer({ chain_id }))

// Origin chain — open the order
const opened = await open([order, signature, originFillerData])(
  signer({ chain_id, to: ORIGIN_SETTLER }),
)
// Destination chain — fill the order
const filled = await fill([orderId, originData, fillerData])(
  signer({ chain_id: destination_chain_id, to: DESTINATION_SETTLER }),
)

Selector registry

import { REGISTRY } from "@ethernauta/erc/registry"

// REGISTRY: Record<Bytes4, { signature, names, source }>
//   — every selector for every method shipped by this package.
// The wallet uses this to surface human-readable function names
// for transactions whose call data carries a known selector.

Regenerate via pnpm --filter @ethernauta/erc generate.

FAQs

Package last updated on 28 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts