Skip to main content
After you read this page, you can build each transaction and each signed payload of Anafi yourself, for example on a server, in a test, or in a wallet of your own. These are pure functions with no I/O, unless an entry says otherwise. The client uses each of them. Each calldata builder gives the same bytes as the client.

ABI fragments

Each constant is a viem ABI (parseAbi), for readContract, encodeFunctionData and decodeEventLog. These fragments hold only what the SDK uses. For the full interface of each contract, see the contracts.

DSL registry

buildDslCommitCalldata

Encodes AnafiDslRegistry.commitDsl(commitment, validUntil, engineSig, adapter). Every account kind sends this same call; only the way it reaches the registry differs. Take commitment, engineSig, attestationValidUntilUnixSeconds and adapter from a staged value. The selector is 0x385971b5.

Stage payload

dslStagePayload is the plaintext that the stage seals under dslSealInfo(network, account). The first byte 0x02 tags a frame that names its parent. A null parent is version 0 and the zero hash. The adapter and the parent are framing only: the commitment stays keccak256(salt ‖ yaml). It throws for an invalid adapter, a negative or unsafe parent version, and a parent hash or salt that is not 32 bytes. assertBytes32Hex throws unless value is a string of exactly 0x and 64 hex characters. It checks the text before any decode, so a 63-digit value cannot pass as 32 bytes.

Safe

Constants

SafeTransaction and SafeBatchLeg

Address prediction

proxyCreationCode is the answer of SafeProxyFactory.proxyCreationCode(). Read it from the chain; anafi.predictSafe(owner) does this for you. The deploy call is createProxyWithNonce(singleton, safeSetupInitializer(...), safeSaltNonce(owner)).

Transactions and legs

With safeTxGas and gasPrice at 0, a failed inner call reverts the whole Safe transaction.

Typed data, digest and signatures

Build and send an owner-sent commit without the client:

ERC20Allow calldata

The account sends each one as a plain transaction with no value.

ERC-20 transfer

Encodes transfer(to, amount). Send it to the token from the payer.

Gas credit

readGasCredit and buildClaimGasCreditCalldata are on activity and fees.

Relayed receipts

waitForRelayedTransaction(publicClient, txHash) is on Safe account.