Generate a counterfactual deposit address

Returns a counterfactual deposit address that the user can send funds to in order to initiate a crosschain transfer. This address is deterministically computed based on the swap parameters. The user sends the input token to this address on the origin chain, and Across handles the crosschain transfer to the recipient on the destination chain. The response includes the deposit address, token details, and an optional swap transaction that must be executed before sending funds (e.g. for token approvals or wrapping).

GET
/swap/counterfactual

Authorization

bearerAuth
AuthorizationBearer <token>

API key for authentication. Request your key at https://t.me/acrosstg.

In: header

Query Parameters

useDepositAddress*boolean

Must be set to true to use the deposit address flow.

Value intrue
inputToken*string

Contract address of the token to send on the origin chain.

outputToken*string

Contract address of the token to receive on the destination chain.

originChainId*integer

Chain ID of the origin chain where funds are sent.

Range1 <= value
Value in1 | 10 | 137 | 324 | 8453 | 42161 | 59144 | 84532 | 421614 | 11155420 | 11155111
destinationChainId*integer

Chain ID of the destination chain where funds are received.

Range1 <= value
Value in1 | 10 | 137 | 324 | 8453 | 42161 | 59144 | 84532 | 421614 | 11155420 | 11155111
amount*string

Amount of input token to send, in the token's smallest unit (wei).

recipient*string

Address that will receive the output token on the destination chain.

refundAddress*string

