Create a Swap Quote

POST /swaps/quotes

Creates a new swap quote.

Parameters

Body

Property
Required/Optional
Description
Type

sourceWalletId *

Required

Id of the Dfns wallet spending the sourceAsset

String

targetWalletId *

Required

Id of the Dfns wallet receiving the targetAsset. Currently this value must be the same as the sourceWalletId

String

provider *

Required

The Swap provider, either "UniswapClassic" or "UniswapX"

String

sourceAsset

Required

The source asset that will be spent on the Swap transaction, following the same stucture as the transfer API

Object

targetAsset *

Required

The target asset that will be received with the Swap transaction, follows the same structure as sourceAsset, but doesn't include the amount

Object

slippageToleranceInBps*

Required

The slippage tolerance for this trade. Slippage tolerance defines the maximum price movement you’re willing to accept during a trade, ensuring you still receive at least a minimum number of tokens if the price shifts.

Number

Example

{
    "sourceWalletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
    "targetWalletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
    "provider": "UniswapClassic",
    "sourceAsset": {
        "kind": "Native",
        "amount": "10000000000"
    },
    "targetAsset": {
        "kind": "Erc20",
        "contract": "0xda0be7efd234295395d4204d0df4358339b57b27"
    },
    "slippageToleranceInBps": 100
}

Response

Response example

{
    "id": "swapQuote-3hgv4-q8tbf-8v2ajmrbmg6m4i9t",
    "sourceWalletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
    "targetWalletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
    "provider": "UniswapClassic",
    "sourceAsset": {
        "kind": "Native",
        "amount": "10000000000",
        "metadata": {
            "network": "EthereumSepolia",
            "name": "Ethereum",
            "symbol": "SepoliaETH",
            "decimals": 18,
            "tid": "native:eth"
        }
    },
    "targetAsset": {
        "kind": "Erc20",
        "contract": "0xda0be7efd234295395d4204d0df4358339b57b27",
        "amount": "6467571553831928182",
        "metadata": {
            "network": "EthereumSepolia",
            "name": "Test",
            "symbol": "Test",
            "decimals": 18,
            "tid": "erc20:0xda0be7efd234295395d4204d0df4358339b57b27"
        }
    },
    "slippageToleranceInBps": 100,
    "dateCreated": "2025-09-11T10:52:15.039Z",
    "requestBody": {
        "provider": "UniswapClassic",
        "sourceWalletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
        "targetWalletId": "wa-3l3cj-l8mq7-8q78f9nopq7f1qjv",
        "sourceAsset": {
            "kind": "Native",
            "amount": "10000000000"
        },
        "targetAsset": {
            "kind": "Erc20",
            "contract": "0xda0be7efd234295395d4204d0df4358339b57b27"
        },
        "slippageToleranceInBps": 100
    },
    "requester": {
        "userId": "us-48r5q-eshfg-9pmr2lo6bmpr4i4i",
        "tokenId": "to-4etah-smoal-9n3rmhul4dpaueg5"
    }
}

Last updated