For the complete documentation index, see llms.txt. This page is also available as Markdown.

Prepare Delegated Swap

Prepare a delegated swap

get

Prepares a delegated swap and returns Permit2 authorization data for the payer to sign. The payer must differ from the executor.

Query parameters
fromstringRequired

Input ERC-20 address. For USDC use its ERC-20 interface, 0x3600000000000000000000000000000000000000; native-token sentinels are unsupported.

Pattern: ^0x[0-9a-fA-F]{40}$
targetstringRequired

Output ERC-20 address; must differ from from.

Pattern: ^0x[0-9a-fA-F]{40}$
amountstringRequired

Positive base-unit integer string, at most 340282366920938463463374607431768211455 (u128).

Example: 1000000Pattern: ^[0-9]+$
executorstringRequired

Final transaction sender. HTTP also accepts sender as an alias; send one name only. Must be non-zero and different from the Execution Router.

Pattern: ^0x[0-9a-fA-F]{40}$
payerstringRequired

Input token owner; must differ from executor.

Pattern: ^0x[0-9a-fA-F]{40}$
recipientstringRequired

Explicit output receiver; no default in delegated execution.

Pattern: ^0x[0-9a-fA-F]{40}$
by_amount_inbooleanOptional

If true, amount is the input; if false, amount is the desired quote output. Execution still uses a fixed input with a minimum output, not an exact-output guarantee. Custom fees require true.

Default: true
vintegerOptional

Client version identifier; send 1001500, matching route-preview requests.

Example: 1001500
depthintegerOptional

Route depth, subject to deployment limits. Omitted or zero uses server configuration.

Example: 3
split_countintegerOptional

Requested split count, adjusted by server limits and trade size. Does not equal final execution-step count.

Example: 20
providersstringOptional

Comma-separated provider IDs from /router/status. Omit for server selection; availability varies by network.

Example: UNISWAPV3,UNISWAPV4
slippage_bpsinteger · max: 9999Optional

Basis points applied to net expect_amount_out after custom fees. Minimum output is floor(expect_amount_out * (10000 - slippage_bps) / 10000). Omitted uses the server default; send explicitly.

Example: 50
deadline_secsinteger · min: 1Optional

Validity in seconds from construction, not an absolute timestamp. Send a positive value; omitted uses the server default. Delegated plans also enforce the server lifetime cap.

Example: 120
custom_fee_bpsinteger · max: 10000Optional

Output-token custom fee in basis points, subject to /router/status arc_router.max_custom_fee_bps and on-chain policy. Positive values require by_amount_in=true and custom_fee_receiver.

Default: 0
custom_fee_receiverstringOptional

Required for a positive custom fee; non-zero and different from recipient and the Execution Router.

Pattern: ^0x[0-9a-fA-F]{40}$
gasintegerOptional

Advanced gas-unit override. Omit for the server's buffered execution estimate; this is not a gas price or a transaction simulation.

cal_path_limitintegerOptional

Advanced route-search bound. Omit to use server configuration.

native_inboolean · enumOptional

Arc supports ERC-20 input only. Omit or send false; true is rejected.

Default: falsePossible values:
native_outboolean · enumOptional

Arc supports ERC-20 output only. Omit or send false; true is rejected.

Default: falsePossible values:
Responses
200

Prepared quote and payer authorization.

application/json
get/router/swap/prepare
cURL
# Payer and executor must differ; use actual addresses for the selected network.
: "${FROM_TOKEN:?Set FROM_TOKEN}" "${TARGET_TOKEN:?Set TARGET_TOKEN}" "${AMOUNT:?Set AMOUNT}"
: "${PAYER:?Set PAYER}" "${EXECUTOR:?Set EXECUTOR}" "${RECIPIENT:?Set RECIPIENT}"
curl --fail-with-body --get 'https://api.peach.ag/arc/router/swap/prepare' \
  --data-urlencode "from=$FROM_TOKEN" \
  --data-urlencode "target=$TARGET_TOKEN" \
  --data-urlencode "amount=$AMOUNT" \
  --data-urlencode "payer=$PAYER" \
  --data-urlencode "executor=$EXECUTOR" \
  --data-urlencode "recipient=$RECIPIENT" \
  --data-urlencode 'by_amount_in=true' \
  --data-urlencode 'v=1001500' \
  --data-urlencode 'slippage_bps=50' \
  --data-urlencode 'deadline_secs=120'
