(data.icm)
- getIcmMessage - Get an ICM message
- listIcmMessages - List ICM messages
- listIcmMessagesByAddress - List ICM messages by address
Gets an ICM message by message ID.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
serverURL: "https://api.example.com",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.icm.getIcmMessage({
messageId: "acf1c8b06f9aec48e9fcbefbbe576ae8a7ca3b327fcae111396e7cc99956674d",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataIcmGetIcmMessage } from "@avalabs/avacloud-sdk/funcs/dataIcmGetIcmMessage.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
serverURL: "https://api.example.com",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataIcmGetIcmMessage(avaCloudSDK, {
messageId: "acf1c8b06f9aec48e9fcbefbbe576ae8a7ca3b327fcae111396e7cc99956674d",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetIcmMessageRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.GetIcmMessageResponseBody>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.BadGateway | 502 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Lists ICM messages. Ordered by timestamp in descending order.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
serverURL: "https://api.example.com",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.icm.listIcmMessages({
sourceBlockchainId: "2D8RG4UpSXbPbvPCAWppNJyqTG2i2CAXSkTgmTBBvs7GKNZjsY",
destinationBlockchainId: "yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp",
to: "0x664A4Be5Af2cFc824F9C0914CbAc4703396Da2DC",
from: "0x321eDA69247566D662178feE695C7026c604Cd94",
network: "mainnet",
});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataIcmListIcmMessages } from "@avalabs/avacloud-sdk/funcs/dataIcmListIcmMessages.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
serverURL: "https://api.example.com",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataIcmListIcmMessages(avaCloudSDK, {
sourceBlockchainId: "2D8RG4UpSXbPbvPCAWppNJyqTG2i2CAXSkTgmTBBvs7GKNZjsY",
destinationBlockchainId: "yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp",
to: "0x664A4Be5Af2cFc824F9C0914CbAc4703396Da2DC",
from: "0x321eDA69247566D662178feE695C7026c604Cd94",
network: "mainnet",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListIcmMessagesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.ListIcmMessagesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.BadGateway | 502 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Lists ICM messages by address. Ordered by timestamp in descending order.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
serverURL: "https://api.example.com",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.icm.listIcmMessagesByAddress({
address: "0x8578AE7723751446B196bD5124e1bF57B40EB7Bc",
network: "mainnet",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataIcmListIcmMessagesByAddress } from "@avalabs/avacloud-sdk/funcs/dataIcmListIcmMessagesByAddress.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
serverURL: "https://api.example.com",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataIcmListIcmMessagesByAddress(avaCloudSDK, {
address: "0x8578AE7723751446B196bD5124e1bF57B40EB7Bc",
network: "mainnet",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListIcmMessagesByAddressRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<components.ListIcmMessagesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.BadGateway | 502 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4XX, 5XX | */* |