Skip to main content

Module: reads

Interfaces

Functions

bribeGaugeContract

bribeGaugeContract(bribeAddress): Object

Parameters

NameType
bribeAddress`0x${string}`

Returns

Object

NameType
abireadonly [{ inputs: readonly [{ internalType: "address" = 'address'; name: "_gauge" = '_gauge'; type: "address" = 'address' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "constructor" = 'constructor' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "from" = 'from'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { indexed: true = true; internalType: "uint256" = 'uint256'; name: "week" = 'week'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "AddReward" = 'AddReward'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { indexed: true = true; internalType: "uint256" = 'uint256'; name: "week" = 'week'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "ClaimReward" = 'ClaimReward'; type: "event" = 'event' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "week" = 'week'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "addReward" = 'addReward'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "week" = 'week'; type: "uint256" = 'uint256' }] ; name: "claimReward" = 'claimReward'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { internalType: "uint256[]" = 'uint256[]'; name: "week" = 'week'; type: "uint256[]" = 'uint256[]' }] ; name: "claimRewards" = 'claimRewards'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address[]" = 'address[]'; name: "token" = 'token'; type: "address[]" = 'address[]' }, { internalType: "uint256[][]" = 'uint256[][]'; name: "week" = 'week'; type: "uint256[][]" = 'uint256[][]' }] ; name: "claimRewardsMultipleTokens" = 'claimRewardsMultipleTokens'; outputs: readonly [{ internalType: "uint256[]" = 'uint256[]'; name: "amount" = 'amount'; type: "uint256[]" = 'uint256[]' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "claimed" = 'claimed'; outputs: readonly [{ internalType: "bool" = 'bool'; name: "" = ''; type: "bool" = 'bool' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "gauge" = 'gauge'; outputs: readonly [{ internalType: "contract IGauge" = 'contract IGauge'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "tokenRewardOfWeek" = 'tokenRewardOfWeek'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }]
address`0x${string}`
functionName"gauge"

Defined in

src/reads/getBribes.ts:26


farmGlobalPoolContract

farmGlobalPoolContract(farmAddress): Object

Parameters

NameType
farmAddress`0x${string}`

Returns

Object

NameType
abireadonly [{ inputs: readonly [{ internalType: "address" = 'address'; name: "_owner" = '_owner'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "_agency" = '_agency'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "_gov" = '_gov'; type: "address" = 'address' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "constructor" = 'constructor' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountIn" = 'amountIn'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; name: "GrantSP" = 'GrantSP'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "RateUpdated" = 'RateUpdated'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "parent" = 'parent'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountIn" = 'amountIn'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; name: "Swap" = 'Swap'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: false = false; internalType: "address" = 'address'; name: "newOwner" = 'newOwner'; type: "address" = 'address' }] ; name: "TransferOwnership" = 'TransferOwnership'; type: "event" = 'event' }, { inputs: readonly [] = []; name: "agency" = 'agency'; outputs: readonly [{ internalType: "contract IAgency" = 'contract IAgency'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "cooldown" = 'cooldown'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "getCurrentGlobalReserve" = 'getCurrentGlobalReserve'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "reserve" = 'reserve'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }] ; name: "getCurrentPoolReserve" = 'getCurrentPoolReserve'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "reserve" = 'reserve'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "globalPool" = 'globalPool'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastUpdateTime" = 'lastUpdateTime'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastReserve" = 'lastReserve'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "gov" = 'gov'; outputs: readonly [{ internalType: "contract IERC20Mintable" = 'contract IERC20Mintable'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "grantSP" = 'grantSP'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "owner" = 'owner'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "pools" = 'pools'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastUpdateTime" = 'lastUpdateTime'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastReserve" = 'lastReserve'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "tokenAddress" = 'tokenAddress'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "rescueERC20" = 'rescueERC20'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "setGlobalRewardRate" = 'setGlobalRewardRate'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; name: "setPool" = 'setPool'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "setPoolRewardRate" = 'setPoolRewardRate'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }] ; name: "swap" = 'swap'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "_owner" = '_owner'; type: "address" = 'address' }] ; name: "transferOwnership" = 'transferOwnership'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }]
address`0x${string}`
functionName"globalPool"

Defined in

src/reads/getFarmInfo.ts:44


farmSpBalanceContract

farmSpBalanceContract(farmAddress, account): Object

Parameters

NameType
farmAddress`0x${string}`
account`0x${string}`

Returns

Object

NameType
abireadonly [{ inputs: readonly [{ internalType: "address" = 'address'; name: "_owner" = '_owner'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "_agency" = '_agency'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "_gov" = '_gov'; type: "address" = 'address' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "constructor" = 'constructor' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountIn" = 'amountIn'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; name: "GrantSP" = 'GrantSP'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "RateUpdated" = 'RateUpdated'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "parent" = 'parent'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountIn" = 'amountIn'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; name: "Swap" = 'Swap'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: false = false; internalType: "address" = 'address'; name: "newOwner" = 'newOwner'; type: "address" = 'address' }] ; name: "TransferOwnership" = 'TransferOwnership'; type: "event" = 'event' }, { inputs: readonly [] = []; name: "agency" = 'agency'; outputs: readonly [{ internalType: "contract IAgency" = 'contract IAgency'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "cooldown" = 'cooldown'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "getCurrentGlobalReserve" = 'getCurrentGlobalReserve'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "reserve" = 'reserve'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }] ; name: "getCurrentPoolReserve" = 'getCurrentPoolReserve'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "reserve" = 'reserve'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "globalPool" = 'globalPool'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastUpdateTime" = 'lastUpdateTime'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastReserve" = 'lastReserve'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "gov" = 'gov'; outputs: readonly [{ internalType: "contract IERC20Mintable" = 'contract IERC20Mintable'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "grantSP" = 'grantSP'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "owner" = 'owner'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "pools" = 'pools'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastUpdateTime" = 'lastUpdateTime'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastReserve" = 'lastReserve'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "tokenAddress" = 'tokenAddress'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "rescueERC20" = 'rescueERC20'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "setGlobalRewardRate" = 'setGlobalRewardRate'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; name: "setPool" = 'setPool'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "setPoolRewardRate" = 'setPoolRewardRate'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }] ; name: "swap" = 'swap'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "_owner" = '_owner'; type: "address" = 'address' }] ; name: "transferOwnership" = 'transferOwnership'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }]
address`0x${string}`
args[`0x${string}`]
functionName"balanceOf"

