Get anyspend quote
curl --request POST \
--url https://mainnet.anyspend.com/orders/quote \
--header 'Content-Type: application/json' \
--data '
{
"type": "swap",
"srcChain": 1,
"dstChain": 8453,
"srcTokenAddress": "0x0000000000000000000000000000000000000000",
"dstTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "1000000000000000000",
"recipientAddress": "0x55c71fca5e01cf246718748ae540473e608d0282",
"partnerId": "<string>"
}
'import requests
url = "https://mainnet.anyspend.com/orders/quote"
payload = {
"type": "swap",
"srcChain": 1,
"dstChain": 8453,
"srcTokenAddress": "0x0000000000000000000000000000000000000000",
"dstTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "1000000000000000000",
"recipientAddress": "0x55c71fca5e01cf246718748ae540473e608d0282",
"partnerId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'swap',
srcChain: 1,
dstChain: 8453,
srcTokenAddress: '0x0000000000000000000000000000000000000000',
dstTokenAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
amount: '1000000000000000000',
recipientAddress: '0x55c71fca5e01cf246718748ae540473e608d0282',
partnerId: '<string>'
})
};
fetch('https://mainnet.anyspend.com/orders/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.anyspend.com/orders/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'swap',
'srcChain' => 1,
'dstChain' => 8453,
'srcTokenAddress' => '0x0000000000000000000000000000000000000000',
'dstTokenAddress' => '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
'amount' => '1000000000000000000',
'recipientAddress' => '0x55c71fca5e01cf246718748ae540473e608d0282',
'partnerId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.anyspend.com/orders/quote"
payload := strings.NewReader("{\n \"type\": \"swap\",\n \"srcChain\": 1,\n \"dstChain\": 8453,\n \"srcTokenAddress\": \"0x0000000000000000000000000000000000000000\",\n \"dstTokenAddress\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n \"amount\": \"1000000000000000000\",\n \"recipientAddress\": \"0x55c71fca5e01cf246718748ae540473e608d0282\",\n \"partnerId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.anyspend.com/orders/quote")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"swap\",\n \"srcChain\": 1,\n \"dstChain\": 8453,\n \"srcTokenAddress\": \"0x0000000000000000000000000000000000000000\",\n \"dstTokenAddress\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n \"amount\": \"1000000000000000000\",\n \"recipientAddress\": \"0x55c71fca5e01cf246718748ae540473e608d0282\",\n \"partnerId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.anyspend.com/orders/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"swap\",\n \"srcChain\": 1,\n \"dstChain\": 8453,\n \"srcTokenAddress\": \"0x0000000000000000000000000000000000000000\",\n \"dstTokenAddress\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n \"amount\": \"1000000000000000000\",\n \"recipientAddress\": \"0x55c71fca5e01cf246718748ae540473e608d0282\",\n \"partnerId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Get quote successfully",
"data": {
"fee": {
"type": "standard_fee",
"feeVersion": 1,
"tokenToCheckBalance": "0xb3b32f9f8827d4634fe7d973fa1034ec9fddb3b3",
"recipientBalance": "302843673392800000000000",
"anyspendFeeBps": 80,
"anyspendWhaleDiscountBps": 5000,
"anyspendPartnerDiscountBps": 0,
"finalFeeBps": 40
},
"operation": "swap",
"sender": "0x15846E6A7C839A208765a0B4754C2dd15E879990",
"recipient": "0xaF1ae1B78bc767DaEBB91196Adf982E9d560AAB9",
"currencyIn": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png"
}
},
"amount": "1000000000000000000",
"amountFormatted": "1.0",
"amountUsd": "3229.715818",
"minimumAmount": "1000000000000000000"
},
"currencyOut": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://coin-images.coingecko.com/coins/images/6319/large/usdc.png?1696506694"
}
},
"amount": "3224805862",
"amountFormatted": "3224.805862",
"amountUsd": "3224.512405",
"minimumAmount": "3192557803"
},
"totalImpact": {
"usd": "-5.203413",
"percent": "-0.16"
},
"swapImpact": {
"usd": "-4.102797",
"percent": "-0.13"
},
"rate": "3224.805862",
"slippageTolerance": {
"origin": {
"usd": "0.000000",
"value": "0",
"percent": "0.00"
},
"destination": {
"usd": "32.245124",
"value": "32248059",
"percent": "1.00"
}
},
"timeEstimate": 24,
"userBalance": "0",
"pointsAmount": 100,
"pointsMultiplier": 1.5
},
"statusCode": 200
}{
"success": false,
"message": "Bad request",
"statusCode": 400
}Orders
Get anyspend quote
Retrieves a quote to swap, execute contract, or participate in HypeDuel
POST
/
orders
/
quote
Get anyspend quote
curl --request POST \
--url https://mainnet.anyspend.com/orders/quote \
--header 'Content-Type: application/json' \
--data '
{
"type": "swap",
"srcChain": 1,
"dstChain": 8453,
"srcTokenAddress": "0x0000000000000000000000000000000000000000",
"dstTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "1000000000000000000",
"recipientAddress": "0x55c71fca5e01cf246718748ae540473e608d0282",
"partnerId": "<string>"
}
'import requests
url = "https://mainnet.anyspend.com/orders/quote"
payload = {
"type": "swap",
"srcChain": 1,
"dstChain": 8453,
"srcTokenAddress": "0x0000000000000000000000000000000000000000",
"dstTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "1000000000000000000",
"recipientAddress": "0x55c71fca5e01cf246718748ae540473e608d0282",
"partnerId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'swap',
srcChain: 1,
dstChain: 8453,
srcTokenAddress: '0x0000000000000000000000000000000000000000',
dstTokenAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
amount: '1000000000000000000',
recipientAddress: '0x55c71fca5e01cf246718748ae540473e608d0282',
partnerId: '<string>'
})
};
fetch('https://mainnet.anyspend.com/orders/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.anyspend.com/orders/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'swap',
'srcChain' => 1,
'dstChain' => 8453,
'srcTokenAddress' => '0x0000000000000000000000000000000000000000',
'dstTokenAddress' => '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
'amount' => '1000000000000000000',
'recipientAddress' => '0x55c71fca5e01cf246718748ae540473e608d0282',
'partnerId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.anyspend.com/orders/quote"
payload := strings.NewReader("{\n \"type\": \"swap\",\n \"srcChain\": 1,\n \"dstChain\": 8453,\n \"srcTokenAddress\": \"0x0000000000000000000000000000000000000000\",\n \"dstTokenAddress\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n \"amount\": \"1000000000000000000\",\n \"recipientAddress\": \"0x55c71fca5e01cf246718748ae540473e608d0282\",\n \"partnerId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.anyspend.com/orders/quote")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"swap\",\n \"srcChain\": 1,\n \"dstChain\": 8453,\n \"srcTokenAddress\": \"0x0000000000000000000000000000000000000000\",\n \"dstTokenAddress\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n \"amount\": \"1000000000000000000\",\n \"recipientAddress\": \"0x55c71fca5e01cf246718748ae540473e608d0282\",\n \"partnerId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.anyspend.com/orders/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"swap\",\n \"srcChain\": 1,\n \"dstChain\": 8453,\n \"srcTokenAddress\": \"0x0000000000000000000000000000000000000000\",\n \"dstTokenAddress\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n \"amount\": \"1000000000000000000\",\n \"recipientAddress\": \"0x55c71fca5e01cf246718748ae540473e608d0282\",\n \"partnerId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Get quote successfully",
"data": {
"fee": {
"type": "standard_fee",
"feeVersion": 1,
"tokenToCheckBalance": "0xb3b32f9f8827d4634fe7d973fa1034ec9fddb3b3",
"recipientBalance": "302843673392800000000000",
"anyspendFeeBps": 80,
"anyspendWhaleDiscountBps": 5000,
"anyspendPartnerDiscountBps": 0,
"finalFeeBps": 40
},
"operation": "swap",
"sender": "0x15846E6A7C839A208765a0B4754C2dd15E879990",
"recipient": "0xaF1ae1B78bc767DaEBB91196Adf982E9d560AAB9",
"currencyIn": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png"
}
},
"amount": "1000000000000000000",
"amountFormatted": "1.0",
"amountUsd": "3229.715818",
"minimumAmount": "1000000000000000000"
},
"currencyOut": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://coin-images.coingecko.com/coins/images/6319/large/usdc.png?1696506694"
}
},
"amount": "3224805862",
"amountFormatted": "3224.805862",
"amountUsd": "3224.512405",
"minimumAmount": "3192557803"
},
"totalImpact": {
"usd": "-5.203413",
"percent": "-0.16"
},
"swapImpact": {
"usd": "-4.102797",
"percent": "-0.13"
},
"rate": "3224.805862",
"slippageTolerance": {
"origin": {
"usd": "0.000000",
"value": "0",
"percent": "0.00"
},
"destination": {
"usd": "32.245124",
"value": "32248059",
"percent": "1.00"
}
},
"timeEstimate": 24,
"userBalance": "0",
"pointsAmount": 100,
"pointsMultiplier": 1.5
},
"statusCode": 200
}{
"success": false,
"message": "Bad request",
"statusCode": 400
}Body
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
Quote for swap order
Order type for swap
Available options:
swap Source chain ID
Example:
1
Destination chain ID
Example:
8453
Source token contract address
Example:
"0x0000000000000000000000000000000000000000"
Destination token contract address
Example:
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
Type of trade execution
Available options:
EXACT_INPUT, EXACT_OUTPUT Amount to quote
Example:
"1000000000000000000"
Recipient address
Example:
"0x55c71fca5e01cf246718748ae540473e608d0282"
Optional onramp vendor
Available options:
coinbase, stripe, stripe-web2, none Optional partner ID
HypeDuel