Swap

Exchange an asset to another.

Arguments

  • Send one paired asset output required

  • to data optional Define the receiver address.

  • to_aa data optional

    Define the address of an AA to send it to after swap (used to do multiple swap in a single request)

  • amount_out_in data optional

    Define an amount minimum to receive from the swap, if the amount to receive is lower than the amount set the unit will be bounced.

  • deadline data optional

    Define a timestamp, the request will be bounced if deadline expired.

Example

{
  trigger: {
    outputs: {
      base: 10000,
      'WhsD5Y/1NeKROgQojGwfe9EBC7NH4KnAk4CorCrVRhs=': 200000
    }
  }
}

Returns

{
  responseVars: {
    type: 'swap',
    asset0_amount: 42000
  }
}

Last updated