import cobo_waas2
from cobo_waas2.models.list_swap_activities200_response import (
ListSwapActivities200Response,
)
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)
status = "Success"
min_updated_timestamp = 1635744000000
max_updated_timestamp = 1635744000000
initiator = "[email protected]"
limit = 10
before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
sort_by = ""
direction = ""
try:
# List Swap Activities
api_response = api_instance.list_swap_activities(
status=status,
min_updated_timestamp=min_updated_timestamp,
max_updated_timestamp=max_updated_timestamp,
initiator=initiator,
limit=limit,
before=before,
after=after,
sort_by=sort_by,
direction=direction,
)
print("The response of SwapsApi->list_swap_activities:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SwapsApi->list_swap_activities: %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();
String status = "Success";
Long minUpdatedTimestamp = 1635744000000L;
Long maxUpdatedTimestamp = 1635744000000L;
String initiator = "[email protected]";
Integer limit = 10;
String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
String sortBy = "";
String direction = "ASC";
try {
ListSwapActivities200Response result =
apiInstance.listSwapActivities(
status,
minUpdatedTimestamp,
maxUpdatedTimestamp,
initiator,
limit,
before,
after,
sortBy,
direction);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SwapsApi#listSwapActivities");
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() {
status := "Success"
minUpdatedTimestamp := int64(1635744000000)
maxUpdatedTimestamp := int64(1635744000000)
initiator := "[email protected]"
limit := int32(10)
before := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
after := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
sortBy := "timestamp"
direction := "ASC"
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.ListSwapActivities(ctx).Status(status).MinUpdatedTimestamp(minUpdatedTimestamp).MaxUpdatedTimestamp(maxUpdatedTimestamp).Initiator(initiator).Limit(limit).Before(before).After(after).SortBy(sortBy).Direction(direction).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SwapsAPI.ListSwapActivities``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListSwapActivities`: ListSwapActivities200Response
fmt.Fprintf(os.Stdout, "Response from `SwapsAPI.ListSwapActivities`: %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 opts = {
status: "Success",
min_updated_timestamp: 1635744000000,
max_updated_timestamp: 1635744000000,
initiator: "[email protected]",
limit: 10,
before: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
after: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
sort_by: "timestamp",
direction: "ASC",
};
apiInstance.listSwapActivities(opts).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
{
"data": [
{
"activity_id": "123e4567-e89b-12d3-a456-426614174000",
"swap_type": "Bridge",
"status": "Success",
"request_id": "123e4567-e89b-12d3-a456-426614174000",
"wallet_id": "123e4567-e89b-12d3-a456-426614174001",
"pay_token_id": "BTC",
"receive_token_id": "ETH_WBTC",
"pay_amount": "100",
"receive_amount": "100",
"fee_token_id": "BTC",
"fee_amount": "0.3",
"initiator": "John Doe",
"initiator_type": "API",
"description": "This is a description of the swap activity.",
"created_timestamp": 1677587333000,
"updated_timestamp": 1677587393000,
"network_fee": {
"fee_type": "EVM_EIP_1559",
"token_id": "TRON",
"max_fee_amount": "0.1"
},
"destination_address": "19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku"
}
],
"pagination": {
"before": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
"after": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
"total_count": 10000
}
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}List swap activities
This operation retrieves a list of swap activities. You can filter the results by swap type, status, initiator, and time range.
import cobo_waas2
from cobo_waas2.models.list_swap_activities200_response import (
ListSwapActivities200Response,
)
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)
status = "Success"
min_updated_timestamp = 1635744000000
max_updated_timestamp = 1635744000000
initiator = "[email protected]"
limit = 10
before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
sort_by = ""
direction = ""
try:
# List Swap Activities
api_response = api_instance.list_swap_activities(
status=status,
min_updated_timestamp=min_updated_timestamp,
max_updated_timestamp=max_updated_timestamp,
initiator=initiator,
limit=limit,
before=before,
after=after,
sort_by=sort_by,
direction=direction,
)
print("The response of SwapsApi->list_swap_activities:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SwapsApi->list_swap_activities: %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();
String status = "Success";
Long minUpdatedTimestamp = 1635744000000L;
Long maxUpdatedTimestamp = 1635744000000L;
String initiator = "[email protected]";
Integer limit = 10;
String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
String sortBy = "";
String direction = "ASC";
try {
ListSwapActivities200Response result =
apiInstance.listSwapActivities(
status,
minUpdatedTimestamp,
maxUpdatedTimestamp,
initiator,
limit,
before,
after,
sortBy,
direction);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SwapsApi#listSwapActivities");
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() {
status := "Success"
minUpdatedTimestamp := int64(1635744000000)
maxUpdatedTimestamp := int64(1635744000000)
initiator := "[email protected]"
limit := int32(10)
before := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
after := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
sortBy := "timestamp"
direction := "ASC"
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.ListSwapActivities(ctx).Status(status).MinUpdatedTimestamp(minUpdatedTimestamp).MaxUpdatedTimestamp(maxUpdatedTimestamp).Initiator(initiator).Limit(limit).Before(before).After(after).SortBy(sortBy).Direction(direction).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SwapsAPI.ListSwapActivities``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListSwapActivities`: ListSwapActivities200Response
fmt.Fprintf(os.Stdout, "Response from `SwapsAPI.ListSwapActivities`: %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 opts = {
status: "Success",
min_updated_timestamp: 1635744000000,
max_updated_timestamp: 1635744000000,
initiator: "[email protected]",
limit: 10,
before: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
after: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
sort_by: "timestamp",
direction: "ASC",
};
apiInstance.listSwapActivities(opts).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
{
"data": [
{
"activity_id": "123e4567-e89b-12d3-a456-426614174000",
"swap_type": "Bridge",
"status": "Success",
"request_id": "123e4567-e89b-12d3-a456-426614174000",
"wallet_id": "123e4567-e89b-12d3-a456-426614174001",
"pay_token_id": "BTC",
"receive_token_id": "ETH_WBTC",
"pay_amount": "100",
"receive_amount": "100",
"fee_token_id": "BTC",
"fee_amount": "0.3",
"initiator": "John Doe",
"initiator_type": "API",
"description": "This is a description of the swap activity.",
"created_timestamp": 1677587333000,
"updated_timestamp": 1677587393000,
"network_fee": {
"fee_type": "EVM_EIP_1559",
"token_id": "TRON",
"max_fee_amount": "0.1"
},
"destination_address": "19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku"
}
],
"pagination": {
"before": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
"after": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
"total_count": 10000
}
}{
"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.list_swap_activities200_response import (
ListSwapActivities200Response,
)
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)
status = "Success"
min_updated_timestamp = 1635744000000
max_updated_timestamp = 1635744000000
initiator = "[email protected]"
limit = 10
before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
sort_by = ""
direction = ""
try:
# List Swap Activities
api_response = api_instance.list_swap_activities(
status=status,
min_updated_timestamp=min_updated_timestamp,
max_updated_timestamp=max_updated_timestamp,
initiator=initiator,
limit=limit,
before=before,
after=after,
sort_by=sort_by,
direction=direction,
)
print("The response of SwapsApi->list_swap_activities:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SwapsApi->list_swap_activities: %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();
String status = "Success";
Long minUpdatedTimestamp = 1635744000000L;
Long maxUpdatedTimestamp = 1635744000000L;
String initiator = "[email protected]";
Integer limit = 10;
String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
String sortBy = "";
String direction = "ASC";
try {
ListSwapActivities200Response result =
apiInstance.listSwapActivities(
status,
minUpdatedTimestamp,
maxUpdatedTimestamp,
initiator,
limit,
before,
after,
sortBy,
direction);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SwapsApi#listSwapActivities");
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() {
status := "Success"
minUpdatedTimestamp := int64(1635744000000)
maxUpdatedTimestamp := int64(1635744000000)
initiator := "[email protected]"
limit := int32(10)
before := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
after := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
sortBy := "timestamp"
direction := "ASC"
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.ListSwapActivities(ctx).Status(status).MinUpdatedTimestamp(minUpdatedTimestamp).MaxUpdatedTimestamp(maxUpdatedTimestamp).Initiator(initiator).Limit(limit).Before(before).After(after).SortBy(sortBy).Direction(direction).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SwapsAPI.ListSwapActivities``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListSwapActivities`: ListSwapActivities200Response
fmt.Fprintf(os.Stdout, "Response from `SwapsAPI.ListSwapActivities`: %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 opts = {
status: "Success",
min_updated_timestamp: 1635744000000,
max_updated_timestamp: 1635744000000,
initiator: "[email protected]",
limit: 10,
before: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
after: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
sort_by: "timestamp",
direction: "ASC",
};
apiInstance.listSwapActivities(opts).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
import cobo_waas2
from cobo_waas2.models.list_swap_activities200_response import (
ListSwapActivities200Response,
)
from cobo_waas2.models.swap_activity_status import SwapActivityStatus
from cobo_waas2.models.swap_type import SwapType
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)
request_id = "web_send_by_user_327_1610444045047"
type = cobo_waas2.SwapType()
status = cobo_waas2.SwapActivityStatus()
min_updated_timestamp = 1635744000000
max_updated_timestamp = 1635744000000
initiator = "[email protected]"
limit = 10
before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
sort_by = "created_timestamp"
direction = "ASC"
try:
# List swap activities
api_response = api_instance.list_swap_activities(
request_id=request_id,
type=type,
status=status,
min_updated_timestamp=min_updated_timestamp,
max_updated_timestamp=max_updated_timestamp,
initiator=initiator,
limit=limit,
before=before,
after=after,
sort_by=sort_by,
direction=direction,
)
print("The response of SwapsApi->list_swap_activities:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SwapsApi->list_swap_activities: %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();
String requestId = "web_send_by_user_327_1610444045047";
SwapType type = SwapType.fromValue("Bridge");
SwapActivityStatus status = SwapActivityStatus.fromValue("Success");
Long minUpdatedTimestamp = 1635744000000L;
Long maxUpdatedTimestamp = 1635744000000L;
String initiator = "[email protected]";
Integer limit = 10;
String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
String sortBy = "created_timestamp";
String direction = "ASC";
try {
ListSwapActivities200Response result =
apiInstance.listSwapActivities(
requestId,
type,
status,
minUpdatedTimestamp,
maxUpdatedTimestamp,
initiator,
limit,
before,
after,
sortBy,
direction);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SwapsApi#listSwapActivities");
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() {
requestId := "web_send_by_user_327_1610444045047"
type_ := coboWaas2.SwapType("Bridge")
status := coboWaas2.SwapActivityStatus("Success")
minUpdatedTimestamp := int64(1635744000000)
maxUpdatedTimestamp := int64(1635744000000)
initiator := "[email protected]"
limit := int32(10)
before := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
after := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
sortBy := "created_timestamp"
direction := "ASC"
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.ListSwapActivities(ctx).
RequestId(requestId).
Type_(type_).
Status(status).
MinUpdatedTimestamp(minUpdatedTimestamp).
MaxUpdatedTimestamp(maxUpdatedTimestamp).
Initiator(initiator).
Limit(limit).
Before(before).
After(after).
SortBy(sortBy).
Direction(direction).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SwapsAPI.ListSwapActivities``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListSwapActivities`: ListSwapActivities200Response
fmt.Fprintf(os.Stdout, "Response from `SwapsAPI.ListSwapActivities`: %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 opts = {
request_id: "web_send_by_user_327_1610444045047",
type: new CoboWaas2.SwapType(),
status: new CoboWaas2.SwapActivityStatus(),
min_updated_timestamp: 1635744000000,
max_updated_timestamp: 1635744000000,
initiator: "[email protected]",
limit: 10,
before: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
after: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
sort_by: "created_timestamp",
direction: "ASC",
};
apiInstance.listSwapActivities(opts).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.
Query Parameters
The request ID that is used to track a transaction request. The request ID is provided by you and must be unique within your organization.
The type of the swap activity. Possible values include:
Bridge: The activity involves bridging tokens across chains.Exchange: The activity involves token-to-token exchange (a swap within the same chain).
Bridge, Exchange "Bridge"
The status of the swap activity. Possible values include:
Success: The activity completed successfully.Processing: The activity is being processed.Failed: The activity failed.
Success, Processing, Failed "Success"
The start time of the query. All swap activities updated after the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds.
The end time of the query. All swap activities updated before the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds.
The initiator of the swap activity. It is optional when creating the activity and defaults to your API key if not specified.
The maximum number of objects to return. For most operations, the value range is [1, 50].
A cursor indicating the position before the current page. This value is generated by Cobo and returned in the response. If you are paginating forward from the beginning, you do not need to provide it on the first request. When paginating backward (to the previous page), you should pass the before value returned from the last response.
A cursor indicating the position after the current page. This value is generated by Cobo and returned in the response. You do not need to provide it on the first request. When paginating forward (to the next page), you should pass the after value returned from the last response.
The field to sort the results by.
Possible values include:
created_timestamp: Sort by the time when the data was created.updated_timestamp: Sort by the time when the data was last updated.
created_timestamp, updated_timestamp The sort direction. Possible values include:
ASC: Sort the results in ascending order.DESC: Sort the results in descending order.
ASC, DESC Was this page helpful?
