@covalenthq/client-sdk 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/cjs/index.js +183 -61
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/services/BalanceService.d.ts +2 -2
- package/dist/cjs/src/services/TransactionService.d.ts +49 -20
- package/dist/cjs/src/utils/types/BalanceService.types.d.ts +1 -1
- package/dist/cjs/src/utils/types/TransactionService.types.d.ts +47 -2
- package/dist/esm/index.js +183 -61
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/services/BalanceService.d.ts +2 -2
- package/dist/esm/src/services/TransactionService.d.ts +49 -20
- package/dist/esm/src/utils/types/BalanceService.types.d.ts +1 -1
- package/dist/esm/src/utils/types/TransactionService.types.d.ts +47 -2
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -248,8 +248,8 @@ The Covalent SDK provides comprehensive support for all Class A, Class B, and Pr
|
|
|
248
248
|
2. <strong>Security Service</strong>: Access to the token approvals API endpoints
|
|
249
249
|
</summary>
|
|
250
250
|
|
|
251
|
-
- `getApprovals()`: Get a list of approvals across all ERC20 token contracts categorized by spenders for a wallet
|
|
252
|
-
- `getNftApprovals()`: Get a list of approvals across all NFT contracts categorized by spenders for a wallet
|
|
251
|
+
- `getApprovals()`: Get a list of approvals across all ERC20 token contracts categorized by spenders for a wallet's assets.
|
|
252
|
+
- `getNftApprovals()`: Get a list of approvals across all NFT contracts categorized by spenders for a wallet's assets.
|
|
253
253
|
</details>
|
|
254
254
|
|
|
255
255
|
<details>
|
|
@@ -333,13 +333,13 @@ The Covalent SDK provides comprehensive support for all Class A, Class B, and Pr
|
|
|
333
333
|
|
|
334
334
|
- `getAllTransactionsForAddress()`: Fetch and render the most recent transactions involving an address. Frequently seen in wallet applications. (Paginated)
|
|
335
335
|
- `getAllTransactionsForAddressByPage()`: Fetch and render the most recent transactions involving an address. Frequently seen in wallet applications. (Nonpaginated)
|
|
336
|
-
- `
|
|
336
|
+
- `getPaginatedTransactionsForAddress()`: Fetch and render the most recent transactions involving an address. Frequently seen in wallet applications.
|
|
337
337
|
- `getTransaction()`: Fetch and render a single transaction including its decoded log events. Additionally return semantically decoded information for DEX trades, lending and NFT sales.
|
|
338
|
-
- `
|
|
338
|
+
- `getTransactionsForBlockByPage()`: Fetch all transactions including their decoded log events in a block by page number and further flag interesting wallets or transactions.
|
|
339
|
+
- `getTransactionsForBlock()`: Fetch all transactions including their decoded log events in a block by block hash and further flag interesting wallets or transactions.
|
|
339
340
|
- `getTransactionSummary()`: Fetch the earliest and latest transactions, and the transaction count for a wallet. Calculate the age of the wallet and the time it has been idle and quickly gain insights into their engagement with web3.
|
|
340
341
|
- `getTimeBucketTransactionsForAddress()`: Fetch all transactions including their decoded log events in a 15-minute time bucket interval.
|
|
341
|
-
- `
|
|
342
|
-
- `getTransactionsForBlockHash()`: Fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
|
|
342
|
+
- `getEarliestTransactionsForAddress()`: Fetch and render the earliest transactions involving an address. Frequently seen in wallet applications.
|
|
343
343
|
</details>
|
|
344
344
|
|
|
345
345
|
## Contributing
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = "2.2.
|
|
3
|
+
var version = "2.2.5";
|
|
4
4
|
|
|
5
5
|
const bigIntParser = (val) => {
|
|
6
6
|
if (val === null || val === undefined) {
|
|
@@ -2454,6 +2454,119 @@ class TransactionService {
|
|
|
2454
2454
|
};
|
|
2455
2455
|
return await this.execution.execute(endpoint, parseData);
|
|
2456
2456
|
}
|
|
2457
|
+
/**
|
|
2458
|
+
*
|
|
2459
|
+
* Commonly used to fetch the earliest and latest transactions, and the transaction count for a wallet. Calculate the age of the wallet and the time it has been idle and quickly gain insights into their engagement with web3.
|
|
2460
|
+
*
|
|
2461
|
+
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
|
|
2462
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
2463
|
+
* @param {GetTransactionSummaryQueryParamOpts} queryParamOpts
|
|
2464
|
+
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
2465
|
+
* - `withGas`: Include gas summary details. Additional charge of 1 credit when true. Response times may be impacted for wallets with millions of transactions.
|
|
2466
|
+
*
|
|
2467
|
+
*/
|
|
2468
|
+
async getTransactionSummary(chainName, walletAddress, queryParamOpts) {
|
|
2469
|
+
const endpoint = endpointGenerator(`${chainName}/address/${walletAddress}/transactions_summary`, [
|
|
2470
|
+
{
|
|
2471
|
+
key: "quote-currency",
|
|
2472
|
+
value: queryParamOpts?.quoteCurrency,
|
|
2473
|
+
},
|
|
2474
|
+
{
|
|
2475
|
+
key: "with-gas",
|
|
2476
|
+
value: queryParamOpts?.withGas,
|
|
2477
|
+
},
|
|
2478
|
+
]);
|
|
2479
|
+
const parseData = (data) => {
|
|
2480
|
+
if (data.data) {
|
|
2481
|
+
data.data.updated_at = data.data.updated_at
|
|
2482
|
+
? new Date(data.data.updated_at)
|
|
2483
|
+
: null;
|
|
2484
|
+
data.data.items = data.data.items
|
|
2485
|
+
? data.data.items.map((txsItem) => ({
|
|
2486
|
+
...txsItem,
|
|
2487
|
+
earliest_transaction: {
|
|
2488
|
+
...txsItem.earliest_transaction,
|
|
2489
|
+
block_signed_at: txsItem?.earliest_transaction?.block_signed_at
|
|
2490
|
+
? new Date(txsItem.earliest_transaction.block_signed_at)
|
|
2491
|
+
: null,
|
|
2492
|
+
},
|
|
2493
|
+
latest_transaction: {
|
|
2494
|
+
...txsItem.latest_transaction,
|
|
2495
|
+
block_signed_at: txsItem?.latest_transaction?.block_signed_at
|
|
2496
|
+
? new Date(txsItem?.latest_transaction?.block_signed_at)
|
|
2497
|
+
: null,
|
|
2498
|
+
},
|
|
2499
|
+
// ? API vs docs non-consistent
|
|
2500
|
+
// gas_summary: {
|
|
2501
|
+
// ...txsItem.gas_summary,
|
|
2502
|
+
// total_fees_paid: bigIntParser(
|
|
2503
|
+
// txsItem.gas_summary.total_fees_paid
|
|
2504
|
+
// ),
|
|
2505
|
+
// },
|
|
2506
|
+
}))
|
|
2507
|
+
: null;
|
|
2508
|
+
}
|
|
2509
|
+
return data;
|
|
2510
|
+
};
|
|
2511
|
+
return await this.execution.execute(endpoint, parseData);
|
|
2512
|
+
}
|
|
2513
|
+
/**
|
|
2514
|
+
*
|
|
2515
|
+
* Commonly used to fetch and render the earliest transactions involving an address. Frequently seen in wallet applications.
|
|
2516
|
+
*
|
|
2517
|
+
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
|
|
2518
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
2519
|
+
* @param {GetEarliestTransactionsForAddressQueryParamOpts} queryParamOpts
|
|
2520
|
+
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
2521
|
+
* - `noLogs`: Omit log events.
|
|
2522
|
+
*
|
|
2523
|
+
*/
|
|
2524
|
+
async getEarliestTransactionsForAddress(chainName, walletAddress, queryParamOpts) {
|
|
2525
|
+
const searchParams = [
|
|
2526
|
+
{
|
|
2527
|
+
key: "quote-currency",
|
|
2528
|
+
value: queryParamOpts?.quoteCurrency,
|
|
2529
|
+
},
|
|
2530
|
+
{
|
|
2531
|
+
key: "no-logs",
|
|
2532
|
+
value: queryParamOpts?.noLogs,
|
|
2533
|
+
},
|
|
2534
|
+
];
|
|
2535
|
+
const endpoint = endpointGenerator(`${chainName}/bulk/transactions/${walletAddress}`, searchParams);
|
|
2536
|
+
const parseData = (data) => {
|
|
2537
|
+
if (data.data) {
|
|
2538
|
+
data.data.prev = data.data?.links?.prev
|
|
2539
|
+
? async () => this.execution.execute(endpointGenerator(data.data?.links?.prev, searchParams), parseData)
|
|
2540
|
+
: null;
|
|
2541
|
+
data.data.next = data.data?.links?.next
|
|
2542
|
+
? async () => this.execution.execute(endpointGenerator(data.data?.links?.next, searchParams), parseData)
|
|
2543
|
+
: null;
|
|
2544
|
+
data.data.updated_at = data.data.updated_at
|
|
2545
|
+
? new Date(data.data.updated_at)
|
|
2546
|
+
: null;
|
|
2547
|
+
data.data.items = data.data.items
|
|
2548
|
+
? data.data.items.map((txItem) => ({
|
|
2549
|
+
...txItem,
|
|
2550
|
+
value: bigIntParser(txItem.value),
|
|
2551
|
+
fees_paid: bigIntParser(txItem.fees_paid),
|
|
2552
|
+
block_signed_at: txItem.block_signed_at
|
|
2553
|
+
? new Date(txItem.block_signed_at)
|
|
2554
|
+
: null,
|
|
2555
|
+
log_events: txItem.log_events
|
|
2556
|
+
? txItem.log_events.map((logItem) => ({
|
|
2557
|
+
...logItem,
|
|
2558
|
+
block_signed_at: logItem.block_signed_at
|
|
2559
|
+
? new Date(logItem.block_signed_at)
|
|
2560
|
+
: null,
|
|
2561
|
+
}))
|
|
2562
|
+
: null,
|
|
2563
|
+
}))
|
|
2564
|
+
: null;
|
|
2565
|
+
}
|
|
2566
|
+
return data;
|
|
2567
|
+
};
|
|
2568
|
+
return await this.execution.execute(endpoint, parseData);
|
|
2569
|
+
}
|
|
2457
2570
|
/**
|
|
2458
2571
|
*
|
|
2459
2572
|
* Commonly used to fetch and render the most recent transactions involving an address. Frequently seen in wallet applications.
|
|
@@ -2604,18 +2717,18 @@ class TransactionService {
|
|
|
2604
2717
|
return await this.execution.execute(endpoint, parseData);
|
|
2605
2718
|
}
|
|
2606
2719
|
/**
|
|
2607
|
-
*
|
|
2608
|
-
* Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
|
|
2609
2720
|
*
|
|
2610
2721
|
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
|
|
2611
|
-
* @param {
|
|
2612
|
-
* @param {
|
|
2722
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
2723
|
+
* @param {number} page - The requested page, 0-indexed.
|
|
2724
|
+
* @param {getPaginatedTransactionsForAddressQueryParamOpts} queryParamOpts
|
|
2613
2725
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
2614
2726
|
* - `noLogs`: Omit log events.
|
|
2727
|
+
* - `blockSignedAtAsc`: Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order.
|
|
2615
2728
|
*
|
|
2616
2729
|
*/
|
|
2617
|
-
async
|
|
2618
|
-
const
|
|
2730
|
+
async getPaginatedTransactionsForAddress(chainName, walletAddress, page, queryParamOpts) {
|
|
2731
|
+
const searchParams = [
|
|
2619
2732
|
{
|
|
2620
2733
|
key: "quote-currency",
|
|
2621
2734
|
value: queryParamOpts?.quoteCurrency,
|
|
@@ -2624,9 +2737,20 @@ class TransactionService {
|
|
|
2624
2737
|
key: "no-logs",
|
|
2625
2738
|
value: queryParamOpts?.noLogs,
|
|
2626
2739
|
},
|
|
2627
|
-
|
|
2740
|
+
{
|
|
2741
|
+
key: "block-signed-at-asc",
|
|
2742
|
+
value: queryParamOpts?.blockSignedAtAsc,
|
|
2743
|
+
},
|
|
2744
|
+
];
|
|
2745
|
+
const endpoint = endpointGenerator(`${chainName}/address/${walletAddress}/transactions_v3/page/${page}`, searchParams);
|
|
2628
2746
|
const parseData = (data) => {
|
|
2629
2747
|
if (data.data) {
|
|
2748
|
+
data.data.prev = data.data?.links?.prev
|
|
2749
|
+
? async () => this.execution.execute(endpointGenerator(data.data?.links?.prev, searchParams), parseData)
|
|
2750
|
+
: null;
|
|
2751
|
+
data.data.next = data.data?.links?.next
|
|
2752
|
+
? async () => this.execution.execute(endpointGenerator(data.data?.links?.next, searchParams), parseData)
|
|
2753
|
+
: null;
|
|
2630
2754
|
data.data.updated_at = data.data.updated_at
|
|
2631
2755
|
? new Date(data.data.updated_at)
|
|
2632
2756
|
: null;
|
|
@@ -2654,54 +2778,54 @@ class TransactionService {
|
|
|
2654
2778
|
return await this.execution.execute(endpoint, parseData);
|
|
2655
2779
|
}
|
|
2656
2780
|
/**
|
|
2657
|
-
*
|
|
2658
|
-
* Commonly used to fetch the earliest and latest transactions, and the transaction count for a wallet. Calculate the age of the wallet and the time it has been idle and quickly gain insights into their engagement with web3.
|
|
2659
2781
|
*
|
|
2660
2782
|
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
|
|
2661
2783
|
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
2662
|
-
* @param {
|
|
2784
|
+
* @param {number} timeBucket - The 0-indexed 15-minute time bucket. E.g. 27 Feb 2023 05:23 GMT = 1677475383 (Unix time). 1677475383/900=1863861 timeBucket.
|
|
2785
|
+
* @param {GetTimeBucketTransactionsForAddressQueryParamOpts} queryParamOpts
|
|
2663
2786
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
2664
|
-
* - `
|
|
2787
|
+
* - `noLogs`: Omit log events.
|
|
2665
2788
|
*
|
|
2666
2789
|
*/
|
|
2667
|
-
async
|
|
2668
|
-
const
|
|
2790
|
+
async getTimeBucketTransactionsForAddress(chainName, walletAddress, timeBucket, queryParamOpts) {
|
|
2791
|
+
const searchParams = [
|
|
2669
2792
|
{
|
|
2670
2793
|
key: "quote-currency",
|
|
2671
2794
|
value: queryParamOpts?.quoteCurrency,
|
|
2672
2795
|
},
|
|
2673
2796
|
{
|
|
2674
|
-
key: "
|
|
2675
|
-
value: queryParamOpts?.
|
|
2797
|
+
key: "no-logs",
|
|
2798
|
+
value: queryParamOpts?.noLogs,
|
|
2676
2799
|
},
|
|
2677
|
-
]
|
|
2800
|
+
];
|
|
2801
|
+
const endpoint = endpointGenerator(`${chainName}/bulk/transactions/${walletAddress}/${timeBucket}`, searchParams);
|
|
2678
2802
|
const parseData = (data) => {
|
|
2679
2803
|
if (data.data) {
|
|
2804
|
+
data.data.prev = data.data?.links?.prev
|
|
2805
|
+
? async () => this.execution.execute(endpointGenerator(data.data?.links?.prev, searchParams), parseData)
|
|
2806
|
+
: null;
|
|
2807
|
+
data.data.next = data.data?.links?.next
|
|
2808
|
+
? async () => this.execution.execute(endpointGenerator(data.data?.links?.next, searchParams), parseData)
|
|
2809
|
+
: null;
|
|
2680
2810
|
data.data.updated_at = data.data.updated_at
|
|
2681
2811
|
? new Date(data.data.updated_at)
|
|
2682
2812
|
: null;
|
|
2683
2813
|
data.data.items = data.data.items
|
|
2684
|
-
? data.data.items.map((
|
|
2685
|
-
...
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
// gas_summary: {
|
|
2700
|
-
// ...txsItem.gas_summary,
|
|
2701
|
-
// total_fees_paid: bigIntParser(
|
|
2702
|
-
// txsItem.gas_summary.total_fees_paid
|
|
2703
|
-
// ),
|
|
2704
|
-
// },
|
|
2814
|
+
? data.data.items.map((txItem) => ({
|
|
2815
|
+
...txItem,
|
|
2816
|
+
value: bigIntParser(txItem.value),
|
|
2817
|
+
fees_paid: bigIntParser(txItem.fees_paid),
|
|
2818
|
+
block_signed_at: txItem.block_signed_at
|
|
2819
|
+
? new Date(txItem.block_signed_at)
|
|
2820
|
+
: null,
|
|
2821
|
+
log_events: txItem.log_events
|
|
2822
|
+
? txItem.log_events.map((logItem) => ({
|
|
2823
|
+
...logItem,
|
|
2824
|
+
block_signed_at: logItem.block_signed_at
|
|
2825
|
+
? new Date(logItem.block_signed_at)
|
|
2826
|
+
: null,
|
|
2827
|
+
}))
|
|
2828
|
+
: null,
|
|
2705
2829
|
}))
|
|
2706
2830
|
: null;
|
|
2707
2831
|
}
|
|
@@ -2710,17 +2834,18 @@ class TransactionService {
|
|
|
2710
2834
|
return await this.execution.execute(endpoint, parseData);
|
|
2711
2835
|
}
|
|
2712
2836
|
/**
|
|
2837
|
+
*
|
|
2838
|
+
* Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
|
|
2713
2839
|
*
|
|
2714
2840
|
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
|
|
2715
|
-
* @param {
|
|
2841
|
+
* @param {number} blockHeight - The requested block height.
|
|
2716
2842
|
* @param {number} page - The requested page, 0-indexed.
|
|
2717
|
-
* @param {
|
|
2843
|
+
* @param {getTransactionsForBlockByPageQueryParamOpts} queryParamOpts
|
|
2718
2844
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
2719
2845
|
* - `noLogs`: Omit log events.
|
|
2720
|
-
* - `blockSignedAtAsc`: Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order.
|
|
2721
2846
|
*
|
|
2722
2847
|
*/
|
|
2723
|
-
async
|
|
2848
|
+
async getTransactionsForBlockByPage(chainName, blockHeight, page, queryParamOpts) {
|
|
2724
2849
|
const searchParams = [
|
|
2725
2850
|
{
|
|
2726
2851
|
key: "quote-currency",
|
|
@@ -2730,23 +2855,19 @@ class TransactionService {
|
|
|
2730
2855
|
key: "no-logs",
|
|
2731
2856
|
value: queryParamOpts?.noLogs,
|
|
2732
2857
|
},
|
|
2733
|
-
{
|
|
2734
|
-
key: "block-signed-at-asc",
|
|
2735
|
-
value: queryParamOpts?.blockSignedAtAsc,
|
|
2736
|
-
},
|
|
2737
2858
|
];
|
|
2738
|
-
const endpoint = endpointGenerator(`${chainName}/
|
|
2859
|
+
const endpoint = endpointGenerator(`${chainName}/block/${blockHeight}/transactions_v3/page/${page}`, searchParams);
|
|
2739
2860
|
const parseData = (data) => {
|
|
2740
2861
|
if (data.data) {
|
|
2862
|
+
data.data.updated_at = data.data.updated_at
|
|
2863
|
+
? new Date(data.data.updated_at)
|
|
2864
|
+
: null;
|
|
2741
2865
|
data.data.prev = data.data?.links?.prev
|
|
2742
2866
|
? async () => this.execution.execute(endpointGenerator(data.data?.links?.prev, searchParams), parseData)
|
|
2743
2867
|
: null;
|
|
2744
2868
|
data.data.next = data.data?.links?.next
|
|
2745
2869
|
? async () => this.execution.execute(endpointGenerator(data.data?.links?.next, searchParams), parseData)
|
|
2746
2870
|
: null;
|
|
2747
|
-
data.data.updated_at = data.data.updated_at
|
|
2748
|
-
? new Date(data.data.updated_at)
|
|
2749
|
-
: null;
|
|
2750
2871
|
data.data.items = data.data.items
|
|
2751
2872
|
? data.data.items.map((txItem) => ({
|
|
2752
2873
|
...txItem,
|
|
@@ -2771,16 +2892,17 @@ class TransactionService {
|
|
|
2771
2892
|
return await this.execution.execute(endpoint, parseData);
|
|
2772
2893
|
}
|
|
2773
2894
|
/**
|
|
2895
|
+
*
|
|
2896
|
+
* Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
|
|
2774
2897
|
*
|
|
2775
2898
|
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
|
|
2776
|
-
* @param {string}
|
|
2777
|
-
* @param {
|
|
2778
|
-
* @param {GetTimeBucketTransactionsForAddressQueryParamOpts} queryParamOpts
|
|
2899
|
+
* @param {string} blockHash - The requested block hash.
|
|
2900
|
+
* @param {getTransactionsForBlockByPageQueryParamOpts} queryParamOpts
|
|
2779
2901
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
2780
2902
|
* - `noLogs`: Omit log events.
|
|
2781
2903
|
*
|
|
2782
2904
|
*/
|
|
2783
|
-
async
|
|
2905
|
+
async getTransactionsForBlock(chainName, blockHash, queryParamOpts) {
|
|
2784
2906
|
const searchParams = [
|
|
2785
2907
|
{
|
|
2786
2908
|
key: "quote-currency",
|
|
@@ -2791,15 +2913,9 @@ class TransactionService {
|
|
|
2791
2913
|
value: queryParamOpts?.noLogs,
|
|
2792
2914
|
},
|
|
2793
2915
|
];
|
|
2794
|
-
const endpoint = endpointGenerator(`${chainName}/
|
|
2916
|
+
const endpoint = endpointGenerator(`${chainName}/block_hash/${blockHash}/transactions_v3`, searchParams);
|
|
2795
2917
|
const parseData = (data) => {
|
|
2796
2918
|
if (data.data) {
|
|
2797
|
-
data.data.prev = data.data?.links?.prev
|
|
2798
|
-
? async () => this.execution.execute(endpointGenerator(data.data?.links?.prev, searchParams), parseData)
|
|
2799
|
-
: null;
|
|
2800
|
-
data.data.next = data.data?.links?.next
|
|
2801
|
-
? async () => this.execution.execute(endpointGenerator(data.data?.links?.next, searchParams), parseData)
|
|
2802
|
-
: null;
|
|
2803
2919
|
data.data.updated_at = data.data.updated_at
|
|
2804
2920
|
? new Date(data.data.updated_at)
|
|
2805
2921
|
: null;
|
|
@@ -2826,6 +2942,12 @@ class TransactionService {
|
|
|
2826
2942
|
};
|
|
2827
2943
|
return await this.execution.execute(endpoint, parseData);
|
|
2828
2944
|
}
|
|
2945
|
+
/**
|
|
2946
|
+
* @deprecated This method has been deprecated and will be removed in future releases. Use `getPaginatedTransactionsForAddress` instead.
|
|
2947
|
+
*/
|
|
2948
|
+
async getTransactionsForAddressV3(chainName, walletAddress, page, queryParamOpts) {
|
|
2949
|
+
return this.getPaginatedTransactionsForAddress(chainName, walletAddress, page, queryParamOpts);
|
|
2950
|
+
}
|
|
2829
2951
|
}
|
|
2830
2952
|
|
|
2831
2953
|
async function debugOutput(settings, ...content) {
|