Description

An intent defines one or more actions that a solver needs to complete, and the conditions that allow the solver to run those actions.

Schema

PropertyRequiredDescription
chainIdYesThe ID of the network where this intent will be executed
replayNoReplay rules for the intent. Expects an object with nonce and runs

nonce: A nonce for the intent. Can be any integer greater than 0. If the nonce is set on chain, the intent will not be executable.

runs: Can be ONCE or UNTIL_CANCELLED. Setting to ONCE means that nonce will be set in the first solver transaction, making the intent un-executable. Setting to UNTIL_CANCELLED means that solvers can run the intent any number of times until nonce is set through a separate transaction.

Excluding the replay parameter or using UNTIL_CANCELLED both allow the intent to be run any number of times. In these cases, execution can be limited by conditions such as interval that limit when the solver can execute the intent.
expiryBlockNoThe block when the intent will expire. Expects an integer value greater than 0. The intent cannot be run in or after the expiry block.
conditionsNoArray of conditions that must be run by a solver when executing a transaction for the intent
actionsYesArray of actions that must be completed by a solver when executing a transaction for the intent

Example

{
  chainId: 1,
  replay: {
    nonce: 555,
    runs: 'ONCE'
  },
  expiryBlock: 21_000_000,
  conditions: [{
    type: 'price',
    operator: 'lt',
    tokenA: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
    tokenB: '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI
    price: 1400.00
  }],
  actions: [{
    type: 'marketSwap',
    tokenIn: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
    tokenOut: '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI
    tokenInAmount: 1_500000000000000000
  }]
}