Library

1. Intents

1.1. Swap

Swap one asset for another, with optional parameters to customize the behavior of the swap:

  • tokenIn (address): The address of the source token being swapped.

  • tokenOut (address): The address of the token to receive after the swap.

  • amountIn (uint256): The amount of the token in to be swapped.

  • minAmountOut (uint256): The minimum amount of the token out that must be received for the swap to execute successfully. Ensures protection against unfavorable rates.

  • from (address, optional): The address of the account from which the assets are sourced. If not specified, the account signing the config for the task will be used.

  • to (address, optional): The address of the account where the swapped assets will be sent. If not specified, the account signing the config for the task will be used.

  • sourceChain (uint256): The source blockchain ID where the swap begins.

  • destinationChain (uint256, optional): The destination blockchain ID where the swap ends. If not provided, the source chain ID will be used by default.

  • settler (address, optional): The address of the settler responsible for executing the swap. If not provided, Mimic Protocol’s public settler is used by default.

  • deadline (uint256, optional): The deadline until when solvers are allowed to execute your intents. If not provided 5 minutes is used by default.

1.2. Transfer

Transfer assets from one account to another, with optional parameters to customize the behavior:

  • chainId (uint256): The blockchain ID to execute the transfer.

  • token (address): The address of the token to be transferred.

  • amount (uint256): The amount of the token to be transferred.

  • settler (address, optional): The address of the settler responsible for executing the swap. If not provided, Mimic Protocol’s public settler is used by default.

  • from (address, optional): The address of the account from which the assets are sourced. If not specified, the account signing the config for the task will be used.

  • to (address): The address of the account where the swapped assets will be sent.

  • feeToken (address, optional): The token used to pay for the transfer fees. If not specified, the fees will be paid using the token being transferred.

  • feeAmount (uint256): The maximum amount the user is willing to pay for the transfer fees.

  • deadline (uint256, optional): The deadline until when solvers are allowed to execute your intents. If not provided 5 minutes is used by default.

1.3. Call

Creates an intent to execute a specific function on a smart contract, with optional parameters to customize the behavior:

  • chainId (uint256): The blockchain ID to execute the call.

  • target (address): The address of the contract where the function will be executed.

  • data (bytes): The data to be sent in the transaction.

  • value (uint256, optional): The value to be used for the function. If not specified, zero will be used.

  • payer (address, optional): The address of the account paying for the transaction fees. If not specified, the account signing the config for the task will be used.

  • settler (address, optional): The address of the settler responsible for executing the call. If not provided, Mimic Protocol’s public settler is used by default.

  • feeToken (address): The token used to pay for the transaction fees.

  • feeAmount (uint256): The maximum amount the payer is willing to pay for the fees.

  • deadline (uint256, optional): The deadline until when solvers are allowed to execute your intents. If not provided 5 minutes is used by default.


2. Queries

2.1. Token information

Fetch standard token information like name, symbol, and decimals.

2.2. Token price

Fetch a token price in USD for a token

2.3. Relevant tokens

Fetch the list of tokens balances for an account

2.4. Gas median

Fetch past gas median price

2.5. Intents

Fetch previous intents generated by type and status


3. Helpers

3.1. Types

  • Address

  • BigInt

  • Bytes

3.2. Pricing

  • Slippage

  • To token balance

  • Compute min amount out

3.3. Time

  • Time conversion

  • Datetime helpers

Last updated