Address to receive a refund on the origin chain if the deposit expires.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://app.across.to/api/swap/counterfactual?useDepositAddress=true&inputToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&outputToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&originChainId=1&destinationChainId=8453&amount=1000000&recipient=0x3cA3451C40ECFb5Ecd05AEf33AD60BA8F03c238B&refundAddress=0x3cA3451C40ECFb5Ecd05AEf33AD60BA8F03c238B"
{
  "crossSwapType": "bridgeableToBridgeable",
  "amountType": "exactInput",
  "checks": {
    "allowance": {
      "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "spender": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "actual": "0",
      "expected": "1000000"
    },
    "balance": {
      "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "actual": "0",
      "expected": "1000000"
    }
  },
  "steps": {
    "bridge": {
      "inputAmount": "1000000",
      "outputAmount": "996965",
      "tokenIn": {
        "decimals": 6,
        "symbol": "USDC",
        "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "name": "USD Coin",
        "chainId": 1
      },
      "tokenOut": {
        "decimals": 6,
        "symbol": "USDC",
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "name": "USD Coin",
        "chainId": 8453
      },
      "fees": {
        "amount": "3035",
        "pct": "3035000000000000",
        "token": {
          "decimals": 6,
          "symbol": "USDC",
          "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
          "name": "USD Coin",
          "chainId": 1
        },
        "details": {
          "type": "across",
          "relayerCapital": {
            "amount": "100",
            "pct": "100000000000000",
            "token": {
              "decimals": 6,
              "symbol": "USDC",
              "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
              "name": "USD Coin",
              "chainId": 1
            }
          },
          "destinationGas": {
            "amount": "2935",
            "pct": "2935000000000000",
            "token": {
              "decimals": 6,
              "symbol": "USDC",
              "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
              "name": "USD Coin",
              "chainId": 1
            }
          },
          "lp": {
            "amount": "0",
            "pct": "0",
            "token": {
              "decimals": 6,
              "symbol": "USDC",
              "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
              "name": "USD Coin",
              "chainId": 1
            }
          }
        }
      },
      "provider": "across"
    }
  },
  "inputToken": {
    "decimals": 6,
    "symbol": "USDC",
    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "name": "USD Coin",
    "chainId": 1
  },
  "outputToken": {
    "decimals": 6,
    "symbol": "USDC",
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "name": "USD Coin",
    "chainId": 8453
  },
  "refundToken": {
    "decimals": 6,
    "symbol": "USDC",
    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "name": "USD Coin",
    "chainId": 1
  },
  "fees": {
    "total": {
      "amount": "3000",
      "amountUsd": "0.003",
      "token": {
        "decimals": 6,
        "symbol": "USDC",
        "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "name": "USD Coin",
        "chainId": 1
      },
      "pct": "3000294028814824",
      "details": {
        "type": "total-breakdown",
        "swapImpact": {
          "amount": "-34",
          "amountUsd": "-0.00003470257",
          "token": {
            "decimals": 6,
            "symbol": "USDC",
            "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
            "name": "USD Coin",
            "chainId": 1
          },
          "pct": "-34705971185176"
        },
        "app": {
          "amount": "0",
          "amountUsd": "0.0",
          "token": {
            "decimals": 6,
            "symbol": "USDC",
            "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
            "name": "USD Coin",
            "chainId": 8453
          },
          "pct": "0"
        },
        "bridge": {
          "amount": "3035",
          "amountUsd": "0.00303470257",
          "token": {
            "decimals": 6,
            "symbol": "USDC",
            "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
            "name": "USD Coin",
            "chainId": 1
          },
          "pct": "3035000000000000",
          "details": {
            "type": "across",
            "lp": {
              "amount": "0",
              "amountUsd": "0.0",
              "token": {
                "decimals": 6,
                "symbol": "USDC",
                "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
                "name": "USD Coin",
                "chainId": 1
              },
              "pct": "0"
            },
            "relayerCapital": {
              "amount": "100",
              "amountUsd": "0.0000999902",
              "token": {
                "decimals": 6,
                "symbol": "USDC",
                "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
                "name": "USD Coin",
                "chainId": 1
              },
              "pct": "100000000000000"
            },
            "destinationGas": {
              "amount": "1361790208070",
              "amountUsd": "0.00293471237",
              "token": {
                "chainId": 8453,
                "address": "0x0000000000000000000000000000000000000000",
                "decimals": 18,
                "symbol": "ETH"
              },
              "pct": "2935000000000000"
            }
          }
        }
      }
    },
    "totalMax": {
      "amount": "3000",
      "amountUsd": "0.003",
      "token": {
        "decimals": 6,
        "symbol": "USDC",
        "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "name": "USD Coin",
        "chainId": 1
      },
      "pct": "3000294028814824",
      "details": {
        "type": "max-total-breakdown",
        "maxSwapImpact": {
          "amount": "-34",
          "amountUsd": "-0.00003470257",
          "token": {
            "decimals": 6,
            "symbol": "USDC",
            "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
            "name": "USD Coin",
            "chainId": 1
          },
          "pct": "-34705971185176"
        },
        "app": {
          "amount": "0",
          "amountUsd": "0.0",
          "token": {
            "decimals": 6,
            "symbol": "USDC",
            "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
            "name": "USD Coin",
            "chainId": 8453
          },
          "pct": "0"
        },
        "bridge": {
          "amount": "3035",
          "amountUsd": "0.00303470257",
          "token": {
            "decimals": 6,
            "symbol": "USDC",
            "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
            "name": "USD Coin",
            "chainId": 1
          },
          "pct": "3035000000000000",
          "details": {
            "type": "across",
            "lp": {
              "amount": "0",
              "amountUsd": "0.0",
              "token": {
                "decimals": 6,
                "symbol": "USDC",
                "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
                "name": "USD Coin",
                "chainId": 1
              },
              "pct": "0"
            },
            "relayerCapital": {
              "amount": "100",
              "amountUsd": "0.0000999902",
              "token": {
                "decimals": 6,
                "symbol": "USDC",
                "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
                "name": "USD Coin",
                "chainId": 1
              },
              "pct": "100000000000000"
            },
            "destinationGas": {
              "amount": "1361790208070",
              "amountUsd": "0.00293471237",
              "token": {
                "chainId": 8453,
                "address": "0x0000000000000000000000000000000000000000",
                "decimals": 18,
                "symbol": "ETH"
              },
              "pct": "2935000000000000"
            }
          }
        }
      }
    },
    "originGas": {
      "amount": "0",
      "amountUsd": "0.0",
      "token": {
        "chainId": 1,
        "address": "0x0000000000000000000000000000000000000000",
        "decimals": 18,
        "symbol": "ETH"
      }
    }
  },
  "inputAmount": "1000000",
  "maxInputAmount": "1000000",
  "expectedOutputAmount": "996965",
  "minOutputAmount": "996965",
  "expectedFillTime": 4,
  "swapTx": {
    "ecosystem": "evm",
    "simulationSuccess": true,
    "chainId": 1,
    "to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "data": "0xa9059cbb000000000000000000000000088274f94ef47386055fe6315e0952c5c098f72a00000000000000000000000000000000000000000000000000000000000f4240",
    "value": "0",
    "gas": "0"
  },
  "quoteExpiryTimestamp": 1774408103,
  "depositAddress": "0x088274f94ef47386055fE6315E0952C5c098F72A",
  "id": "xwv9h-1774404669182-c290c198f61c"
}
{
  "type": "AcrossApiError",
  "code": "INVALID_PARAM",
  "status": 400,
  "message": "Invalid parameter"
}
{
  "type": "AcrossApiError",
  "code": "FORBIDDEN_API_KEY",
  "status": 403,
  "message": "Invalid or missing API key",
  "id": "hxlzg-1774404706014-af527ab9002e"
}
{
  "type": "AcrossApiError",
  "code": "INTERNAL_SERVER_ERROR",
  "status": 500,
  "message": "Internal server error"
}