Skip to main content
POST
/
v0
/
quote
Request a swap quote
curl --request POST \
  --url https://1click.chaindefuser.com/v0/quote \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "dry": true,
  "swapType": "EXACT_INPUT",
  "slippageTolerance": 100,
  "originAsset": "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near",
  "depositType": "ORIGIN_CHAIN",
  "destinationAsset": "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near",
  "amount": "1000",
  "refundTo": "0x2527D02599Ba641c19FEa793cD0F167589a0f10D",
  "refundType": "ORIGIN_CHAIN",
  "recipient": "13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK",
  "recipientType": "DESTINATION_CHAIN",
  "deadline": "2019-08-24T14:15:22Z",
  "depositMode": "SIMPLE",
  "connectedWallets": [
    "0x123...",
    "0x456..."
  ],
  "sessionId": "session_abc123",
  "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
  "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
  "customRecipientMsg": "smart-contract-recipient.near",
  "referral": "referral",
  "quoteWaitingTimeMs": 3000,
  "appFees": [
    {
      "recipient": "recipient.near",
      "fee": 100
    }
  ]
}
'
{
  "correlationId": "550e8400-e29b-41d4-a716-446655440000",
  "timestamp": "2019-08-24T14:15:22Z",
  "signature": "<string>",
  "quoteRequest": {
    "dry": true,
    "swapType": "EXACT_INPUT",
    "slippageTolerance": 100,
    "originAsset": "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near",
    "depositType": "ORIGIN_CHAIN",
    "destinationAsset": "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near",
    "amount": "1000",
    "refundTo": "0x2527D02599Ba641c19FEa793cD0F167589a0f10D",
    "refundType": "ORIGIN_CHAIN",
    "recipient": "13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK",
    "recipientType": "DESTINATION_CHAIN",
    "deadline": "2019-08-24T14:15:22Z",
    "depositMode": "SIMPLE",
    "connectedWallets": [
      "0x123...",
      "0x456..."
    ],
    "sessionId": "session_abc123",
    "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
    "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
    "customRecipientMsg": "smart-contract-recipient.near",
    "referral": "referral",
    "quoteWaitingTimeMs": 3000,
    "appFees": [
      {
        "recipient": "recipient.near",
        "fee": 100
      }
    ]
  },
  "quote": {
    "amountIn": "1000000",
    "amountInFormatted": "1",
    "amountInUsd": "1",
    "minAmountIn": "995000",
    "amountOut": "9950000",
    "amountOutFormatted": "9.95",
    "amountOutUsd": "9.95",
    "minAmountOut": "9900000",
    "timeEstimate": 120,
    "depositAddress": "0x76b4c56085ED136a8744D52bE956396624a730E8",
    "depositMemo": "1111111",
    "deadline": "2025-03-04T15:00:00Z",
    "timeWhenInactive": "2025-03-04T15:00:00Z",
    "virtualChainRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
    "virtualChainRefundRecipient": "0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C",
    "customRecipientMsg": "smart-contract-recipient.near"
  }
}

Authorizations

Authorization
string
header
required

Enter JWT token (optional)

Body

application/json
dry
boolean
required

Flag indicating whether this is a dry run request. If true, the response will NOT contain the following fields:

  • depositAddress
  • timeWhenInactive
  • deadline
Example:

true

swapType
enum<string>
required

How to interpret amount (and refunds) when performing the swap:

  • EXACT_INPUT — requests the output amount for an exact input.

    • If deposit is less than amountIn, the deposit is refunded by deadline.
    • If deposit is above than amountIn, the swap is processed and the excess is refunded to refundTo address after swap is complete.
  • EXACT_OUTPUT — requests the input amount for an exact output.

    • The quote response would have two fields minAmountIn and maxAmountIn.
    • If the input is above than maxAmountIn the swap is processed and the excess is refunded to refundTo address after swap is complete.
    • If the input is less than minAmountIn, the deposit is refunded by deadline.
  • FLEX_INPUT — a flexible input amount that allows for partial deposits and variable amounts.

    • slippage applies both to amountOut and amountIn and defines an acceptable range (minAmountIn and minAmountOut).
    • Any amount higher than minAmountIn is accepted and converted to the output asset as long as minAmountOut is met.
    • The amountIn can be less, as long as the 'slippage + 1%' constraint is met. If the total received by the deadline is below the lower bound, the deposit is refunded.
    • If deposits exceed the upper bound, the swap is still processed