Defined in

src/reads/getFarmInfo.ts:26


farmSwapSpCdContract

farmSwapSpCdContract(farmAddress, account): Object

Parameters

NameType
farmAddress`0x${string}`
account`0x${string}`

Returns

Object

NameType
abireadonly [{ inputs: readonly [{ internalType: "address" = 'address'; name: "_owner" = '_owner'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "_agency" = '_agency'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "_gov" = '_gov'; type: "address" = 'address' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "constructor" = 'constructor' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountIn" = 'amountIn'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; name: "GrantSP" = 'GrantSP'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "RateUpdated" = 'RateUpdated'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "parent" = 'parent'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountIn" = 'amountIn'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; name: "Swap" = 'Swap'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: false = false; internalType: "address" = 'address'; name: "newOwner" = 'newOwner'; type: "address" = 'address' }] ; name: "TransferOwnership" = 'TransferOwnership'; type: "event" = 'event' }, { inputs: readonly [] = []; name: "agency" = 'agency'; outputs: readonly [{ internalType: "contract IAgency" = 'contract IAgency'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "cooldown" = 'cooldown'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "getCurrentGlobalReserve" = 'getCurrentGlobalReserve'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "reserve" = 'reserve'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }] ; name: "getCurrentPoolReserve" = 'getCurrentPoolReserve'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "reserve" = 'reserve'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "globalPool" = 'globalPool'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastUpdateTime" = 'lastUpdateTime'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastReserve" = 'lastReserve'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "gov" = 'gov'; outputs: readonly [{ internalType: "contract IERC20Mintable" = 'contract IERC20Mintable'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "grantSP" = 'grantSP'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "owner" = 'owner'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "pools" = 'pools'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastUpdateTime" = 'lastUpdateTime'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastReserve" = 'lastReserve'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "tokenAddress" = 'tokenAddress'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "rescueERC20" = 'rescueERC20'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "setGlobalRewardRate" = 'setGlobalRewardRate'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; name: "setPool" = 'setPool'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "poolId" = 'poolId'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }] ; name: "setPoolRewardRate" = 'setPoolRewardRate'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }] ; name: "swap" = 'swap'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "_owner" = '_owner'; type: "address" = 'address' }] ; name: "transferOwnership" = 'transferOwnership'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }]
address`0x${string}`
args[`0x${string}`]
functionName"cooldown"

Defined in

src/reads/getFarmInfo.ts:35


getAccountNotes

getAccountNotes(client, args): Promise<IDysonPairNotes>

Parameters