# Validate and sign data.payer_authorization.typed_data as the payer, then build.
{
  "code": 200,
  "msg": "Success",
  "data": {
    "request_id": "0xdfb00c70165540d9a166a4290de2e34858271baa1c094e26802d2f41c83bec79",
    "quote_id": "0xdfb00c70165540d9a166a4290de2e34858271baa1c094e26802d2f41c83bec79",
    "quote_ts": 1788749449103,
    "amount_in": "100000",
    "amount_out": "39567089183407155485803",
    "expect_amount_out": "39567089183407155485803",
    "amount_out_min": "39369253737490119708373",
    "payer": "0x22fba69473baf7773bf43c23c44e8a7fb8ef62fa",
    "executor": "0x036ede62f99ab5061ca89d0cec5acecc641f6474",
    "recipient": "0x036ede62f99ab5061ca89d0cec5acecc641f6474",
    "gas": 780000,
    "execution_mode": "PERMIT2_WITNESS",
    "execution_status": "PAYER_SIGNATURE_REQUIRED",
    "plan_hash": "0x8801e98fb3927833645e28390869cb3af4cfb392701d72a717f5c1847d53a4eb",
    "aggregator_signature": "0xbc08363763a15b1ee9d7f4e3350c109932431399efa15d576b98be1ad4aa9c7041a4463ec07067d8a8de1577bb8614fb6138cf23677cfdc3806e6515b98acd4f1c",
    "aggregator_signer": "0x8a283840b4219a05cebdfc09fe33b58a7f52a562",
    "payer_authorization": {
      "scheme": "PERMIT2_WITNESS_TRANSFER",
      "owner": "0x22fba69473baf7773bf43c23c44e8a7fb8ef62fa",
      "permit2": "0x000000000022d473030f116ddee9f6b43ac78ba3",
      "spender": "0x5ff56925140d6f5912c8ca6593f2c3bc28190607",
      "token": "0x4608e7fc3163f11c241a7cdd1c8a7d46f150e37a",
      "amount": "100000",
      "nonce": "101176816160291530055569836784385008322299674412000064224563717250581735926905",
      "deadline": 1788749569,
      "witness_plan_hash": "0x8801e98fb3927833645e28390869cb3af4cfb392701d72a717f5c1847d53a4eb",
      "typed_data": {
        "domain": {
          "name": "Permit2",
          "chainId": "5042002",
          "verifyingContract": "0x000000000022d473030f116ddee9f6b43ac78ba3"
        },
        "types": {
          "EIP712Domain": [
            {
              "name": "name",
              "type": "string"
            },
            {
              "name": "chainId",
              "type": "uint256"
            },
            {
              "name": "verifyingContract",
              "type": "address"
            }
          ],
          "TokenPermissions": [
            {
              "name": "token",
              "type": "address"
            },
            {
              "name": "amount",
              "type": "uint256"
            }
          ],
          "ArcExecutionWitness": [
            {
              "name": "planHash",
              "type": "bytes32"
            }
          ],
          "PermitWitnessTransferFrom": [
            {
              "name": "permitted",
              "type": "TokenPermissions"
            },
            {
              "name": "spender",
              "type": "address"
            },
            {
              "name": "nonce",
              "type": "uint256"
            },
            {
              "name": "deadline",
              "type": "uint256"
            },
            {
              "name": "witness",
              "type": "ArcExecutionWitness"
            }
          ]
        },
        "primaryType": "PermitWitnessTransferFrom",
        "message": {
          "permitted": {
            "token": "0x4608e7fc3163f11c241a7cdd1c8a7d46f150e37a",
            "amount": "100000"
          },
          "spender": "0x5ff56925140d6f5912c8ca6593f2c3bc28190607",
          "nonce": "101176816160291530055569836784385008322299674412000064224563717250581735926905",
          "deadline": "1788749569",
          "witness": {
            "planHash": "0x8801e98fb3927833645e28390869cb3af4cfb392701d72a717f5c1847d53a4eb"
          }
        }
      }
    }
  }
}

Last updated

Was this helpful?