Intents/Swap
Swap Intent Execute
Execute method finalizes and submits a swap intent on-chain using the Okto Gateway. It takes all required transaction parameters and returns a job ID to track execution status.
Dev Tools Available!
For quick testing purposes, we provide development tools like the Okto Auth Token Generator. This tool helps you generate authentication tokens instantly, making it easier to test our APIs.
POST Request
Endpoint
POST https://sandbox-okto-gateway.oktostage.com/rpc
Headers
Name | Type | Description |
---|---|---|
Content-Type | string | Must be application/json |
Authorization | string | Bearer token for authentication |
Request Body
{
"method": "execute",
"jsonrpc": "2.0",
"id": "<request-id>",
"params": [
{
"callData": "string", // Encoded function call data
"callGasLimit": "string", // Gas limit for the call
"maxFeePerGas": "string", // Maximum fee per gas
"maxPriorityFeePerGas": "string", // Maximum priority fee per gas
"nonce": "string", // Transaction nonce
"paymaster": "string", // Paymaster contract address
"paymasterData": "string", // Data for paymaster
"paymasterPostOpGasLimit": "string", // Gas limit for post-operation
"paymasterVerificationGasLimit": "string", // Gas limit for verification
"preVerificationGas": "string", // Gas for pre-verification
"sender": "string", // Sender's address
"verificationGasLimit": "string", // Gas limit for verification
"signature": "string" // Transaction signature
}
]
}
Tip:Request Parameters
ShowcallData
: The encoded function call data for the token transfercallGasLimit
: Gas limit for the actual function callmaxFeePerGas
andmaxPriorityFeePerGas
: Gas fee parametersnonce
: Unique identifier for the transactionpaymaster
: Address of the paymaster contractpaymasterData
: Data required for paymaster operationspaymasterPostOpGasLimit
: Gas limit for post-operation checkspaymasterVerificationGasLimit
: Gas limit for paymaster verificationpreVerificationGas
: Gas required for pre-verification stepssender
: Address of the transaction senderverificationGasLimit
: Gas limit for transaction verificationsignature
: Cryptographic signature of the transaction
Response
{
"jsonrpc": "2.0",
"id": "<request-id>",
"result": {
"jobId": "string" // Unique identifier for the transfer job
}
}
{
"jsonrpc": "2.0",
"id": "<request-id>",
"error": {
"code": "number", // Error code
"message": "string", // Error message
"data": "string" // Additional error details
}
}
Example
curl -X POST https://apigw.oktostage.com/api/oc/v1/execute \
-H "Authorization: Bearer <authToken>" \
-H "Content-Type: application/json" \
-d '{
"callData": "0x8dd7712f0000000000...",
"callGasLimit": "0x5f7cd",
"maxFeePerGas": "0x112a880",
"maxPriorityFeePerGas": "0x112a880",
"nonce": "0x0000000000000000000000000000000076b49e2c7f184aebaa9ca7387f7aef20",
"paymaster": "0xc2d31cdc6efd02f85ab943c4587f8d60e6e15f9c",
"paymasterData": "0x000000000000000000000000c5a3...",
"paymasterPostOpGasLimit": "0x1cf9",
"paymasterVerificationGasLimit": "0x13d6d",
"preVerificationGas": "0x16b7b",
"sender": "0xee5596022f7e4942d9f2ddfff57bdad4ae7160c3",
"verificationGasLimit": "0x28c6b",
"signature": "0x2c50427c1bc7f3b794aa37355ac59ba9f35ce5345cec28852f604ec55ae9a2355f78c7d721a1e4ea4cc420e1d21374f3dced08088f6225e06b9eb299bf231c8b1c"
}'
const fetch = require('node-fetch'); // if using Node.js
const url = 'https://apigw.oktostage.com/api/oc/v1/execute';
const authToken = '<authToken>'; // Replace with your actual token
const payload = {
callData: '0x8dd7712f...0000000000',
callGasLimit: '0x5f7cd',
maxFeePerGas: '0x112a880',
maxPriorityFeePerGas: '0x112a880',
nonce: '0x0000000000000000000000000000000076b49e2c7f184aebaa9ca7387f7aef20',
paymaster: '0xc2d31cdc6efd02f85ab943c4587f8d60e6e15f9c',
paymasterData: '0x0000000000...00000000000',
paymasterPostOpGasLimit: '0x1cf9',
paymasterVerificationGasLimit: '0x13d6d',
preVerificationGas: '0x16b7b',
sender: '0xee5596022f7e4942d9f2ddfff57bdad4ae7160c3',
verificationGasLimit: '0x28c6b',
signature: '0x2c50427c1bc7f3b794aa37355ac59ba9f35ce5345cec28852f604ec55ae9a2355f78c7d721a1e4ea4cc420e1d21374f3dced08088f6225e06b9eb299bf231c8b1c'
};
fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${authToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
})
.then(res => res.json())
.then(data => console.log('Response:', data))
.catch(err => console.error('Error:', err));
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://sandbox-api.okto.tech/api/oc/v1/execute"
method := "POST"
payload := []byte(`{
"callData": "0x8dd7712f0000000000000000...",
"callGasLimit": "0x5f7cd",
"maxFeePerGas": "0x112a880",
"maxPriorityFeePerGas": "0x112a880",
"nonce": "0x0000000000000000000000000000000076b49e2c7f184aebaa9ca7387f7aef20",
"paymaster": "0xc2d31cdc6efd02f85ab943c4587f8d60e6e15f9c",
"paymasterData": "0x000000000000000000000000c5a378bb6...",
"paymasterPostOpGasLimit": "0x1cf9",
"paymasterVerificationGasLimit": "0x13d6d",
"preVerificationGas": "0x16b7b",
"sender": "0xee5596022f7e4942d9f2ddfff57bdad4ae7160c3",
"verificationGasLimit": "0x28c6b",
"signature": "0x2c50427c1bc7f3b794aa37355ac59ba9f35..."
}`)
client := &http.Client{}
req, err := http.NewRequest(method, url, bytes.NewBuffer(payload))
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <authToken>")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
import requests
import json
url = "https://sandbox-api.okto.tech/api/oc/v1/execute"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <authToken>"
}
payload = {
"callData": "0x8dd7712f0000000000000000...",
"callGasLimit": "0x5f7cd",
"maxFeePerGas": "0x112a880",
"maxPriorityFeePerGas": "0x112a880",
"nonce": "0x0000000000000000000000000000000076b49e2c7f184aebaa9ca7387f7aef20",
"paymaster": "0xc2d31cdc6efd02f85ab943c4587f8d60e6e15f9c",
"paymasterData": "0x000000000000000000000000c5a378bb6...",
"paymasterPostOpGasLimit": "0x1cf9",
"paymasterVerificationGasLimit": "0x13d6d",
"preVerificationGas": "0x16b7b",
"sender": "0xee5596022f7e4942d9f2ddfff57bdad4ae7160c3",
"verificationGasLimit": "0x28c6b",
"signature": "0x2c50427c1bc7f3b794aa37355ac59ba9f35..."
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.text)
Response Examples
{
"jsonrpc": "2.0",
"id": "25456a8f-8b66-4405-ad18-906aad82eba3",
"result": {
"jobId": "9c424737-e204-461b-b93a-ca8e3dfd655c"
}
}
{
"jsonrpc": "2.0",
"id": "25456a8f-8b66-4405-ad18-906aad82eba3",
"error": {
"code": -32603,
"message": "Internal server error",
"data": "error with downstream service"
}
}