NameTypeDescription
clientObject-
client.accountundefinedThe Account of the Client.
client.batch?ObjectFlags for batch settings.
client.batch.multicall?boolean | { batchSize?: number ; wait?: number }Toggle to enable eth_call multicall aggregation.
client.cacheTimenumberTime (in ms) that cached data will remain in memory.
client.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call.html - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
client.chainundefined | ChainChain for the client.
client.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter.html - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
client.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
client.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in string | number | symbol]: Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>[K] }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter.html - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
client.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter.html - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
client.estimateContractGas<TChain, TAbi, TFunctionName>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain, undefined | Account>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas.html Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
client.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
client.estimateGas(args: EstimateGasParameters<undefined | Chain, undefined | Account>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas.html - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
client.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
client.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in string | number | symbol]: client[K] } & PublicActions<Transport, undefined | Chain>>-
client.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance.html - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
client.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<GetBlockReturnType<undefined | Chain, TIncludeTransactions, TBlockTag>>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
client.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
client.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
client.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode.html - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
client.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId.html - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
client.getContractEvents<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetContractEventsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetContractEventsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents.html - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
client.getEnsAddress(args: { blockNumber?: bigint ; blockTag?: BlockTag ; coinType?: number ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wagmi-dev.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
client.getEnsAvatar(args: { blockNumber?: bigint ; blockTag?: BlockTag ; gatewayUrls?: AssetGatewayUrls ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wagmi-dev.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
client.getEnsName(args: { address: `0x${string}` ; blockNumber?: bigint ; blockTag?: BlockTag ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wagmi-dev.eth'
client.getEnsResolver(args: { blockNumber?: bigint ; blockTag?: BlockTag ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wagmi-dev.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
client.getEnsText(args: { blockNumber?: bigint ; blockTag?: BlockTag ; key: string ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wagmi-dev.eth'), key: 'com.twitter', }) // 'wagmi_sh'
client.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
client.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
client.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
client.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice.html - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
client.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
client.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt.html - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
client.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<GetTransactionReturnType<undefined | Chain, TBlockTag>>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.keystringA key for the client.
client.multicall<TContracts, TAllowFailure>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
client.namestringA name for the client.
client.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
client.prepareTransactionRequest<TChainOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride>) => Promise<PrepareTransactionRequestReturnType>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
client.readContract<TAbi, TFunctionName>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
client.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
client.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
client.simulateContract<TAbi, TFunctionName, TChainOverride>(args: SimulateContractParameters<TAbi, TFunctionName, undefined | Chain, TChainOverride>) => Promise<SimulateContractReturnType<TAbi, TFunctionName, undefined | Chain, TChainOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
client.typestringThe type of client.
client.uidstringA unique ID for the client.
client.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
client.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
client.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
client.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
client.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
client.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent.html Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
client.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent.html - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
client.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })
argsReadContractParameters<{ account: `0x${string}` ; noteCounts: number[] ; pairAddresses: `0x${string}`[] }>-

Returns

Promise<IDysonPairNotes>

Defined in

src/reads/getAccountNotes.ts:19


getAgencyReferrerGenInfo

getAgencyReferrerGenInfo(address): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "_owner" = '_owner'; type: "address" = 'address' }] ; name: "userInfo" = 'userInfo'; outputs: readonly [{ internalType: "address" = 'address'; name: "ref" = 'ref'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "gen" = 'gen'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
address`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "_owner" = '_owner'; type: "address" = 'address' }] ; name: "userInfo" = 'userInfo'; outputs: readonly [{ internalType: "address" = 'address'; name: "ref" = 'ref'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "gen" = 'gen'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getAgencyInfo.ts:6


getAgencyWhois

getAgencyWhois(address): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "whois" = 'whois'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
address`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "whois" = 'whois'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getAgencyWhois.ts:6


getAgentInfo

getAgentInfo(userId): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "id" = 'id'; type: "uint256" = 'uint256' }] ; name: "getAgent" = 'getAgent'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }, { internalType: "uint256[]" = 'uint256[]'; name: "" = ''; type: "uint256[]" = 'uint256[]' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
userIdbigint

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "id" = 'id'; type: "uint256" = 'uint256' }] ; name: "getAgent" = 'getAgent'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }, { internalType: "uint256[]" = 'uint256[]'; name: "" = ''; type: "uint256[]" = 'uint256[]' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getAgencyInfo.ts:13


getBaseSDysonInfo

getBaseSDysonInfo(): PrepareFunctionParamsReturnType<{ inputs: readonly [] = []; name: "totalSupply" = 'totalSupply'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [] = []; name: "totalSupply" = 'totalSupply'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getSDysonInfo.ts:5


getDysonAmountStaked

getDysonAmountStaked(address): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "dysonAmountStaked" = 'dysonAmountStaked'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
address`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "dysonAmountStaked" = 'dysonAmountStaked'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getSDysonInfo.ts:18


getDysonPairInfos

getDysonPairInfos(client, args): Promise<{ dysonPairInfoList: DysonPair[] }>

Parameters

NameTypeDescription
clientObject-
client.accountundefinedThe Account of the Client.
client.batch?ObjectFlags for batch settings.
client.batch.multicall?boolean | { batchSize?: number ; wait?: number }Toggle to enable eth_call multicall aggregation.
client.cacheTimenumberTime (in ms) that cached data will remain in memory.
client.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call.html - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
client.chainundefined | ChainChain for the client.
client.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter.html - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
client.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
client.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in string | number | symbol]: Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>[K] }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter.html - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
client.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter.html - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
client.estimateContractGas<TChain, TAbi, TFunctionName>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain, undefined | Account>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas.html Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
client.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
client.estimateGas(args: EstimateGasParameters<undefined | Chain, undefined | Account>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas.html - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
client.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
client.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in string | number | symbol]: client[K] } & PublicActions<Transport, undefined | Chain>>-
client.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance.html - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
client.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<GetBlockReturnType<undefined | Chain, TIncludeTransactions, TBlockTag>>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
client.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
client.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
client.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode.html - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
client.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId.html - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
client.getContractEvents<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetContractEventsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetContractEventsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents.html - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
client.getEnsAddress(args: { blockNumber?: bigint ; blockTag?: BlockTag ; coinType?: number ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wagmi-dev.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
client.getEnsAvatar(args: { blockNumber?: bigint ; blockTag?: BlockTag ; gatewayUrls?: AssetGatewayUrls ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wagmi-dev.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
client.getEnsName(args: { address: `0x${string}` ; blockNumber?: bigint ; blockTag?: BlockTag ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wagmi-dev.eth'
client.getEnsResolver(args: { blockNumber?: bigint ; blockTag?: BlockTag ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wagmi-dev.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
client.getEnsText(args: { blockNumber?: bigint ; blockTag?: BlockTag ; key: string ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wagmi-dev.eth'), key: 'com.twitter', }) // 'wagmi_sh'
client.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
client.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
client.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
client.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice.html - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
client.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
client.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt.html - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
client.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<GetTransactionReturnType<undefined | Chain, TBlockTag>>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.keystringA key for the client.
client.multicall<TContracts, TAllowFailure>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
client.namestringA name for the client.
client.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
client.prepareTransactionRequest<TChainOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride>) => Promise<PrepareTransactionRequestReturnType>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
client.readContract<TAbi, TFunctionName>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
client.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
client.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
client.simulateContract<TAbi, TFunctionName, TChainOverride>(args: SimulateContractParameters<TAbi, TFunctionName, undefined | Chain, TChainOverride>) => Promise<SimulateContractReturnType<TAbi, TFunctionName, undefined | Chain, TChainOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
client.typestringThe type of client.
client.uidstringA unique ID for the client.
client.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
client.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
client.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
client.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
client.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
client.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent.html Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
client.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent.html - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
client.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })
argsReadContractParameters<{ account: `0x${string}` ; farmAddress?: `0x${string}` ; pairConfigs: { pairAddress: `0x${string}` ; token0Address: `0x${string}` ; token1Address: `0x${string}` }[] }>-

Returns

Promise<{ dysonPairInfoList: DysonPair[] }>

Defined in

src/reads/getDysonPairInfos.ts:73


getFarmRewardInfo

getFarmRewardInfo(client, args): Promise<IFarmRewardInfo>

Parameters

NameTypeDescription
clientObject-
client.accountundefinedThe Account of the Client.
client.batch?ObjectFlags for batch settings.
client.batch.multicall?boolean | { batchSize?: number ; wait?: number }Toggle to enable eth_call multicall aggregation.
client.cacheTimenumberTime (in ms) that cached data will remain in memory.
client.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call.html - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
client.chainundefined | ChainChain for the client.
client.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter.html - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
client.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
client.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in string | number | symbol]: Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>[K] }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter.html - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
client.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter.html - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
client.estimateContractGas<TChain, TAbi, TFunctionName>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain, undefined | Account>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas.html Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
client.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
client.estimateGas(args: EstimateGasParameters<undefined | Chain, undefined | Account>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas.html - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
client.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
client.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in string | number | symbol]: client[K] } & PublicActions<Transport, undefined | Chain>>-
client.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance.html - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
client.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<GetBlockReturnType<undefined | Chain, TIncludeTransactions, TBlockTag>>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
client.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
client.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
client.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode.html - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
client.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId.html - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
client.getContractEvents<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetContractEventsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetContractEventsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents.html - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
client.getEnsAddress(args: { blockNumber?: bigint ; blockTag?: BlockTag ; coinType?: number ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wagmi-dev.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
client.getEnsAvatar(args: { blockNumber?: bigint ; blockTag?: BlockTag ; gatewayUrls?: AssetGatewayUrls ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wagmi-dev.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
client.getEnsName(args: { address: `0x${string}` ; blockNumber?: bigint ; blockTag?: BlockTag ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wagmi-dev.eth'
client.getEnsResolver(args: { blockNumber?: bigint ; blockTag?: BlockTag ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wagmi-dev.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
client.getEnsText(args: { blockNumber?: bigint ; blockTag?: BlockTag ; key: string ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wagmi-dev.eth'), key: 'com.twitter', }) // 'wagmi_sh'
client.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
client.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
client.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
client.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice.html - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
client.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
client.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt.html - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
client.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<GetTransactionReturnType<undefined | Chain, TBlockTag>>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.keystringA key for the client.
client.multicall<TContracts, TAllowFailure>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
client.namestringA name for the client.
client.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
client.prepareTransactionRequest<TChainOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride>) => Promise<PrepareTransactionRequestReturnType>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
client.readContract<TAbi, TFunctionName>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
client.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
client.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
client.simulateContract<TAbi, TFunctionName, TChainOverride>(args: SimulateContractParameters<TAbi, TFunctionName, undefined | Chain, TChainOverride>) => Promise<SimulateContractReturnType<TAbi, TFunctionName, undefined | Chain, TChainOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
client.typestringThe type of client.
client.uidstringA unique ID for the client.
client.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
client.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
client.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
client.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
client.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
client.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent.html Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
client.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent.html - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
client.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })
argsReadContractParameters<{ account: `0x${string}` ; farmAddress: `0x${string}` }>-

Returns

Promise<IFarmRewardInfo>

Defined in

src/reads/getFarmInfo.ts:52


getPairAllowanceMap

getPairAllowanceMap(client, args): Promise<ITokenAllowanceMap>

Parameters

NameTypeDescription
clientObject-
client.accountundefinedThe Account of the Client.
client.batch?ObjectFlags for batch settings.
client.batch.multicall?boolean | { batchSize?: number ; wait?: number }Toggle to enable eth_call multicall aggregation.
client.cacheTimenumberTime (in ms) that cached data will remain in memory.
client.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call.html - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
client.chainundefined | ChainChain for the client.
client.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter.html - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
client.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
client.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in string | number | symbol]: Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>[K] }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter.html - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
client.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter.html - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
client.estimateContractGas<TChain, TAbi, TFunctionName>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain, undefined | Account>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas.html Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
client.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
client.estimateGas(args: EstimateGasParameters<undefined | Chain, undefined | Account>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas.html - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
client.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
client.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in string | number | symbol]: client[K] } & PublicActions<Transport, undefined | Chain>>-
client.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance.html - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
client.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<GetBlockReturnType<undefined | Chain, TIncludeTransactions, TBlockTag>>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
client.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
client.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
client.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode.html - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
client.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId.html - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
client.getContractEvents<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetContractEventsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetContractEventsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents.html - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
client.getEnsAddress(args: { blockNumber?: bigint ; blockTag?: BlockTag ; coinType?: number ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wagmi-dev.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
client.getEnsAvatar(args: { blockNumber?: bigint ; blockTag?: BlockTag ; gatewayUrls?: AssetGatewayUrls ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wagmi-dev.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
client.getEnsName(args: { address: `0x${string}` ; blockNumber?: bigint ; blockTag?: BlockTag ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wagmi-dev.eth'
client.getEnsResolver(args: { blockNumber?: bigint ; blockTag?: BlockTag ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wagmi-dev.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
client.getEnsText(args: { blockNumber?: bigint ; blockTag?: BlockTag ; key: string ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wagmi-dev.eth'), key: 'com.twitter', }) // 'wagmi_sh'
client.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
client.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
client.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
client.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice.html - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
client.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
client.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt.html - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
client.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<GetTransactionReturnType<undefined | Chain, TBlockTag>>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.keystringA key for the client.
client.multicall<TContracts, TAllowFailure>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
client.namestringA name for the client.
client.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
client.prepareTransactionRequest<TChainOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride>) => Promise<PrepareTransactionRequestReturnType>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
client.readContract<TAbi, TFunctionName>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
client.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
client.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
client.simulateContract<TAbi, TFunctionName, TChainOverride>(args: SimulateContractParameters<TAbi, TFunctionName, undefined | Chain, TChainOverride>) => Promise<SimulateContractReturnType<TAbi, TFunctionName, undefined | Chain, TChainOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
client.typestringThe type of client.
client.uidstringA unique ID for the client.
client.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
client.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
client.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
client.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
client.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
client.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent.html Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
client.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent.html - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
client.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })
argsReadContractParameters<{ account: `0x${string}` ; tokenAllowanceMap: ITokenAllowanceMap }>-

Returns

Promise<ITokenAllowanceMap>

Defined in

src/reads/getTokenAllowance.ts:41


getPairOperatorApprovals

getPairOperatorApprovals(owner, operator): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "operatorApprovals" = 'operatorApprovals'; outputs: readonly [{ internalType: "bool" = 'bool'; name: "" = ''; type: "bool" = 'bool' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
owner`0x${string}`
operator`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "operatorApprovals" = 'operatorApprovals'; outputs: readonly [{ internalType: "bool" = 'bool'; name: "" = ''; type: "bool" = 'bool' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getPairOperatorApprovals.ts:7


getPairsConfig

getPairsConfig(client, args): Promise<DysonConfigMapType>

Parameters

NameTypeDescription
clientObject-
client.accountundefinedThe Account of the Client.
client.batch?ObjectFlags for batch settings.
client.batch.multicall?boolean | { batchSize?: number ; wait?: number }Toggle to enable eth_call multicall aggregation.
client.cacheTimenumberTime (in ms) that cached data will remain in memory.
client.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call.html - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
client.chainundefined | ChainChain for the client.
client.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter.html - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
client.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
client.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in string | number | symbol]: Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>[K] }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter.html - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
client.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter.html - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
client.estimateContractGas<TChain, TAbi, TFunctionName>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain, undefined | Account>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas.html Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
client.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
client.estimateGas(args: EstimateGasParameters<undefined | Chain, undefined | Account>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas.html - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
client.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
client.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in string | number | symbol]: client[K] } & PublicActions<Transport, undefined | Chain>>-
client.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance.html - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
client.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<GetBlockReturnType<undefined | Chain, TIncludeTransactions, TBlockTag>>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
client.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
client.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
client.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode.html - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
client.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId.html - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
client.getContractEvents<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetContractEventsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetContractEventsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents.html - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
client.getEnsAddress(args: { blockNumber?: bigint ; blockTag?: BlockTag ; coinType?: number ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wagmi-dev.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
client.getEnsAvatar(args: { blockNumber?: bigint ; blockTag?: BlockTag ; gatewayUrls?: AssetGatewayUrls ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wagmi-dev.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
client.getEnsName(args: { address: `0x${string}` ; blockNumber?: bigint ; blockTag?: BlockTag ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wagmi-dev.eth'
client.getEnsResolver(args: { blockNumber?: bigint ; blockTag?: BlockTag ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wagmi-dev.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
client.getEnsText(args: { blockNumber?: bigint ; blockTag?: BlockTag ; key: string ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wagmi-dev.eth'), key: 'com.twitter', }) // 'wagmi_sh'
client.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
client.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
client.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
client.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice.html - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
client.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
client.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt.html - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
client.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<GetTransactionReturnType<undefined | Chain, TBlockTag>>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.keystringA key for the client.
client.multicall<TContracts, TAllowFailure>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
client.namestringA name for the client.
client.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
client.prepareTransactionRequest<TChainOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride>) => Promise<PrepareTransactionRequestReturnType>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
client.readContract<TAbi, TFunctionName>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
client.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
client.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
client.simulateContract<TAbi, TFunctionName, TChainOverride>(args: SimulateContractParameters<TAbi, TFunctionName, undefined | Chain, TChainOverride>) => Promise<SimulateContractReturnType<TAbi, TFunctionName, undefined | Chain, TChainOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
client.typestringThe type of client.
client.uidstringA unique ID for the client.
client.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
client.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
client.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
client.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
client.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
client.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent.html Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
client.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent.html - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
client.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })
argsReadContractParameters<{ factoryAddress: `0x${string}` ; pairLength: number }>-

Returns

Promise<DysonConfigMapType>

Defined in

src/reads/getPairsConfig.ts:43


getPairsNonces

getPairsNonces(owner): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "nonces" = 'nonces'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
owner`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "nonces" = 'nonces'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getPairsNonces.ts:6


getReferralCodeUsed

getReferralCodeUsed(client, oneTimeCodeList, agencyAddress): Promise<({ error: Error ; result?: undefined ; status: "failure" } | { error?: undefined ; result: boolean ; status: "success" })[]>

Parameters

NameTypeDescription
clientObject-
client.accountundefinedThe Account of the Client.
client.batch?ObjectFlags for batch settings.
client.batch.multicall?boolean | { batchSize?: number ; wait?: number }Toggle to enable eth_call multicall aggregation.
client.cacheTimenumberTime (in ms) that cached data will remain in memory.
client.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call.html - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
client.chainundefined | ChainChain for the client.
client.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter.html - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
client.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
client.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in string | number | symbol]: Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>[K] }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter.html - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
client.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter.html - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
client.estimateContractGas<TChain, TAbi, TFunctionName>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain, undefined | Account>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas.html Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
client.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
client.estimateGas(args: EstimateGasParameters<undefined | Chain, undefined | Account>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas.html - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
client.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
client.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in string | number | symbol]: client[K] } & PublicActions<Transport, undefined | Chain>>-
client.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance.html - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
client.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<GetBlockReturnType<undefined | Chain, TIncludeTransactions, TBlockTag>>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
client.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
client.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
client.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode.html - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
client.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId.html - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
client.getContractEvents<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetContractEventsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetContractEventsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents.html - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
client.getEnsAddress(args: { blockNumber?: bigint ; blockTag?: BlockTag ; coinType?: number ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wagmi-dev.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
client.getEnsAvatar(args: { blockNumber?: bigint ; blockTag?: BlockTag ; gatewayUrls?: AssetGatewayUrls ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wagmi-dev.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
client.getEnsName(args: { address: `0x${string}` ; blockNumber?: bigint ; blockTag?: BlockTag ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wagmi-dev.eth'
client.getEnsResolver(args: { blockNumber?: bigint ; blockTag?: BlockTag ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wagmi-dev.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
client.getEnsText(args: { blockNumber?: bigint ; blockTag?: BlockTag ; key: string ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wagmi-dev.eth'), key: 'com.twitter', }) // 'wagmi_sh'
client.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
client.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
client.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
client.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice.html - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
client.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
client.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt.html - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
client.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<GetTransactionReturnType<undefined | Chain, TBlockTag>>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.keystringA key for the client.
client.multicall<TContracts, TAllowFailure>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
client.namestringA name for the client.
client.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
client.prepareTransactionRequest<TChainOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride>) => Promise<PrepareTransactionRequestReturnType>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
client.readContract<TAbi, TFunctionName>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
client.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
client.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
client.simulateContract<TAbi, TFunctionName, TChainOverride>(args: SimulateContractParameters<TAbi, TFunctionName, undefined | Chain, TChainOverride>) => Promise<SimulateContractReturnType<TAbi, TFunctionName, undefined | Chain, TChainOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
client.typestringThe type of client.
client.uidstringA unique ID for the client.
client.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
client.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
client.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
client.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
client.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
client.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent.html Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
client.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent.html - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
client.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })
oneTimeCodeList`0x${string}`[]-
agencyAddress`0x${string}`-

Returns

Promise<({ error: Error ; result?: undefined ; status: "failure" } | { error?: undefined ; result: boolean ; status: "success" })[]>

Defined in

src/reads/getReferralCodeUsed.ts:6


getSDysonBalance

getSDysonBalance(address): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
address`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getSDysonInfo.ts:11


getSPBalanceOf

getSPBalanceOf(address): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
address`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getFarmInfo.ts:12


getSPCoolDown

getSPCoolDown(address): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "cooldown" = 'cooldown'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
address`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "cooldown" = 'cooldown'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getFarmInfo.ts:19


getStakingRate

getStakingRate(lockPeriod): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "lockDuration" = 'lockDuration'; type: "uint256" = 'uint256' }] ; name: "getStakingRate" = 'getStakingRate'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "rate" = 'rate'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
lockPeriodbigint

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "lockDuration" = 'lockDuration'; type: "uint256" = 'uint256' }] ; name: "getStakingRate" = 'getStakingRate'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "rate" = 'rate'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getStakingRate.ts:6


getVaultCount

getVaultCount(address): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "vaultCount" = 'vaultCount'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
address`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "vaultCount" = 'vaultCount'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getStakingVault.ts:6


getVaults

getVaults(client, contractAddress, address, vaultAmount): Promise<({ error: Error ; result?: undefined ; status: "failure" } | { error?: undefined ; result: readonly [bigint, bigint, bigint] ; status: "success" })[]>

Parameters

NameTypeDescription
clientObject-
client.accountundefinedThe Account of the Client.
client.batch?ObjectFlags for batch settings.
client.batch.multicall?boolean | { batchSize?: number ; wait?: number }Toggle to enable eth_call multicall aggregation.
client.cacheTimenumberTime (in ms) that cached data will remain in memory.
client.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call.html - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
client.chainundefined | ChainChain for the client.
client.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter.html - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
client.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
client.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in string | number | symbol]: Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>[K] }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter.html - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
client.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter.html - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
client.estimateContractGas<TChain, TAbi, TFunctionName>(args: EstimateContractGasParameters<TAbi, TFunctionName, TChain, undefined | Account>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas.html Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
client.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
client.estimateGas(args: EstimateGasParameters<undefined | Chain, undefined | Account>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas.html - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
client.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas.html Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
client.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in string | number | symbol]: client[K] } & PublicActions<Transport, undefined | Chain>>-
client.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance.html - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
client.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<GetBlockReturnType<undefined | Chain, TIncludeTransactions, TBlockTag>>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
client.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
client.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
client.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode.html - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
client.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId.html - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
client.getContractEvents<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetContractEventsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetContractEventsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents.html - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
client.getEnsAddress(args: { blockNumber?: bigint ; blockTag?: BlockTag ; coinType?: number ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wagmi-dev.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
client.getEnsAvatar(args: { blockNumber?: bigint ; blockTag?: BlockTag ; gatewayUrls?: AssetGatewayUrls ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wagmi-dev.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
client.getEnsName(args: { address: `0x${string}` ; blockNumber?: bigint ; blockTag?: BlockTag ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wagmi-dev.eth'
client.getEnsResolver(args: { blockNumber?: bigint ; blockTag?: BlockTag ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wagmi-dev.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
client.getEnsText(args: { blockNumber?: bigint ; blockTag?: BlockTag ; key: string ; name: string ; universalResolverAddress?: `0x${string}` }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wagmi-dev.eth'), key: 'com.twitter', }) // 'wagmi_sh'
client.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
client.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
client.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
client.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice.html - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
client.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
client.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt.html - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
client.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<GetTransactionReturnType<undefined | Chain, TBlockTag>>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.keystringA key for the client.
client.multicall<TContracts, TAllowFailure>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall.html Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
client.namestringA name for the client.
client.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
client.prepareTransactionRequest<TChainOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride>) => Promise<PrepareTransactionRequestReturnType>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest.html Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
client.readContract<TAbi, TFunctionName>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
client.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
client.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction.html - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
client.simulateContract<TAbi, TFunctionName, TChainOverride>(args: SimulateContractParameters<TAbi, TFunctionName, undefined | Chain, TChainOverride>) => Promise<SimulateContractReturnType<TAbi, TFunctionName, undefined | Chain, TChainOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
client.typestringThe type of client.
client.uidstringA unique ID for the client.
client.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
client.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
client.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
client.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
client.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks.html - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
client.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent.html Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
client.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent.html - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
client.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })
contractAddress`0x${string}`-
address`0x${string}`-
vaultAmountnumber-

Returns

Promise<({ error: Error ; result?: undefined ; status: "failure" } | { error?: undefined ; result: readonly [bigint, bigint, bigint] ; status: "success" })[]>

Defined in

src/reads/getStakingVault.ts:13


getVotingPower

getVotingPower(address): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "vaultCount" = 'vaultCount'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
address`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "vaultCount" = 'vaultCount'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getSDysonInfo.ts:25


pairAddressesContract

pairAddressesContract(factoryAddress, pairIndex): Object

Parameters

NameType
factoryAddress`0x${string}`
pairIndexnumber

Returns

Object

NameType
abireadonly [{ inputs: readonly [{ internalType: "address" = 'address'; name: "_controller" = '_controller'; type: "address" = 'address' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "constructor" = 'constructor' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "token0" = 'token0'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "token1" = 'token1'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "id" = 'id'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "address" = 'address'; name: "pair" = 'pair'; type: "address" = 'address' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "PairCreated" = 'PairCreated'; type: "event" = 'event' }, { inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "allPairs" = 'allPairs'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "allPairsLength" = 'allPairsLength'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "becomeController" = 'becomeController'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "controller" = 'controller'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "tokenA" = 'tokenA'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "tokenB" = 'tokenB'; type: "address" = 'address' }] ; name: "createPair" = 'createPair'; outputs: readonly [{ internalType: "address" = 'address'; name: "pair" = 'pair'; type: "address" = 'address' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "getInitCodeHash" = 'getInitCodeHash'; outputs: readonly [{ internalType: "bytes32" = 'bytes32'; name: "" = ''; type: "bytes32" = 'bytes32' }] ; stateMutability: "pure" = 'pure'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "getPair" = 'getPair'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "getPairCount" = 'getPairCount'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "open2public" = 'open2public'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "pendingController" = 'pendingController'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "permissionless" = 'permissionless'; outputs: readonly [{ internalType: "bool" = 'bool'; name: "" = ''; type: "bool" = 'bool' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "_controller" = '_controller'; type: "address" = 'address' }] ; name: "setController" = 'setController'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }]
address`0x${string}`
argsnumber[]
functionNamestring

Defined in

src/reads/getPairsConfig.ts:25


pairTokenAddressesContract

pairTokenAddressesContract(pairAddress, tokenIndex): Object

Parameters

NameType
pairAddress`0x${string}`
tokenIndexnumber

Returns

Object

NameType
abireadonly [{ inputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "constructor" = 'constructor' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "owner" = 'owner'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "operator" = 'operator'; type: "address" = 'address' }, { indexed: false = false; internalType: "bool" = 'bool'; name: "approved" = 'approved'; type: "bool" = 'bool' }] ; name: "ApprovalForAll" = 'ApprovalForAll'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "bool" = 'bool'; name: "isToken0" = 'isToken0'; type: "bool" = 'bool' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "index" = 'index'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountIn" = 'amountIn'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "token0Amt" = 'token0Amt'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "token1Amt" = 'token1Amt'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "due" = 'due'; type: "uint256" = 'uint256' }] ; name: "Deposit" = 'Deposit'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: false = false; internalType: "uint256" = 'uint256'; name: "token0Amt" = 'token0Amt'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "token1Amt" = 'token1Amt'; type: "uint256" = 'uint256' }] ; name: "FeeCollected" = 'FeeCollected'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "sender" = 'sender'; type: "address" = 'address' }, { indexed: true = true; internalType: "bool" = 'bool'; name: "isSwap0" = 'isSwap0'; type: "bool" = 'bool' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountIn" = 'amountIn'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }, { indexed: true = true; internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }] ; name: "Swap" = 'Swap'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "bool" = 'bool'; name: "isToken0" = 'isToken0'; type: "bool" = 'bool' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "index" = 'index'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amountOut" = 'amountOut'; type: "uint256" = 'uint256' }] ; name: "Withdraw" = 'Withdraw'; type: "event" = 'event' }, { inputs: readonly [] = []; name: "APPROVE_TYPEHASH" = 'APPROVE_TYPEHASH'; outputs: readonly [{ internalType: "bytes32" = 'bytes32'; name: "" = ''; type: "bytes32" = 'bytes32' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "DOMAIN_SEPARATOR" = 'DOMAIN_SEPARATOR'; outputs: readonly [{ internalType: "bytes32" = 'bytes32'; name: "" = ''; type: "bytes32" = 'bytes32' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "basis" = 'basis'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "uint64" = 'uint64'; name: "_oldFeeRatio" = '_oldFeeRatio'; type: "uint64" = 'uint64' }, { internalType: "uint256" = 'uint256'; name: "_elapsedTime" = '_elapsedTime'; type: "uint256" = 'uint256' }] ; name: "calcNewFeeRatio" = 'calcNewFeeRatio'; outputs: readonly [{ internalType: "uint64" = 'uint64'; name: "_newFeeRatio" = '_newFeeRatio'; type: "uint64" = 'uint64' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "collectFee" = 'collectFee'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "input" = 'input'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "minOutput" = 'minOutput'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "time" = 'time'; type: "uint256" = 'uint256' }] ; name: "deposit0" = 'deposit0'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "output" = 'output'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "input" = 'input'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "minOutput" = 'minOutput'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "time" = 'time'; type: "uint256" = 'uint256' }] ; name: "deposit1" = 'deposit1'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "output" = 'output'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "factory" = 'factory'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "farm" = 'farm'; outputs: readonly [{ internalType: "contract IFarm" = 'contract IFarm'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "feeTo" = 'feeTo'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "getFeeRatio" = 'getFeeRatio'; outputs: readonly [{ internalType: "uint64" = 'uint64'; name: "_feeRatio0" = '_feeRatio0'; type: "uint64" = 'uint64' }, { internalType: "uint64" = 'uint64'; name: "_feeRatio1" = '_feeRatio1'; type: "uint64" = 'uint64' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "time" = 'time'; type: "uint256" = 'uint256' }] ; name: "getPremium" = 'getPremium'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "premium" = 'premium'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "getReserves" = 'getReserves'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "reserve0" = 'reserve0'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "reserve1" = 'reserve1'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "halfLife" = 'halfLife'; outputs: readonly [{ internalType: "uint64" = 'uint64'; name: "" = ''; type: "uint64" = 'uint64' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "_token0" = '_token0'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "_token1" = '_token1'; type: "address" = 'address' }] ; name: "initialize" = 'initialize'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "nonces" = 'nonces'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "noteCount" = 'noteCount'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "notes" = 'notes'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "token0Amt" = 'token0Amt'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "token1Amt" = 'token1Amt'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "due" = 'due'; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "operatorApprovals" = 'operatorApprovals'; outputs: readonly [{ internalType: "bool" = 'bool'; name: "" = ''; type: "bool" = 'bool' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "tokenAddress" = 'tokenAddress'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "rescueERC20" = 'rescueERC20'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "operator" = 'operator'; type: "address" = 'address' }, { internalType: "bool" = 'bool'; name: "approved" = 'approved'; type: "bool" = 'bool' }] ; name: "setApprovalForAll" = 'setApprovalForAll'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "owner" = 'owner'; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "operator" = 'operator'; type: "address" = 'address' }, { internalType: "bool" = 'bool'; name: "approved" = 'approved'; type: "bool" = 'bool' }, { internalType: "uint256" = 'uint256'; name: "deadline" = 'deadline'; type: "uint256" = 'uint256' }, { internalType: "bytes" = 'bytes'; name: "sig" = 'sig'; type: "bytes" = 'bytes' }] ; name: "setApprovalForAllWithSig" = 'setApprovalForAllWithSig'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "_basis" = '_basis'; type: "uint256" = 'uint256' }] ; name: "setBasis" = 'setBasis'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "_farm" = '_farm'; type: "address" = 'address' }] ; name: "setFarm" = 'setFarm'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "_feeTo" = '_feeTo'; type: "address" = 'address' }] ; name: "setFeeTo" = 'setFeeTo'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "uint64" = 'uint64'; name: "_halfLife" = '_halfLife'; type: "uint64" = 'uint64' }] ; name: "setHalfLife" = 'setHalfLife'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "input" = 'input'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "minOutput" = 'minOutput'; type: "uint256" = 'uint256' }] ; name: "swap0in" = 'swap0in'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "output" = 'output'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "input" = 'input'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "minOutput" = 'minOutput'; type: "uint256" = 'uint256' }] ; name: "swap1in" = 'swap1in'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "output" = 'output'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "token0" = 'token0'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "token1" = 'token1'; outputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "uint256" = 'uint256'; name: "index" = 'index'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }] ; name: "withdraw" = 'withdraw'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "token0Amt" = 'token0Amt'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "token1Amt" = 'token1Amt'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "from" = 'from'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "index" = 'index'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "to" = 'to'; type: "address" = 'address' }] ; name: "withdrawFrom" = 'withdrawFrom'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "token0Amt" = 'token0Amt'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "token1Amt" = 'token1Amt'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }]
address`0x${string}`
functionNamestring

Defined in

src/reads/getPairsConfig.ts:34


prepareGaugeBalance

prepareGaugeBalance(account): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "account" = 'account'; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
account`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "account" = 'account'; type: "address" = 'address' }] ; name: "balanceOf" = 'balanceOf'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getGaugeInfo.ts:14


prepareGaugeInfos

prepareGaugeInfos(pairAddress): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "pools" = 'pools'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastUpdateTime" = 'lastUpdateTime'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastReserve" = 'lastReserve'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
pairAddress`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "pools" = 'pools'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "weight" = 'weight'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "rewardRate" = 'rewardRate'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastUpdateTime" = 'lastUpdateTime'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "lastReserve" = 'lastReserve'; type: "uint256" = 'uint256' }, { internalType: "address" = 'address'; name: "gauge" = 'gauge'; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getGaugeInfo.ts:7


preparePairLengths

preparePairLengths(): PrepareFunctionParamsReturnType<{ inputs: readonly [] = []; name: "allPairsLength" = 'allPairsLength'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [] = []; name: "allPairsLength" = 'allPairsLength'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getPairsConfig.ts:19


prepareReferralCodeUsed

prepareReferralCodeUsed(oneTimeCode): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "oneTimeCodes" = 'oneTimeCodes'; outputs: readonly [{ internalType: "bool" = 'bool'; name: "" = ''; type: "bool" = 'bool' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
oneTimeCode`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }] ; name: "oneTimeCodes" = 'oneTimeCodes'; outputs: readonly [{ internalType: "bool" = 'bool'; name: "" = ''; type: "bool" = 'bool' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getReferralCodeUsed.ts:22


prepareTokenAllowance

prepareTokenAllowance(owner, spender): PrepareFunctionParamsReturnType<{ inputs: readonly [{ name: "owner" ; type: "address" }, { name: "spender" ; type: "address" }] ; name: "allowance" ; outputs: readonly [{ type: "uint256" }] ; stateMutability: "view" ; type: "function" }>

Parameters

NameType
owner`0x${string}`
spender`0x${string}`

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ name: "owner" ; type: "address" }, { name: "spender" ; type: "address" }] ; name: "allowance" ; outputs: readonly [{ type: "uint256" }] ; stateMutability: "view" ; type: "function" }>

Defined in

src/reads/getTokenAllowance.ts:27


prepareTokenRewardOfWeek

prepareTokenRewardOfWeek(token, week): PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "tokenRewardOfWeek" = 'tokenRewardOfWeek'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Parameters

NameType
token`0x${string}`
weekbigint

Returns

PrepareFunctionParamsReturnType<{ inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "tokenRewardOfWeek" = 'tokenRewardOfWeek'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }>

Defined in

src/reads/getBribes.ts:6


tokenBalanceContract

tokenBalanceContract(tokenAddress, account): Object

Parameters

NameType
tokenAddress`0x${string}`
account`0x${string}`

Returns

Object

NameType
abireadonly [{ inputs: readonly [{ name: "account" ; type: "address" }] ; name: "balanceOf" ; outputs: readonly [{ type: "uint256" }] ; stateMutability: "view" ; type: "function" }]
address`0x${string}`
args`0x${string}`[]
functionNamestring

Defined in

src/reads/getDysonPairInfos.ts:41


tokenRewardOfWeekContract

tokenRewardOfWeekContract(bribeAddress, token, week): Object

Parameters

NameType
bribeAddress`0x${string}`
token`0x${string}`
weekbigint

Returns

Object

NameType
abireadonly [{ inputs: readonly [{ internalType: "address" = 'address'; name: "_gauge" = '_gauge'; type: "address" = 'address' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "constructor" = 'constructor' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "from" = 'from'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { indexed: true = true; internalType: "uint256" = 'uint256'; name: "week" = 'week'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "AddReward" = 'AddReward'; type: "event" = 'event' }, { anonymous: false = false; inputs: readonly [{ indexed: true = true; internalType: "address" = 'address'; name: "user" = 'user'; type: "address" = 'address' }, { indexed: true = true; internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { indexed: true = true; internalType: "uint256" = 'uint256'; name: "week" = 'week'; type: "uint256" = 'uint256' }, { indexed: false = false; internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "ClaimReward" = 'ClaimReward'; type: "event" = 'event' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "week" = 'week'; type: "uint256" = 'uint256' }, { internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; name: "addReward" = 'addReward'; outputs: readonly [] = []; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "week" = 'week'; type: "uint256" = 'uint256' }] ; name: "claimReward" = 'claimReward'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "token" = 'token'; type: "address" = 'address' }, { internalType: "uint256[]" = 'uint256[]'; name: "week" = 'week'; type: "uint256[]" = 'uint256[]' }] ; name: "claimRewards" = 'claimRewards'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "amount" = 'amount'; type: "uint256" = 'uint256' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address[]" = 'address[]'; name: "token" = 'token'; type: "address[]" = 'address[]' }, { internalType: "uint256[][]" = 'uint256[][]'; name: "week" = 'week'; type: "uint256[][]" = 'uint256[][]' }] ; name: "claimRewardsMultipleTokens" = 'claimRewardsMultipleTokens'; outputs: readonly [{ internalType: "uint256[]" = 'uint256[]'; name: "amount" = 'amount'; type: "uint256[]" = 'uint256[]' }] ; stateMutability: "nonpayable" = 'nonpayable'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "claimed" = 'claimed'; outputs: readonly [{ internalType: "bool" = 'bool'; name: "" = ''; type: "bool" = 'bool' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [] = []; name: "gauge" = 'gauge'; outputs: readonly [{ internalType: "contract IGauge" = 'contract IGauge'; name: "" = ''; type: "address" = 'address' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }, { inputs: readonly [{ internalType: "address" = 'address'; name: "" = ''; type: "address" = 'address' }, { internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; name: "tokenRewardOfWeek" = 'tokenRewardOfWeek'; outputs: readonly [{ internalType: "uint256" = 'uint256'; name: "" = ''; type: "uint256" = 'uint256' }] ; stateMutability: "view" = 'view'; type: "function" = 'function' }]
address`0x${string}`
args[`0x${string}`, bigint]
functionName"tokenRewardOfWeek"

Defined in

src/reads/getBribes.ts:13