Skip to main content
Version: 1.16.0

Class: ApproveToken

Defined in: cct/evm/token/operations/approve-token.ts:51

Grants an ERC-20 allowance — e.g. a rebalancer approving a LockRelease pool before a deposit.

Extends​

Constructors​

Constructor​

new ApproveToken(): ApproveToken

Returns​

ApproveToken

Inherited from​

EVMOperation<ApproveTokenParams>.constructor

Properties​

name​

readonly name: "approveToken" = 'approveToken'

Defined in: cct/evm/token/operations/approve-token.ts:52

camelCase id; matches the token-manager facade method and error context.

Overrides​

EVMOperation.name

Methods​

buildUnsigned()​

protected buildUnsigned(_chain: EVMChain, __namedParameters: ApproveTokenParams): UnsignedEVMTx

Defined in: cct/evm/token/operations/approve-token.ts:67

Encodes approve with no chain access at all — there is no version to resolve and nothing about the caller's balance to check, since an ERC-20 allows approving more than is held.

Parameters​

ParameterType
_chainEVMChain
__namedParametersApproveTokenParams

Returns​

UnsignedEVMTx

Overrides​

EVMOperation.buildUnsigned


execute()​

execute(chain: EVMChain, params: EVMExecuteParams<ApproveTokenParams>): Promise<TransactionResult>

Defined in: cct/evm/operation.ts:150

generate, then sign and submit; returns the confirmed tx hash.

Parameters​

ParameterType
chainEVMChain
paramsEVMExecuteParams<ApproveTokenParams>

Returns​

Promise<TransactionResult>

Inherited from​

EVMOperation.execute


generate()​

generate(chain: EVMChain, params: ApproveTokenParams): Promise<UnsignedEVMTx>

Defined in: cct/evm/operation.ts:110

Run prepare and buildUnsigned, applying optional sender; no signing.

Parameters​

ParameterType
chainEVMChain
paramsApproveTokenParams

Returns​

Promise<UnsignedEVMTx>

Remarks​

Also pins every built transaction to chain.network.chainId (no RPC, known at construction). This is the one point every CCT builder and both execute paths pass through; unpinned, ethers would infer the chain from the eventual signer's provider.

Inherited from​

EVMOperation.generate


prepare()​

protected prepare(params: ApproveTokenParams): ApproveTokenParams

Defined in: cct/evm/token/operations/approve-token.ts:55

Validates both addresses and the amount before any RPC; a zero amount revokes.

Parameters​

ParameterType
paramsApproveTokenParams

Returns​

ApproveTokenParams

Overrides​

EVMOperation.prepare


resolveWalletSender()​

protected resolveWalletSender(wallet: unknown, sender?: string): Promise<string>

Defined in: cct/evm/operation.ts:130

Resolves the address a signed submission is authorized against: the signing wallet's own. The chain gates on msg.sender, and submit clears any builder-set tx.from before populating the tx (so ethers' own from/signer guard never fires) — an explicit sender that differs from the wallet would therefore let an op's pre-tx checks authorize one address while a different one actually signs, passing every local guard and reverting on-chain. Ops that gate on an on-chain role call this from execute; build with generateUnsigned* instead when the eventual signer isn't known yet, where sender is trusted as given.

Parameters​

ParameterType
walletunknown
sender?string

Returns​

Promise<string>

Throws​

CCIPWalletInvalidError if wallet is not a valid signer

Throws​

CCTParamsInvalidError if sender is given and is not the wallet's address

Inherited from​

EVMOperation.resolveWalletSender