Skip to main content

contracts/handlers/erc20-permit-handler

Classes

ERC20PermitHandler

Handler for performing operations for and with ERC20Permit tokens.

Constructors

new ERC20PermitHandler()

new ERC20PermitHandler(chain, walletClient, publicClient): ERC20PermitHandler

Create the handler for processing tokens.

Parameters
ParameterTypeDescription
chainChainChain to use for the client.
walletClientobjectThe wallet client to use for wallet interactions.
publicClientobjectThe public client to use for public interactions.
Returns

ERC20PermitHandler

Source

lib/contracts/handlers/erc20-permit-handler.ts:36

Properties

PropertyModifierTypeDescription
chainprivateChainChain to use for the client.
publicClientprivateobjectThe public client to use for public interactions.
tokenprivateAnyToken-
viemChainprivateChain-
walletClientprivateobjectThe wallet client to use for wallet interactions.

Methods

approve()

approve(ownerAddress, spenderAddress, value): Promise<`0x${string}`>

Approve transaction for the spender to spend the owner's tokens.

Parameters
ParameterTypeDescription
ownerAddress`0x${string}`Address of the caller of the transaction.
spenderAddress`0x${string}`Address of the spender.
valuebigintValue to approve for the spender.
Returns

Promise<`0x${string}`>

Hash of the transaction.

Source

lib/contracts/handlers/erc20-permit-handler.ts:136

getContract()

getContract(): object

Get the contract. This is a method because the typings are complex and lost when trying to make it a member.

Returns

object

The viem contract.

Source

lib/contracts/handlers/erc20-permit-handler.ts:62

getPermitSalt()

private getPermitSalt(token): undefined | `0x${string}`

Parameters
ParameterType
tokenAnyToken
Returns

undefined | `0x${string}`

Source

lib/contracts/handlers/erc20-permit-handler.ts:151

getPermitSignature()

getPermitSignature(ownerAddress, spenderAddress, value): Promise<object | object>

Process and get permit signature for the given token to perform transactions without calling approve().

Parameters
ParameterTypeDescription
ownerAddress`0x${string}`Address of the token owner.
spenderAddress`0x${string}`Address of the spender who needs the permit.
valuebigintValue of the transaction.
Returns

Promise<object | object>

Permit signature in the form { r, s, v?, yParity }.

Source

lib/contracts/handlers/erc20-permit-handler.ts:83

getPermitVersion()

private getPermitVersion(token): string

Parameters
ParameterType
tokenAnyToken
Returns

string

Source

lib/contracts/handlers/erc20-permit-handler.ts:147

withToken()

withToken(token): ERC20PermitHandler

Set the token to use for executing transactions on the contract.

Parameters
ParameterTypeDescription
tokenAnyTokenToken to use for the handler.
Returns

ERC20PermitHandler

The handler.

Source

lib/contracts/handlers/erc20-permit-handler.ts:51