earn.bindEngine
Permanently binds an engine to its factory-created EarnVault. This API is experimental.
Usage
import { client } from './viem.config'
const result = await client.earn.bindEngineSync({
engine: '0x0000000000000000000000000000000000000001',
finalOwner: client.account.address,
vault: '0x0000000000000000000000000000000000000002',
})
{ engine: '0x...', vault: '0x...', receipt: { ... } }import { Account, createClient } from 'viem/tempo'
export const client = createClient({
account: Account.fromSecp256k1('0x...'),
})The action initializes the vault. Set finalOwner to transfer engine ownership atomically, or omit
it to retain the current owner. The binding cannot be changed after initialization.
Asynchronous Usage
earn.bindEngineSync waits for inclusion and returns the decoded binding event. Use
earn.bindEngine to return the transaction hash immediately.
import { Actions } from 'viem/tempo'
import { client } from './viem.config'
const engine = '0x0000000000000000000000000000000000000001'
const hash = await client.earn.bindEngine({
engine,
finalOwner: client.account.address,
vault: '0x0000000000000000000000000000000000000002',
})
const receipt = await client.waitForTransactionReceipt({ hash })
const { args } = Actions.earn.bindEngine.extractEvent(receipt.logs, {
engine,
})Return Value
type ReturnValue = {
/** Engine address. */
engine: Address
/** Transaction receipt. */
receipt: TransactionReceipt
/** Bound EarnVault address. */
vault: Address
}The asynchronous action returns the transaction hash instead.
Parameters
engine
- Type:
Address
Engine address.
finalOwner
- Type:
Address | undefined
Address that will own the initialized engine. Omit to retain the current owner.
vault
- Type:
Address
EarnVault created for the engine.
account (optional)
- Type:
Account | Address
Account that will be used to send the transaction.
feeToken (optional)
- Type:
Address | bigint
Fee token for the transaction.
Can be an unpaused USD-denominated TIP-20 token address or ID. Use client.fee.validateToken({ token }) to validate a token before submitting a transaction or setting it as a fee preference.
feePayer (optional)
- Type:
Account | true
Fee payer for the transaction.
Can be a Viem Account, or true if a Fee Payer Service will be used.
gas (optional)
- Type:
bigint
Gas limit for the transaction.
maxFeePerGas (optional)
- Type:
bigint
Max fee per gas for the transaction.
maxPriorityFeePerGas (optional)
- Type:
bigint
Max priority fee per gas for the transaction.
nonce (optional)
- Type:
number
Nonce for the transaction.
nonceKey (optional)
- Type:
'expiring' | bigint
Nonce key for the transaction. Use 'expiring' to use expiring nonces (TIP-1009), which enables concurrent transaction submission without nonce ordering.
validBefore (optional)
- Type:
number
Unix timestamp before which the transaction must be included.
validAfter (optional)
- Type:
number
Unix timestamp after which the transaction can be included.
throwOnReceiptRevert (optional)
- Type:
boolean - Default:
true
Whether to throw an error if the transaction receipt indicates a revert. Only applicable to *Sync actions.