erc3643 is a TypeScript SDK for ERC3643 contracts. It exposes Viem-native ABI constants, typed getContract instance helpers, contract bytecodes, encode helpers, and deploy helpers through versioned package subpaths.
pnpm add erc3643 viemEach contract is exported as a function that binds an address to a Viem client,
returning a fully typed getContract instance:
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { token } from 'erc3643/v4.2'
const client = createPublicClient({ chain: mainnet, transport: http() })
const tokenContract = token(tokenAddress, client)
const balance = await tokenContract.read.balanceOf([holderAddress])The same function also carries encode helpers and — where a bytecode is available — a deploy helper. ABIs and bytecodes are separate named exports.
Useful for multicall, proxy targets, or anywhere you need raw calldata rather than a sent transaction:
import { token } from 'erc3643/v4.2'
const initCalldata = token.encode.init([
identityRegistryAddress,
complianceAddress,
'My Token',
'MTK',
18,
onchainIdAddress,
])Contracts that ship a bytecode expose a typed deploy, with constructor
arguments inferred from the ABI:
import { trexFactory } from 'erc3643/v4.2'
const txHash = await trexFactory.deploy(walletClient, [
implementationAuthorityAddress,
idFactoryAddress,
])Token follows the upgradeable pattern — it has no constructor, so it is
deployed bare and configured afterwards via init:
const tokenTxHash = await token.deploy(walletClient, [])Bind the contracts you need and group them however suits your app:
import { identityRegistry, modularCompliance, token } from 'erc3643/v4.2'
const erc3643 = {
token: token(tokenAddress, client),
identityRegistry: identityRegistry(identityRegistryAddress, client),
compliance: modularCompliance(complianceAddress, client),
}
const isVerified = await erc3643.identityRegistry.read.isVerified([holderAddress])Each contract's ABI and bytecode are also exported directly, as as const
values that Viem can infer from:
import { tokenAbi, tokenBytecode } from 'erc3643/v4.2'Only the contracts you import end up in your bundle.
pnpm install
pnpm run codegen
pnpm run build
pnpm run smokeContributions are always welcome! Please see our Contributing Guide for more details on how to set up the project locally, run the type checks, and submit a pull request.
This SDK is an independent, community-driven project and is NOT an official release by the ERC-3643 Association.
While the contract ABIs and bytecodes bundled in this SDK are sourced directly from the official ERC-3643/erc3643 repository, the authors of this SDK assume no liability for the behavior, security, or compliance of the underlying smart contracts. By using this SDK, you acknowledge that you are fully responsible for auditing and validating any smart contracts you deploy or interact with.
This project is licensed under the MIT License.