ABI Reference
ABI definitions for Wirex smart contract integration.
ContractRegistry
Used to resolve contract addresses dynamically. You receive the registry address during onboarding and use it to look up all other contract addresses.
export const ContractRegistryAbi = [
{
type: 'function',
name: 'contractByName',
stateMutability: 'view',
inputs: [{ type: 'string', name: 'name' }],
outputs: [{ type: 'address', name: 'proxy' }],
},
{
type: 'function',
name: 'contracts',
stateMutability: 'view',
inputs: [],
outputs: [
{
type: 'tuple[]',
name: 'contractsInfo',
components: [
{ type: 'string', name: 'name' },
{ type: 'address', name: 'proxy' },
],
},
],
},
] as const;Contract Names
Use these names with contractByName() to resolve addresses:
| Name | Purpose |
|---|---|
Accounts | User registration |
FundsManagement | Executor module for oracle transactions |
ExecutionDelayPolicy | Time-lock policy for wallets |
TokensRegistry | Supported token list |
Accounts
Used for user registration. The Smart Wallet calls createUserAccountWithWallet to register with Wirex.
export const AccountsAbi = [
{
type: 'function',
name: 'createUserAccountWithWallet',
inputs: [{ type: 'bytes16', name: 'parentEntity' }],
outputs: [],
},
{
type: 'function',
name: 'getUserAccount',
stateMutability: 'view',
inputs: [
{ type: 'address', name: 'owner' },
{ type: 'bytes16', name: 'parentEntity' },
],
outputs: [
{
type: 'tuple',
components: [
{ type: 'uint8', name: 'status' },
{ type: 'uint8', name: 'verificationStatus' },
],
},
],
},
{
type: 'function',
name: 'getWallet',
stateMutability: 'view',
inputs: [
{ type: 'bytes16', name: 'parentEntity' },
{ type: 'address', name: 'wallet' },
],
outputs: [
{
type: 'tuple',
components: [
{ type: 'uint8', name: 'confirmationStatus' },
{ type: 'address', name: 'owner' },
],
},
],
},
{
type: 'event',
name: 'UserAccountCreated',
inputs: [
{ type: 'bytes16', name: 'parentEntity', indexed: false },
{ type: 'address', name: 'owner', indexed: false },
],
},
] as const;Account Status Values
| Value | Status |
|---|---|
| 0 | None (not registered) |
| 1 | Pending |
| 2 | Active |
| 3 | Blocked |
| 4 | Deleted |
Verification Status Values
| Value | Status |
|---|---|
| 0 | None |
| 1 | Applied |
| 2 | InReview |
| 3 | Approved |
| 4 | Rejected |
Kernel v3.1 (ZeroDev SDK)
The Kernel account ABI is provided by the ZeroDev SDK. Key functions for Smart Wallet setup:
import { KernelV3_1AccountAbi } from '@zerodev/sdk';
// Key functions used during setup:
// Install executor module
// moduleType: 2 = Executor
encodeFunctionData({
abi: KernelV3_1AccountAbi,
functionName: 'installModule',
args: [moduleType, moduleAddress, initData],
});
// Set policy as root validator
encodeFunctionData({
abi: KernelV3_1AccountAbi,
functionName: 'changeRootValidator',
args: [validatorId, hook, validatorData, hookData],
});
// Check if module is installed
// moduleType: 1 = Validator, 2 = Executor
const isInstalled = await publicClient.readContract({
address: smartWalletAddress,
abi: KernelV3_1AccountAbi,
functionName: 'isModuleInstalled',
args: [moduleType, moduleAddress, '0x'],
});
// Get current root validator
const rootValidator = await publicClient.readContract({
address: smartWalletAddress,
abi: KernelV3_1AccountAbi,
functionName: 'rootValidator',
});For the complete Kernel ABI, see the ZeroDev SDK documentation.
TokensRegistry
Used to retrieve the list of supported tokens.
export const TokensRegistryAbi = [
{
type: 'function',
name: 'retrieveAllTokensV2',
stateMutability: 'view',
inputs: [],
outputs: [
{
type: 'tuple[]',
components: [
{ type: 'address', name: 'tokenAddress' },
{ type: 'string', name: 'symbol' },
{ type: 'string', name: 'name' },
{ type: 'uint8', name: 'decimals' },
{ type: 'bool', name: 'isActive' },
],
},
],
},
{
type: 'function',
name: 'getToken',
stateMutability: 'view',
inputs: [{ type: 'address', name: 'tokenAddress' }],
outputs: [
{
type: 'tuple',
components: [
{ type: 'address', name: 'tokenAddress' },
{ type: 'string', name: 'symbol' },
{ type: 'string', name: 'name' },
{ type: 'uint8', name: 'decimals' },
{ type: 'bool', name: 'isActive' },
],
},
],
},
] as const;ERC20 (Standard)
Standard ERC20 interface for token operations.
export const ERC20Abi = [
{
type: 'function',
name: 'balanceOf',
stateMutability: 'view',
inputs: [{ type: 'address', name: 'account' }],
outputs: [{ type: 'uint256' }],
},
{
type: 'function',
name: 'transfer',
inputs: [
{ type: 'address', name: 'to' },
{ type: 'uint256', name: 'amount' },
],
outputs: [{ type: 'bool' }],
},
{
type: 'function',
name: 'approve',
inputs: [
{ type: 'address', name: 'spender' },
{ type: 'uint256', name: 'amount' },
],
outputs: [{ type: 'bool' }],
},
{
type: 'function',
name: 'allowance',
stateMutability: 'view',
inputs: [
{ type: 'address', name: 'owner' },
{ type: 'address', name: 'spender' },
],
outputs: [{ type: 'uint256' }],
},
{
type: 'function',
name: 'decimals',
stateMutability: 'view',
inputs: [],
outputs: [{ type: 'uint8' }],
},
{
type: 'function',
name: 'symbol',
stateMutability: 'view',
inputs: [],
outputs: [{ type: 'string' }],
},
] as const;TypeScript Usage
Import and use these ABIs in your TypeScript code:
import { encodeFunctionData, decodeFunctionResult } from 'viem';
// Encode a function call
const callData = encodeFunctionData({
abi: AccountsAbi,
functionName: 'createUserAccountWithWallet',
args: [partnerId],
});
// Read contract state
const result = await publicClient.readContract({
address: contractAddress,
abi: AccountsAbi,
functionName: 'getUserAccount',
args: [walletAddress, partnerId],
});Updated 8 days ago