Available options:
EXACT_INPUT,
EXACT_OUTPUT,
FLEX_INPUT,
ANY_INPUT
slippageTolerance
number
required

Slippage tolerance for the swap. This value is in basis points (1/100th of a percent), e.g. 100 for 1% slippage.

Example:

100

originAsset
string
required

ID of the origin asset.

Example:

"nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near"

depositType
enum<string>
required

Type of deposit address:

  • ORIGIN_CHAIN - deposit address on the origin chain.
  • INTENTS - the account ID within NEAR Intents to which you should transfer assets.
Available options:
ORIGIN_CHAIN,
INTENTS
destinationAsset
string
required

ID of the destination asset.

Example:

"nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near"

amount
string
required

Amount to swap as the base amount. It is interpreted as the input or output amount based on the swapType flag and is specified in the smallest unit of the currency (e.g., wei for ETH).

Example:

"1000"

refundTo
string
required

Address used for refunds.

Example:

"0x2527D02599Ba641c19FEa793cD0F167589a0f10D"

refundType
enum<string>
required

Type of refund address:

  • ORIGIN_CHAIN - assets are refunded to the refundTo address on the origin chain.
  • INTENTS - assets are refunded to the refundTo Intents account.
Available options:
ORIGIN_CHAIN,
INTENTS
recipient
string
required

Recipient address. The format must match recipientType.

Example:

"13QkxhNMrTPxoCkRdYdJ65tFuwXPhL5gLS2Z5Nr6gjRK"

recipientType
enum<string>
required

Type of recipient address:

  • DESTINATION_CHAIN - assets are transferred to the chain of destinationAsset.
  • INTENTS - assets are transferred to an account inside Intents
Available options:
DESTINATION_CHAIN,
INTENTS
deadline
string<date-time>
required

Timestamp in ISO format that identifies when the user refund begins if the swap isn't completed by then. It must exceed the time required for the deposit transaction to be mined. For example, Bitcoin may require around one hour depending on the fees paid.

Example:

"2019-08-24T14:15:22Z"

depositMode
enum<string>
default:SIMPLE

What deposit address mode you will get in the response, most chain supports only SIMPLE and some(for example stellar) only MEMO:

  • SIMPLE - usual deposit with only deposit address.
  • MEMO - some chains will REQUIRE the memo together with depositAddress for swap to work.
Available options:
SIMPLE,
MEMO
Example:

"SIMPLE"

connectedWallets
string[]

Addresses of connected wallets.

Example:
["0x123...", "0x456..."]
sessionId
string

Unique client session identifier for 1Click.

Example:

"session_abc123"

virtualChainRecipient
string

EVM address of a transfer recipient in a virtual chain

Example:

"0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C"

virtualChainRefundRecipient
string

EVM address of a refund recipient in a virtual chain

Example:

"0xb4c2fbec9d610F9A3a9b843c47b1A8095ceC887C"

customRecipientMsg
string

HIGHLY EXPERIMENTAL Message to pass to ft_transfer_call when withdrawing assets to NEAR.

Otherwise, ft_transfer will be used.

WARNING: Funds will be lost if used with non NEP-141 tokens, in case of insufficient storage_deposit or if the recipient does not implement ft_on_transfer method.

Example:

"smart-contract-recipient.near"

referral
string

Referral identifier (lowercase only). It will be reflected in the on-chain data and displayed on public analytics platforms.

Example:

"referral"

quoteWaitingTimeMs
number
default:3000

Time in milliseconds the user is willing to wait for a quote from the relay. If you want to receive the fastest quote - use 0 as a value

Example:

3000

appFees
object[]

List of recipients and their fees

Response

correlationId
string
required

Unique identifier for request tracing and debugging

Example:

"550e8400-e29b-41d4-a716-446655440000"

timestamp
string<date-time>
required

Timestamp in ISO format that was used to derive the deposit address

Example:

"2019-08-24T14:15:22Z"

signature
string
required

Signature of the 1Click service confirming the quote for the specific deposit address. Must be saved on the client side (along with the whole quote) in order to resolve any disputes or mistakes.

quoteRequest
object
required

User request

quote
object
required

Response containing the deposit address for sending the amount of originAsset and the expected output amount.