enum<string>
required
Enum options:
ACTIVITY_TYPE_EXECUTE_SWAP_V2string
required
Timestamp (in milliseconds) of the request, used to verify liveness of user requests.
string
required
Unique identifier for a given Organization.
object
required
The parameters object containing the specific intent data for this activity.
Show details
Show details
boolean
Enable to have your activity generate and return App Proofs, enabling verifiability.
object
required
The activity object containing type, intent, and result
Show activity details
Show activity details
curl --request POST \
--url https://api.turnkey.com/public/v1/submit/execute_swap \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header "X-Stamp: <string> (see Authorizations)" \
--data '{
"type": "ACTIVITY_TYPE_EXECUTE_SWAP_V2",
"timestampMs": "<string> (e.g. 1746736509954)",
"organizationId": "<string> (Your Organization ID)",
"parameters": {
"quoteId": "<string>",
"inputToken": "<string>",
"inputAmount": "<string>",
"outputToken": "<string>",
"quotedOutputAmount": "<string>",
"minOutputAmount": "<string>",
"sponsor": "<boolean>",
"evmNonce": "<string>",
"recentBlockhash": "<string>",
"gasStationNonce": "<string>"
}
}'
import { Turnkey } from "@turnkey/sdk-server";
const turnkeyClient = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
apiPublicKey: process.env.API_PUBLIC_KEY!,
apiPrivateKey: process.env.API_PRIVATE_KEY!,
defaultOrganizationId: process.env.ORGANIZATION_ID!,
});
const response = await turnkeyClient.apiClient().executeSwap({
quoteId: "<string> (Quote identifier returned by create_swap_quote. Execution is bound to this quote; the signer is derived from the quote and must not be resupplied.)",
inputToken: "<string> (CAIP-19 asset ID for the input asset.)",
inputAmount: "<string> (Exact base-unit amount of the input asset committed by the quote.)",
outputToken: "<string> (CAIP-19 asset ID for the output asset.)",
quotedOutputAmount: "<string> (Exact quoted base-unit output amount committed by the quote.)",
minOutputAmount: "<string> (Exact minimum base-unit output committed by the quote.)",
sponsor: true // Whether the quoted transaction is sponsored.,
evmNonce: "<string> (Exact EVM sender (EOA account) nonce. Valid only for a non-sponsored EVM swap. Honored for already-delegated (Type-2) batch swaps and single-call swaps; ignored for not-yet-delegated EIP-7702 (Type-4) batches where the outer nonce is derived from the authorization. Prefer gas_station_nonce for batch replay protection and use the nonces endpoint to fetch it. Omit to auto-fetch.)",
recentBlockhash: "<string> (Exact Solana recent blockhash. Valid only for a Solana swap, including sponsored swaps. Omit to auto-fetch.)",
gasStationNonce: "<string> (Exact gas station delegate contract nonce used in the BatchExecution EIP-712 message. Valid for sponsored EVM swaps and non-sponsored EVM swaps that execute as a multi-call batch (for example ERC-20 approve + swap). This is the replay-protection nonce for gas-station batches; use the nonces endpoint to fetch it. Omit to auto-fetch.)"
});
{
"activity": {
"id": "<activity-id>",
"status": "ACTIVITY_STATUS_COMPLETED",
"type": "ACTIVITY_TYPE_EXECUTE_SWAP_V2",
"organizationId": "<organization-id>",
"timestampMs": "<timestamp> (e.g. 1746736509954)",
"result": {
"activity": {
"id": "<string>",
"organizationId": "<string>",
"status": "<string>",
"type": "<string>",
"intent": {
"executeSwapIntentV2": {
"quoteId": "<string>",
"inputToken": "<string>",
"inputAmount": "<string>",
"outputToken": "<string>",
"quotedOutputAmount": "<string>",
"minOutputAmount": "<string>",
"sponsor": "<boolean>",
"evmNonce": "<string>",
"recentBlockhash": "<string>",
"gasStationNonce": "<string>"
}
},
"result": {
"executeSwapResult": {
"swapRequestId": "<string>",
"provider": "<string>",
"quoteId": "<string>"
}
},
"votes": "<array>",
"fingerprint": "<string>",
"canApprove": "<boolean>",
"canReject": "<boolean>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}
}
}