import cobo_waas2
from cobo_waas2.models.estimated_fee import EstimatedFee
from cobo_waas2.models.swap_estimate_fee import SwapEstimateFee
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.SwapsApi(api_client)
swap_estimate_fee = cobo_waas2.SwapEstimateFee(
wallet_id="123e4567-e89b-12d3-a456-426614174000",
address="19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku",
quote_id="123e4567-e89b-12d3-a456-426614174001",
fee_type="Fixed"
)
try:
# Estimate swap fee
api_response = api_instance.estimate_swap_fee(swap_estimate_fee)
print("The response of SwapsApi->estimate_swap_fee:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SwapsApi->estimate_swap_fee: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.SwapsApi;
import com.cobo.waas2.model.*;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
SwapsApi apiInstance = new SwapsApi();
SwapEstimateFee swapEstimateFee =
new SwapEstimateFee()
.walletId("123e4567-e89b-12d3-a456-426614174000")
.quoteId(UUID.fromString("123e4567-e89b-12d3-a456-426614174001"));
try {
EstimatedFee result = apiInstance.estimateSwapFee(swapEstimateFee);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SwapsApi#estimateSwapFee");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
swapEstimateFee := *coboWaas2.NewSwapEstimateFee("123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001")
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.SwapsAPI.EstimateSwapFee(ctx).
SwapEstimateFee(swapEstimateFee).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SwapsAPI.EstimateSwapFee``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `EstimateSwapFee`: EstimatedFee
fmt.Fprintf(os.Stdout, "Response from `SwapsAPI.EstimateSwapFee`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.SwapsApi();
const SwapEstimateFee = new CoboWaas2.SwapEstimateFee();
apiInstance.estimateSwapFee(SwapEstimateFee).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
{
"fee_type": "EVM_EIP_1559",
"token_id": "TRON",
"fee_amount": "0.1",
"is_loop": false
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}Estimate swap fee
This operation estimates the network fee of a swap activity. You can use this operation to estimate the network fee before initiating swap activities from MPC Wallets or Custodial Wallets (Web3 Wallets).
It requires a valid wallet_id and quote_id, so you need to get a swap quote first.
import cobo_waas2
from cobo_waas2.models.estimated_fee import EstimatedFee
from cobo_waas2.models.swap_estimate_fee import SwapEstimateFee
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.SwapsApi(api_client)
swap_estimate_fee = cobo_waas2.SwapEstimateFee(
wallet_id="123e4567-e89b-12d3-a456-426614174000",
address="19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku",
quote_id="123e4567-e89b-12d3-a456-426614174001",
fee_type="Fixed"
)
try:
# Estimate swap fee
api_response = api_instance.estimate_swap_fee(swap_estimate_fee)
print("The response of SwapsApi->estimate_swap_fee:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SwapsApi->estimate_swap_fee: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.SwapsApi;
import com.cobo.waas2.model.*;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
SwapsApi apiInstance = new SwapsApi();
SwapEstimateFee swapEstimateFee =
new SwapEstimateFee()
.walletId("123e4567-e89b-12d3-a456-426614174000")
.quoteId(UUID.fromString("123e4567-e89b-12d3-a456-426614174001"));
try {
EstimatedFee result = apiInstance.estimateSwapFee(swapEstimateFee);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SwapsApi#estimateSwapFee");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
swapEstimateFee := *coboWaas2.NewSwapEstimateFee("123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001")
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.SwapsAPI.EstimateSwapFee(ctx).
SwapEstimateFee(swapEstimateFee).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SwapsAPI.EstimateSwapFee``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `EstimateSwapFee`: EstimatedFee
fmt.Fprintf(os.Stdout, "Response from `SwapsAPI.EstimateSwapFee`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.SwapsApi();
const SwapEstimateFee = new CoboWaas2.SwapEstimateFee();
apiInstance.estimateSwapFee(SwapEstimateFee).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
{
"fee_type": "EVM_EIP_1559",
"token_id": "TRON",
"fee_amount": "0.1",
"is_loop": false
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}import cobo_waas2
from cobo_waas2.models.estimated_fee import EstimatedFee
from cobo_waas2.models.swap_estimate_fee import SwapEstimateFee
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.SwapsApi(api_client)
swap_estimate_fee = cobo_waas2.SwapEstimateFee(
wallet_id="123e4567-e89b-12d3-a456-426614174000",
address="19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku",
quote_id="123e4567-e89b-12d3-a456-426614174001",
fee_type="Fixed"
)
try:
# Estimate swap fee
api_response = api_instance.estimate_swap_fee(swap_estimate_fee)
print("The response of SwapsApi->estimate_swap_fee:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SwapsApi->estimate_swap_fee: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.SwapsApi;
import com.cobo.waas2.model.*;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
SwapsApi apiInstance = new SwapsApi();
SwapEstimateFee swapEstimateFee =
new SwapEstimateFee()
.walletId("123e4567-e89b-12d3-a456-426614174000")
.quoteId(UUID.fromString("123e4567-e89b-12d3-a456-426614174001"));
try {
EstimatedFee result = apiInstance.estimateSwapFee(swapEstimateFee);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SwapsApi#estimateSwapFee");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
swapEstimateFee := *coboWaas2.NewSwapEstimateFee("123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001")
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.SwapsAPI.EstimateSwapFee(ctx).
SwapEstimateFee(swapEstimateFee).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SwapsAPI.EstimateSwapFee``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `EstimateSwapFee`: EstimatedFee
fmt.Fprintf(os.Stdout, "Response from `SwapsAPI.EstimateSwapFee`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.SwapsApi();
const SwapEstimateFee = new CoboWaas2.SwapEstimateFee();
apiInstance.estimateSwapFee(SwapEstimateFee).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
import cobo_waas2
from cobo_waas2.models.estimated_fee import EstimatedFee
from cobo_waas2.models.swap_estimate_fee import SwapEstimateFee
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.SwapsApi(api_client)
swap_estimate_fee = cobo_waas2.SwapEstimateFee(
wallet_id="123e4567-e89b-12d3-a456-426614174000",
quote_id="123e4567-e89b-12d3-a456-426614174001",
)
try:
# Estimate swap fee
api_response = api_instance.estimate_swap_fee(swap_estimate_fee)
print("The response of SwapsApi->estimate_swap_fee:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SwapsApi->estimate_swap_fee: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.SwapsApi;
import com.cobo.waas2.model.*;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
SwapsApi apiInstance = new SwapsApi();
SwapEstimateFee swapEstimateFee =
new SwapEstimateFee()
.walletId("123e4567-e89b-12d3-a456-426614174000")
.quoteId("123e4567-e89b-12d3-a456-426614174001");
try {
EstimatedFee result = apiInstance.estimateSwapFee(swapEstimateFee);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SwapsApi#estimateSwapFee");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
swapEstimateFee := *coboWaas2.NewSwapEstimateFee("123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001")
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.SwapsAPI.EstimateSwapFee(ctx).
SwapEstimateFee(swapEstimateFee).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SwapsAPI.EstimateSwapFee``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `EstimateSwapFee`: EstimatedFee
fmt.Fprintf(os.Stdout, "Response from `SwapsAPI.EstimateSwapFee`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.SwapsApi();
const SwapEstimateFee = new CoboWaas2.SwapEstimateFee();
apiInstance.estimateSwapFee(SwapEstimateFee).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
Authorizations
The API key. For more details, refer to API key.
In the API playground, enter your API secret, and your API key will be accordingly calculated.
Body
The request body for estimating the network fee of a swap activity.
The ID of the wallet to pay.
"123e4567-e89b-12d3-a456-426614174000"
The ID of the swap quote.
"123e4567-e89b-12d3-a456-426614174001"
The wallet address. This property is required when the wallet to pay is not a Custodial Wallet (Asset Wallet).
"19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku"
The fee model. Possible values include:
Fixed: The fixed fee model.EVM_EIP_1559: The EIP-1559 fee model.EVM_Legacy: The legacy fee model.UTXO: The fee model used in UTXO-based blockchains, such as Bitcoin.SOL: The fee model used in Solana.FIL: The fee model used in Filecoin.
Each fee model requires a different set of properties. Switch between the above tabs for details.
To learn more about the fee models, refer to Fee models.
Fixed, EVM_EIP_1559, EVM_Legacy, UTXO, SOL, FIL "EVM_EIP_1559"
Response
The estimated service fee for swap activity successfully retrieved.
- Fixed
- EVM_EIP_1559
- EVM_Legacy
- UTXO
- SOL
- FIL
The estimated transaction fee based on the fixed fee model.
For more details about the fixed fee model, see Fee models.
The fee model. Possible values include:
Fixed: The fixed fee model.EVM_EIP_1559: The EIP-1559 fee model.EVM_Legacy: The legacy fee model.UTXO: The fee model used in UTXO-based blockchains, such as Bitcoin.SOL: The fee model used in Solana.FIL: The fee model used in Filecoin.
Each fee model requires a different set of properties. Switch between the above tabs for details.
To learn more about the fee models, refer to Fee models.
Fixed, EVM_EIP_1559, EVM_Legacy, UTXO, SOL, FIL "EVM_EIP_1559"
The token used to pay the transaction fee.
"TRON"
The transaction fee that you need to pay for the transaction.
"0.1"
Was this page helpful?
