(data.primaryNetwork.transactions)
- getTxByHash - Get transaction
- listLatestPrimaryNetworkTransactions - List latest transactions
- listActivePrimaryNetworkStakingTransactions - List staking transactions
- listAssetTransactions - List asset transactions
Gets the details of a single transaction on one of the Primary Network chains.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.primaryNetwork.transactions.getTxByHash({
blockchainId: "p-chain",
txHash: "3P91K6nuDFvDodcRuJTsgdf9SvYe5pMiKk38HppsoeAiEztCP",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataPrimaryNetworkTransactionsGetTxByHash } from "@avalabs/avacloud-sdk/funcs/dataPrimaryNetworkTransactionsGetTxByHash.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataPrimaryNetworkTransactionsGetTxByHash(avaCloudSDK, {
blockchainId: "p-chain",
txHash: "3P91K6nuDFvDodcRuJTsgdf9SvYe5pMiKk38HppsoeAiEztCP",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetTxByHashRequest | ✔️ | 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.GetTxByHashResponseBody>
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 the latest transactions on one of the Primary Network chains.
Transactions are filterable by addresses, txTypes, and timestamps. When querying for latest transactions without an address parameter, filtering by txTypes and timestamps is not supported. An address filter must be provided to utilize txTypes and timestamp filters.
For P-Chain, you can fetch all L1 validators related transactions like ConvertSubnetToL1Tx, IncreaseL1ValidatorBalanceTx etc. using the unique L1 validation ID. These transactions are further filterable by txTypes and timestamps as well.
Given that each transaction may return a large number of UTXO objects, bounded only by the maximum transaction size, the query may return less transactions than the provided page size. The result will contain less results than the page size if the number of utxos contained in the resulting transactions reach a performance threshold.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.primaryNetwork.transactions.listLatestPrimaryNetworkTransactions({
addresses: "avax1h2ccj9f5ay5acl6tyn9mwmw32p8wref8vl8ctg",
txTypes: [
"AddValidatorTx",
],
startTimestamp: 1689541049,
endTimestamp: 1689800249,
pageSize: 10,
blockchainId: "p-chain",
sortOrder: "asc",
});
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 { dataPrimaryNetworkTransactionsListLatestPrimaryNetworkTransactions } from "@avalabs/avacloud-sdk/funcs/dataPrimaryNetworkTransactionsListLatestPrimaryNetworkTransactions.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataPrimaryNetworkTransactionsListLatestPrimaryNetworkTransactions(avaCloudSDK, {
addresses: "avax1h2ccj9f5ay5acl6tyn9mwmw32p8wref8vl8ctg",
txTypes: [
"AddValidatorTx",
],
startTimestamp: 1689541049,
endTimestamp: 1689800249,
pageSize: 10,
blockchainId: "p-chain",
sortOrder: "asc",
});
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.ListLatestPrimaryNetworkTransactionsRequest | ✔️ | 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.ListLatestPrimaryNetworkTransactionsResponse>
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 active staking transactions on the P-Chain for the supplied addresses.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.primaryNetwork.transactions.listActivePrimaryNetworkStakingTransactions({
addresses: "avax1h2ccj9f5ay5acl6tyn9mwmw32p8wref8vl8ctg",
txTypes: [
"AddValidatorTx",
],
startTimestamp: 1689541049,
endTimestamp: 1689800249,
pageSize: 10,
blockchainId: "p-chain",
sortOrder: "asc",
});
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 { dataPrimaryNetworkTransactionsListActivePrimaryNetworkStakingTransactions } from "@avalabs/avacloud-sdk/funcs/dataPrimaryNetworkTransactionsListActivePrimaryNetworkStakingTransactions.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataPrimaryNetworkTransactionsListActivePrimaryNetworkStakingTransactions(avaCloudSDK, {
addresses: "avax1h2ccj9f5ay5acl6tyn9mwmw32p8wref8vl8ctg",
txTypes: [
"AddValidatorTx",
],
startTimestamp: 1689541049,
endTimestamp: 1689800249,
pageSize: 10,
blockchainId: "p-chain",
sortOrder: "asc",
});
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.ListActivePrimaryNetworkStakingTransactionsRequest | ✔️ | 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.ListActivePrimaryNetworkStakingTransactionsResponse>
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 asset transactions corresponding to the given asset id on the X-Chain.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.primaryNetwork.transactions.listAssetTransactions({
txTypes: [
"AddValidatorTx",
],
startTimestamp: 1689541049,
endTimestamp: 1689800249,
pageSize: 10,
blockchainId: "x-chain",
assetId: "th5aLdWLi32yS9ED6uLGoMMubqHjzMsXhKWwzP6yZTYQKYzof",
});
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 { dataPrimaryNetworkTransactionsListAssetTransactions } from "@avalabs/avacloud-sdk/funcs/dataPrimaryNetworkTransactionsListAssetTransactions.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataPrimaryNetworkTransactionsListAssetTransactions(avaCloudSDK, {
txTypes: [
"AddValidatorTx",
],
startTimestamp: 1689541049,
endTimestamp: 1689800249,
pageSize: 10,
blockchainId: "x-chain",
assetId: "th5aLdWLi32yS9ED6uLGoMMubqHjzMsXhKWwzP6yZTYQKYzof",
});
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.ListAssetTransactionsRequest | ✔️ | 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.ListAssetTransactionsResponse>
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 | */* |