Skip to main content

Meta Swap

Create a meta-transaction message payload for a voucher swap.

Request URL

https://testnet.api.euclidprotocol.com/api/v1/execute/meta-txn/swap

Example

curl -X 'POST'   'https://testnet.api.euclidprotocol.com/api/v1/execute/meta-txn/swap'   -H 'accept: application/json'   -H 'Content-Type: application/json'   -d '{
  "amount_in": "100000000000000000",
  "asset_in": {
    "token": "stt",
    "token_type": {
      "voucher": {}
    }
  },
  "recipients": [
    {
      "user": {
        "address": "lumen10f4xyp6sq3g47yf6m8dfxh233r878wqjegmtug",
        "chain_uid": "lumen"
      },
      "amount": {
        "dynamic": "0"
      },
      "denom": {
        "voucher": {}
      },
      "forwarding_message": "",
      "unsafe_refund_as_voucher": false
    }
  ],
  "slippage": "5",
  "sender": {
    "address": "lumen10f4xyp6sq3g47yf6m8dfxh233r878wqjegmtug",
    "chain_uid": "lumen"
  },
  "swap_path": {
    "path": [
      {
        "route": ["stt", "euclid"],
        "dex": "euclid",
        "amount_in": "100000000000000000",
        "amount_out": "1206",
        "chain_uid": "vsl"
      }
    ]
  },
  "partner_fee": {
    "partner_fee_bps": 10,
    "recipient": ""
  }
}'
{
  "msg": {
    "target": "euclid1yvgh8xeju5dyr0zxlkvq09htvhjj20fncp5g58np4u25g8rkpgjsy5hngy",
    "call_data": "{"swap":{...}}"
  },
  "type": "swap",
  "token_in": "stt",
  "token_out": "euclid",
  "token": "",
  "amount_in": "100000000000000000",
  "amount_out": "1206"
}

Parameters

FieldTypeDescription
amount_instringAmount of the input token to be swapped.
asset_inTokenWithDenomInput token and its type (native, smart, or voucher).
recipientsCrossChainAddressWithLimit[]A set of recipients to specify where the output should be released.
slippagestringSlippage tolerance in basis points (for example 500 = 5%).
senderCrossChainUserWithAmountAddress and chain initiating the swap.
swap_pathobjectRouting path with token hops and DEX info.
partner_feeobjectOptional partner fee information for swaps.

SwapPath

FieldTypeDescription
pathobject[]Steps for the swap route, each defining token route and dex.

Each path object

FieldTypeDescription
routestring[]Token sequence for the step (for example ['stt','euclid']).
dexstringDEX used for this step.
chain_uidstringChain uid where this step is executed.
amount_instringInput amount for this step.
amount_outstringEstimated output amount for this step.

PartnerFee

FieldTypeDescription
partner_fee_bpsnumberFee in basis points (max 30 = 0.3%).
recipientstringAddress to receive the fee.