Prepare Delegated Swap
Prepares a delegated swap and returns Permit2 authorization data for the payer to sign. The payer must differ from the executor.
Input ERC-20 address. For USDC use its ERC-20 interface, 0x3600000000000000000000000000000000000000; native-token sentinels are unsupported.
^0x[0-9a-fA-F]{40}$Output ERC-20 address; must differ from from.
^0x[0-9a-fA-F]{40}$Positive base-unit integer string, at most 340282366920938463463374607431768211455 (u128).
1000000Pattern: ^[0-9]+$Final transaction sender. HTTP also accepts sender as an alias; send one name only. Must be non-zero and different from the Execution Router.
^0x[0-9a-fA-F]{40}$Input token owner; must differ from executor.
^0x[0-9a-fA-F]{40}$Explicit output receiver; no default in delegated execution.
^0x[0-9a-fA-F]{40}$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.
trueClient version identifier; send 1001500, matching route-preview requests.
1001500Route depth, subject to deployment limits. Omitted or zero uses server configuration.
3Requested split count, adjusted by server limits and trade size. Does not equal final execution-step count.
20Comma-separated provider IDs from /router/status. Omit for server selection; availability varies by network.
UNISWAPV3,UNISWAPV4Basis 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.
50Validity 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.
120Output-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.
0Required for a positive custom fee; non-zero and different from recipient and the Execution Router.
^0x[0-9a-fA-F]{40}$Advanced gas-unit override. Omit for the server's buffered execution estimate; this is not a gas price or a transaction simulation.
Advanced route-search bound. Omit to use server configuration.
Arc supports ERC-20 input only. Omit or send false; true is rejected.
falsePossible values: Arc supports ERC-20 output only. Omit or send false; true is rejected.
falsePossible values: Prepared quote and payer authorization.
Request parsing failed: malformed/missing query parameters or invalid JSON syntax. The body may be plain text; this is HTTP 400, not application code 400.
Rate limit exceeded. Retry with backoff and honor Retry-After when present.
Internal server error.
Service rate limit exceeded. Retry with backoff.
# 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?