@covalenthq/client-sdk 0.0.9 → 0.1.1
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/dist/ApprovalService.d.ts +1 -1
- package/dist/ApprovalService.js +12 -5
- package/dist/ApprovalService.js.map +1 -1
- package/dist/BalancesService.d.ts +4 -4
- package/dist/BalancesService.js +48 -20
- package/dist/BalancesService.js.map +1 -1
- package/dist/BaseService.d.ts +1 -1
- package/dist/BaseService.js +67 -25
- package/dist/BaseService.js.map +1 -1
- package/dist/LogEventService.js +11 -4
- package/dist/LogEventService.js.map +1 -1
- package/dist/NameResolverService.d.ts +1 -1
- package/dist/NameResolverService.js +12 -5
- package/dist/NameResolverService.js.map +1 -1
- package/dist/NftService.d.ts +16 -14
- package/dist/NftService.js +143 -58
- package/dist/NftService.js.map +1 -1
- package/dist/PricingService.d.ts +1 -1
- package/dist/PricingService.js +12 -5
- package/dist/PricingService.js.map +1 -1
- package/dist/TransactionsService.d.ts +9 -9
- package/dist/TransactionsService.js +53 -25
- package/dist/TransactionsService.js.map +1 -1
- package/dist/XykService.d.ts +4 -4
- package/dist/XykService.js +125 -48
- package/dist/XykService.js.map +1 -1
- package/package.json +1 -1
|
@@ -51,7 +51,7 @@ export declare class ApprovalService {
|
|
|
51
51
|
/**
|
|
52
52
|
*
|
|
53
53
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
54
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
54
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
55
55
|
*
|
|
56
56
|
*/
|
|
57
57
|
getApprovals(chainName: "btc-mainnet" | "eth-mainnet" | "matic-mainnet" | "bsc-mainnet" | "avalanche-mainnet" | "fantom-mainnet" | "moonbeam-mainnet" | "moonbeam-moonriver" | "rsk-mainnet" | "arbitrum-mainnet" | "palm-mainnet" | "klaytn-mainnet" | "heco-mainnet" | "nervos-godwoken-mainnet" | "axie-mainnet" | "evmos-mainnet" | "astar-mainnet" | "iotex-mainnet" | "harmony-mainnet" | "cronos-mainnet" | "aurora-mainnet" | "emerald-paratime-mainnet" | "boba-mainnet" | "eth-goerli" | "matic-mumbai" | "avalanche-testnet" | "bsc-testnet" | "moonbeam-moonbase-alpha" | "rsk-testnet" | "arbitrum-goerli" | "fantom-testnet" | "palm-testnet" | "heco-testnet" | "nervos-godwoken-testnet" | "evmos-testnet" | "astar-shiden" | "iotex-testnet" | "harmony-testnet" | "aurora-testnet" | "scroll-l2-testnet" | "scroll-l1-testnet" | "covalent-internal-network-v1" | "defi-kingdoms-mainnet" | "swimmer-mainnet" | "boba-avalanche-mainnet" | "boba-bobabeam-mainnet" | "boba-bnb-mainnet" | "boba-rinkeby-testnet" | "boba-bobabase-testnet" | "boba-bnb-testnet" | "boba-avalanche-testnet" | "klaytn-testnet" | "gather-mainnet" | "gather-testnet" | "optimism-mainnet" | "skale-calypso" | "skale-mainnet" | "skale-razor" | "avalanche-dexalot-mainnet" | "skale-omnus" | "avalanche-dexalot-testnet" | "astar-shibuya" | "cronos-testnet" | "defi-kingdoms-testnet" | "metis-mainnet" | "metis-testnet" | "milkomeda-a1-mainnet" | "milkomeda-a1-devnet" | "milkomeda-c1-mainnet" | "milkomeda-c1-devnet" | "swimmer-testnet" | "solana-mainnet" | "skale-europa" | "meter-mainnet" | "meter-testnet" | "skale-exorde" | "boba-goerli" | "neon-testnet" | "skale-staging-uum" | "skale-staging-lcc" | "arbitrum-nova-mainnet" | "canto-mainnet" | "bittorrent-mainnet" | "bittorrent-testnet" | "flarenetworks-flare-mainnet" | "flarenetworks-flare-testnet" | "flarenetworks-canary-mainnet" | "flarenetworks-canary-testnet" | "kcc-mainnet" | "kcc-testnet" | "polygon-zkevm-testnet" | "linea-testnet" | "base-testnet" | "mantle-testnet" | "scroll-alpha-testnet" | "oasys-mainnet" | "oasys-testnet" | "findora-mainnet" | "findora-forge-testnet" | "sx-mainnet", walletAddress: string): Promise<Response<ApprovalsResponse>>;
|
package/dist/ApprovalService.js
CHANGED
|
@@ -9,12 +9,13 @@ class ApprovalService {
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
12
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
12
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
async getApprovals(chainName, walletAddress) {
|
|
16
|
-
let retryCount =
|
|
16
|
+
let retryCount = 1;
|
|
17
17
|
let success = false;
|
|
18
|
+
const maxRetries = 5;
|
|
18
19
|
while (!success) {
|
|
19
20
|
try {
|
|
20
21
|
const urlParams = new URLSearchParams();
|
|
@@ -25,9 +26,15 @@ class ApprovalService {
|
|
|
25
26
|
});
|
|
26
27
|
const data = await response.json();
|
|
27
28
|
if (data.error && data.error_code === 429) {
|
|
28
|
-
retryCount
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (retryCount < maxRetries) {
|
|
30
|
+
retryCount++;
|
|
31
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
32
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
success = true;
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
39
|
else {
|
|
33
40
|
success = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApprovalService.js","sourceRoot":"","sources":["../src/services/ApprovalService.ts"],"names":[],"mappings":";;;AAkDA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,6BAA6B;
|
|
1
|
+
{"version":3,"file":"ApprovalService.js","s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gBACZ,OAAO,GAAG,IAAI,CAAC;gBACf,OAAO,KAAK,CAAC,OAAO,CAAC;aACxB;SACJ;IACL,CAAC;CAGJ;AA/CD,0CA+CC"}
|
|
@@ -146,7 +146,7 @@ export declare class BalancesService {
|
|
|
146
146
|
/**
|
|
147
147
|
*
|
|
148
148
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
149
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
149
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
150
150
|
* @param {string} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
151
151
|
* @param {boolean} nft - If `true`, NFTs will be included in the response.
|
|
152
152
|
* @param {boolean} noNftFetch - If `true`, only NFTs that have been cached will be included in the response. Helpful for faster response times.
|
|
@@ -158,7 +158,7 @@ export declare class BalancesService {
|
|
|
158
158
|
/**
|
|
159
159
|
*
|
|
160
160
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
161
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
161
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
162
162
|
* @param {string} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
163
163
|
* @param {number} days - The number of days to return data for. Defaults to 30 days.
|
|
164
164
|
*
|
|
@@ -167,7 +167,7 @@ export declare class BalancesService {
|
|
|
167
167
|
/**
|
|
168
168
|
*
|
|
169
169
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
170
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
170
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
171
171
|
* @param {string} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
172
172
|
* @param {string} contractAddress - The requested contract address.
|
|
173
173
|
* @param {number} startingBlock - The block height to start from, defaults to `0`.
|
|
@@ -178,7 +178,7 @@ export declare class BalancesService {
|
|
|
178
178
|
/**
|
|
179
179
|
*
|
|
180
180
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
181
|
-
* @param {string} tokenAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
181
|
+
* @param {string} tokenAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
182
182
|
* @param {number} blockHeight - Ending block to define a block range. Omitting this parameter defaults to the latest block height.
|
|
183
183
|
* @param {number} pageSize - Number of items per page. Note: Currently, only values of `100` and `1000` are supported. Omitting this parameter defaults to 100.
|
|
184
184
|
* @param {number} pageNumber - 0-indexed page number to begin pagination.
|
package/dist/BalancesService.js
CHANGED
|
@@ -9,7 +9,7 @@ class BalancesService {
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
12
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
12
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
13
13
|
* @param {string} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
14
14
|
* @param {boolean} nft - If `true`, NFTs will be included in the response.
|
|
15
15
|
* @param {boolean} noNftFetch - If `true`, only NFTs that have been cached will be included in the response. Helpful for faster response times.
|
|
@@ -18,8 +18,9 @@ class BalancesService {
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
async getTokenBalances(chainName, walletAddress, quoteCurrency, nft, noNftFetch, noSpam, noNftAssetMetadata) {
|
|
21
|
-
let retryCount =
|
|
21
|
+
let retryCount = 1;
|
|
22
22
|
let success = false;
|
|
23
|
+
const maxRetries = 5;
|
|
23
24
|
while (!success) {
|
|
24
25
|
try {
|
|
25
26
|
const urlParams = new URLSearchParams();
|
|
@@ -45,9 +46,15 @@ class BalancesService {
|
|
|
45
46
|
});
|
|
46
47
|
const data = await response.json();
|
|
47
48
|
if (data.error && data.error_code === 429) {
|
|
48
|
-
retryCount
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
if (retryCount < maxRetries) {
|
|
50
|
+
retryCount++;
|
|
51
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
52
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
success = true;
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
51
58
|
}
|
|
52
59
|
else {
|
|
53
60
|
success = true;
|
|
@@ -63,14 +70,15 @@ class BalancesService {
|
|
|
63
70
|
/**
|
|
64
71
|
*
|
|
65
72
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
66
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
73
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
67
74
|
* @param {string} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
68
75
|
* @param {number} days - The number of days to return data for. Defaults to 30 days.
|
|
69
76
|
*
|
|
70
77
|
*/
|
|
71
78
|
async getAddressPortfolio(chainName, walletAddress, quoteCurrency, days) {
|
|
72
|
-
let retryCount =
|
|
79
|
+
let retryCount = 1;
|
|
73
80
|
let success = false;
|
|
81
|
+
const maxRetries = 5;
|
|
74
82
|
while (!success) {
|
|
75
83
|
try {
|
|
76
84
|
const urlParams = new URLSearchParams();
|
|
@@ -87,9 +95,15 @@ class BalancesService {
|
|
|
87
95
|
});
|
|
88
96
|
const data = await response.json();
|
|
89
97
|
if (data.error && data.error_code === 429) {
|
|
90
|
-
retryCount
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
if (retryCount < maxRetries) {
|
|
99
|
+
retryCount++;
|
|
100
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
101
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
success = true;
|
|
105
|
+
return data;
|
|
106
|
+
}
|
|
93
107
|
}
|
|
94
108
|
else {
|
|
95
109
|
success = true;
|
|
@@ -105,7 +119,7 @@ class BalancesService {
|
|
|
105
119
|
/**
|
|
106
120
|
*
|
|
107
121
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
108
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
122
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
109
123
|
* @param {string} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
110
124
|
* @param {string} contractAddress - The requested contract address.
|
|
111
125
|
* @param {number} startingBlock - The block height to start from, defaults to `0`.
|
|
@@ -113,8 +127,9 @@ class BalancesService {
|
|
|
113
127
|
*
|
|
114
128
|
*/
|
|
115
129
|
async getErc20Transfers(chainName, walletAddress, quoteCurrency, contractAddress, startingBlock, endingBlock) {
|
|
116
|
-
let retryCount =
|
|
130
|
+
let retryCount = 1;
|
|
117
131
|
let success = false;
|
|
132
|
+
const maxRetries = 5;
|
|
118
133
|
while (!success) {
|
|
119
134
|
try {
|
|
120
135
|
const urlParams = new URLSearchParams();
|
|
@@ -137,9 +152,15 @@ class BalancesService {
|
|
|
137
152
|
});
|
|
138
153
|
const data = await response.json();
|
|
139
154
|
if (data.error && data.error_code === 429) {
|
|
140
|
-
retryCount
|
|
141
|
-
|
|
142
|
-
|
|
155
|
+
if (retryCount < maxRetries) {
|
|
156
|
+
retryCount++;
|
|
157
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
158
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
success = true;
|
|
162
|
+
return data;
|
|
163
|
+
}
|
|
143
164
|
}
|
|
144
165
|
else {
|
|
145
166
|
success = true;
|
|
@@ -155,15 +176,16 @@ class BalancesService {
|
|
|
155
176
|
/**
|
|
156
177
|
*
|
|
157
178
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
158
|
-
* @param {string} tokenAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
179
|
+
* @param {string} tokenAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
159
180
|
* @param {number} blockHeight - Ending block to define a block range. Omitting this parameter defaults to the latest block height.
|
|
160
181
|
* @param {number} pageSize - Number of items per page. Note: Currently, only values of `100` and `1000` are supported. Omitting this parameter defaults to 100.
|
|
161
182
|
* @param {number} pageNumber - 0-indexed page number to begin pagination.
|
|
162
183
|
*
|
|
163
184
|
*/
|
|
164
185
|
async getTokenHoldersV2(chainName, tokenAddress, blockHeight, pageSize, pageNumber) {
|
|
165
|
-
let retryCount =
|
|
186
|
+
let retryCount = 1;
|
|
166
187
|
let success = false;
|
|
188
|
+
const maxRetries = 5;
|
|
167
189
|
while (!success) {
|
|
168
190
|
try {
|
|
169
191
|
const urlParams = new URLSearchParams();
|
|
@@ -183,9 +205,15 @@ class BalancesService {
|
|
|
183
205
|
});
|
|
184
206
|
const data = await response.json();
|
|
185
207
|
if (data.error && data.error_code === 429) {
|
|
186
|
-
retryCount
|
|
187
|
-
|
|
188
|
-
|
|
208
|
+
if (retryCount < maxRetries) {
|
|
209
|
+
retryCount++;
|
|
210
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
211
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
success = true;
|
|
215
|
+
return data;
|
|
216
|
+
}
|
|
189
217
|
}
|
|
190
218
|
else {
|
|
191
219
|
success = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BalancesService.js","sourceRoot":"","sources":["../src/services/BalancesService.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"BalancesService.js","sourceRoot":"","sources":["../src/services/BalancesService.ts"],"names":[],"mappings":";;;AAyJA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,6BAA6B;AAIvD,MAAa,eAAe;IACxB,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAClC,CAAC;IAGD;;;;;;;;;;OAUG;IACI,KAAK,CAAC,gBAAgB,CAAC,SAAkjE,EAAE,aAAqB,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U,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;qBAChE;yBAAM;wBACH,OAAO,GAAG,IAAI,CAAC;wBACf,OAAO,IAAI,CAAC;qBACf;iBACJ;qBAAM;oBACH,OAAO,GAAG,IAAI,CAAC;oBACf,OAAO,IAAI,CAAC;iBACf;aACJ;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,GAAG,IAAI,CAAC;gBACf,OAAO,KAAK,CAAC,OAAO,CAAC;aACxB;SACJ;IACL,CAAC;CAGJ;AAhPD,0CAgPC"}
|
package/dist/BaseService.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export declare class BaseService {
|
|
|
137
137
|
/**
|
|
138
138
|
*
|
|
139
139
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
140
|
-
* @param {string} contractAddress - The endpoint will return event logs emitted from this contract address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
140
|
+
* @param {string} contractAddress - The endpoint will return event logs emitted from this contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
141
141
|
* @param {number} startingBlock - The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
|
|
142
142
|
* @param {string} endingBlock - The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
|
|
143
143
|
*
|
package/dist/BaseService.js
CHANGED
|
@@ -13,8 +13,9 @@ class BaseService {
|
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
async getBlock(chainName, blockHeight) {
|
|
16
|
-
let retryCount =
|
|
16
|
+
let retryCount = 1;
|
|
17
17
|
let success = false;
|
|
18
|
+
const maxRetries = 5;
|
|
18
19
|
while (!success) {
|
|
19
20
|
try {
|
|
20
21
|
const urlParams = new URLSearchParams();
|
|
@@ -25,9 +26,15 @@ class BaseService {
|
|
|
25
26
|
});
|
|
26
27
|
const data = await response.json();
|
|
27
28
|
if (data.error && data.error_code === 429) {
|
|
28
|
-
retryCount
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (retryCount < maxRetries) {
|
|
30
|
+
retryCount++;
|
|
31
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
32
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
success = true;
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
39
|
else {
|
|
33
40
|
success = true;
|
|
@@ -48,8 +55,9 @@ class BaseService {
|
|
|
48
55
|
*
|
|
49
56
|
*/
|
|
50
57
|
async getBlockHeights(chainName, startDate, endDate) {
|
|
51
|
-
let retryCount =
|
|
58
|
+
let retryCount = 1;
|
|
52
59
|
let success = false;
|
|
60
|
+
const maxRetries = 5;
|
|
53
61
|
while (!success) {
|
|
54
62
|
try {
|
|
55
63
|
const urlParams = new URLSearchParams();
|
|
@@ -60,9 +68,15 @@ class BaseService {
|
|
|
60
68
|
});
|
|
61
69
|
const data = await response.json();
|
|
62
70
|
if (data.error && data.error_code === 429) {
|
|
63
|
-
retryCount
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
if (retryCount < maxRetries) {
|
|
72
|
+
retryCount++;
|
|
73
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
74
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
success = true;
|
|
78
|
+
return data;
|
|
79
|
+
}
|
|
66
80
|
}
|
|
67
81
|
else {
|
|
68
82
|
success = true;
|
|
@@ -78,14 +92,15 @@ class BaseService {
|
|
|
78
92
|
/**
|
|
79
93
|
*
|
|
80
94
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
81
|
-
* @param {string} contractAddress - The endpoint will return event logs emitted from this contract address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
95
|
+
* @param {string} contractAddress - The endpoint will return event logs emitted from this contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
82
96
|
* @param {number} startingBlock - The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
|
|
83
97
|
* @param {string} endingBlock - The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`.
|
|
84
98
|
*
|
|
85
99
|
*/
|
|
86
100
|
async getLogEventsByAddress(chainName, contractAddress, startingBlock, endingBlock) {
|
|
87
|
-
let retryCount =
|
|
101
|
+
let retryCount = 1;
|
|
88
102
|
let success = false;
|
|
103
|
+
const maxRetries = 5;
|
|
89
104
|
while (!success) {
|
|
90
105
|
try {
|
|
91
106
|
const urlParams = new URLSearchParams();
|
|
@@ -102,9 +117,15 @@ class BaseService {
|
|
|
102
117
|
});
|
|
103
118
|
const data = await response.json();
|
|
104
119
|
if (data.error && data.error_code === 429) {
|
|
105
|
-
retryCount
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
if (retryCount < maxRetries) {
|
|
121
|
+
retryCount++;
|
|
122
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
123
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
success = true;
|
|
127
|
+
return data;
|
|
128
|
+
}
|
|
108
129
|
}
|
|
109
130
|
else {
|
|
110
131
|
success = true;
|
|
@@ -127,8 +148,9 @@ class BaseService {
|
|
|
127
148
|
*
|
|
128
149
|
*/
|
|
129
150
|
async getLogEventsByTopicHash(chainName, topicHash, startingBlock, endingBlock, secondaryTopics) {
|
|
130
|
-
let retryCount =
|
|
151
|
+
let retryCount = 1;
|
|
131
152
|
let success = false;
|
|
153
|
+
const maxRetries = 5;
|
|
132
154
|
while (!success) {
|
|
133
155
|
try {
|
|
134
156
|
const urlParams = new URLSearchParams();
|
|
@@ -148,9 +170,15 @@ class BaseService {
|
|
|
148
170
|
});
|
|
149
171
|
const data = await response.json();
|
|
150
172
|
if (data.error && data.error_code === 429) {
|
|
151
|
-
retryCount
|
|
152
|
-
|
|
153
|
-
|
|
173
|
+
if (retryCount < maxRetries) {
|
|
174
|
+
retryCount++;
|
|
175
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
176
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
success = true;
|
|
180
|
+
return data;
|
|
181
|
+
}
|
|
154
182
|
}
|
|
155
183
|
else {
|
|
156
184
|
success = true;
|
|
@@ -169,8 +197,9 @@ class BaseService {
|
|
|
169
197
|
*
|
|
170
198
|
*/
|
|
171
199
|
async getAllChains() {
|
|
172
|
-
let retryCount =
|
|
200
|
+
let retryCount = 1;
|
|
173
201
|
let success = false;
|
|
202
|
+
const maxRetries = 5;
|
|
174
203
|
while (!success) {
|
|
175
204
|
try {
|
|
176
205
|
const urlParams = new URLSearchParams();
|
|
@@ -181,9 +210,15 @@ class BaseService {
|
|
|
181
210
|
});
|
|
182
211
|
const data = await response.json();
|
|
183
212
|
if (data.error && data.error_code === 429) {
|
|
184
|
-
retryCount
|
|
185
|
-
|
|
186
|
-
|
|
213
|
+
if (retryCount < maxRetries) {
|
|
214
|
+
retryCount++;
|
|
215
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
216
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
success = true;
|
|
220
|
+
return data;
|
|
221
|
+
}
|
|
187
222
|
}
|
|
188
223
|
else {
|
|
189
224
|
success = true;
|
|
@@ -202,8 +237,9 @@ class BaseService {
|
|
|
202
237
|
*
|
|
203
238
|
*/
|
|
204
239
|
async getAllChainStatus() {
|
|
205
|
-
let retryCount =
|
|
240
|
+
let retryCount = 1;
|
|
206
241
|
let success = false;
|
|
242
|
+
const maxRetries = 5;
|
|
207
243
|
while (!success) {
|
|
208
244
|
try {
|
|
209
245
|
const urlParams = new URLSearchParams();
|
|
@@ -214,9 +250,15 @@ class BaseService {
|
|
|
214
250
|
});
|
|
215
251
|
const data = await response.json();
|
|
216
252
|
if (data.error && data.error_code === 429) {
|
|
217
|
-
retryCount
|
|
218
|
-
|
|
219
|
-
|
|
253
|
+
if (retryCount < maxRetries) {
|
|
254
|
+
retryCount++;
|
|
255
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
256
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
success = true;
|
|
260
|
+
return data;
|
|
261
|
+
}
|
|
220
262
|
}
|
|
221
263
|
else {
|
|
222
264
|
success = true;
|
package/dist/BaseService.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseService.js","sourceRoot":"","sources":["../src/services/BaseService.ts"],"names":[],"mappings":";;;AAyHA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,6BAA6B;
|
|
1
|
+
{"version":3,"file":"BaseService.js","sourceRoot":"","sources":["../src/services/BaseService.ts"],"names":[],"mappings":";;;AAyHA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,6BAA6B;AAIvD,MAAa,WAAW;IACpB,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAClC,CAAC;IAGD;;;;;OAKG;IACI,KAAK,CAAC,QAAQ,CAAC,SAAkjE,EAAE,WAAmB;QACzlE,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,OAAO,CAAC,OAAO,EAAE;YACb,IAAI;gBACA,MAAM,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;gBAGxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iCAAi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G,KAAK,CAAC;QACpB,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,OAAO,CAAC,OAAO,EAAE;YACb,IAAI;gBACA,MAAM,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;gBAGxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,gDAAgD,SAAS,EAAE,EAAE;oBACtF,OAAO,EAAE;wBACL,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;qBAC3C;iBACJ,CAAC,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,UAAU,KAAK,GAAG,EAAE;oBACvC,IAAI,UAAU,GAAG,UAAU,EAAE;wBACzB,UAAU,EAAE,CAAC;wBACb,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,WAAW,CAAC,CAAC,gCAAgC;wBACvF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;qBAChE;yBAAM;wBACH,OAAO,GAAG,IAAI,CAAC;wBACf,OAAO,IAAI,CAAC;qBACf;iBACJ;qBAAM;oBACH,OAAO,GAAG,IAAI,CAAC;oBACf,OAAO,IAAI,CAAC;iBACf;aACJ;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,GAAG,IAAI,CAAC;gBACf,OAAO,KAAK,CAAC,OAAO,CAAC;aACxB;SACJ;IACL,CAAC;CAGJ;AApRD,kCAoRC"}
|
package/dist/LogEventService.js
CHANGED
|
@@ -18,8 +18,9 @@ class LogEventService {
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
async getLogs(chainName, startingBlock, endingBlock, address, topics, blockHash, skipDecode) {
|
|
21
|
-
let retryCount =
|
|
21
|
+
let retryCount = 1;
|
|
22
22
|
let success = false;
|
|
23
|
+
const maxRetries = 5;
|
|
23
24
|
while (!success) {
|
|
24
25
|
try {
|
|
25
26
|
const urlParams = new URLSearchParams();
|
|
@@ -48,9 +49,15 @@ class LogEventService {
|
|
|
48
49
|
});
|
|
49
50
|
const data = await response.json();
|
|
50
51
|
if (data.error && data.error_code === 429) {
|
|
51
|
-
retryCount
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if (retryCount < maxRetries) {
|
|
53
|
+
retryCount++;
|
|
54
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
55
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
success = true;
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
62
|
else {
|
|
56
63
|
success = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogEventService.js","sourceRoot":"","sources":["../src/services/LogEventService.ts"],"names":[],"mappings":";;;AAgDA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,6BAA6B;
|
|
1
|
+
{"version":3,"file":"LogEventService.js","sourceRoot":"","sources":["../src/services/LogEventService.ts"],"names":[],"mappings":";;;AAgDA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,6BAA6B;AAIvD,MAAa,eAAe;IACxB,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAClC,CAAC;IAGD;;;;;;;;;;OAUG;IACI,KAAK,CAAC,OAAO,CAAC,SAAkjE,EAAE,aAAsB,EAAE,WAAoB,EAAE,OAAgB,EAAE,MAAe,EAAE,SAAkB,EAAE,UAAoB;QAC9rE,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,OAAO,CAAC,OAAO,EAAE;YACb,IAAI;gBACA,MAAM,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;gBAEx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BACvF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;qBAChE;yBAAM;wBACH,OAAO,GAAG,IAAI,CAAC;wBACf,OAAO,IAAI,CAAC;qBACf;iBACJ;qBAAM;oBACH,OAAO,GAAG,IAAI,CAAC;oBACf,OAAO,IAAI,CAAC;iBACf;aACJ;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,GAAG,IAAI,CAAC;gBACf,OAAO,KAAK,CAAC,OAAO,CAAC;aACxB;SACJ;IACL,CAAC;CAGJ;AA5ED,0CA4EC"}
|
|
@@ -25,7 +25,7 @@ export declare class NameResolverService {
|
|
|
25
25
|
/**
|
|
26
26
|
*
|
|
27
27
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
28
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
28
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
29
29
|
*
|
|
30
30
|
*/
|
|
31
31
|
getResolvedAddress(chainName: "btc-mainnet" | "eth-mainnet" | "matic-mainnet" | "bsc-mainnet" | "avalanche-mainnet" | "fantom-mainnet" | "moonbeam-mainnet" | "moonbeam-moonriver" | "rsk-mainnet" | "arbitrum-mainnet" | "palm-mainnet" | "klaytn-mainnet" | "heco-mainnet" | "nervos-godwoken-mainnet" | "axie-mainnet" | "evmos-mainnet" | "astar-mainnet" | "iotex-mainnet" | "harmony-mainnet" | "cronos-mainnet" | "aurora-mainnet" | "emerald-paratime-mainnet" | "boba-mainnet" | "eth-goerli" | "matic-mumbai" | "avalanche-testnet" | "bsc-testnet" | "moonbeam-moonbase-alpha" | "rsk-testnet" | "arbitrum-goerli" | "fantom-testnet" | "palm-testnet" | "heco-testnet" | "nervos-godwoken-testnet" | "evmos-testnet" | "astar-shiden" | "iotex-testnet" | "harmony-testnet" | "aurora-testnet" | "scroll-l2-testnet" | "scroll-l1-testnet" | "covalent-internal-network-v1" | "defi-kingdoms-mainnet" | "swimmer-mainnet" | "boba-avalanche-mainnet" | "boba-bobabeam-mainnet" | "boba-bnb-mainnet" | "boba-rinkeby-testnet" | "boba-bobabase-testnet" | "boba-bnb-testnet" | "boba-avalanche-testnet" | "klaytn-testnet" | "gather-mainnet" | "gather-testnet" | "optimism-mainnet" | "skale-calypso" | "skale-mainnet" | "skale-razor" | "avalanche-dexalot-mainnet" | "skale-omnus" | "avalanche-dexalot-testnet" | "astar-shibuya" | "cronos-testnet" | "defi-kingdoms-testnet" | "metis-mainnet" | "metis-testnet" | "milkomeda-a1-mainnet" | "milkomeda-a1-devnet" | "milkomeda-c1-mainnet" | "milkomeda-c1-devnet" | "swimmer-testnet" | "solana-mainnet" | "skale-europa" | "meter-mainnet" | "meter-testnet" | "skale-exorde" | "boba-goerli" | "neon-testnet" | "skale-staging-uum" | "skale-staging-lcc" | "arbitrum-nova-mainnet" | "canto-mainnet" | "bittorrent-mainnet" | "bittorrent-testnet" | "flarenetworks-flare-mainnet" | "flarenetworks-flare-testnet" | "flarenetworks-canary-mainnet" | "flarenetworks-canary-testnet" | "kcc-mainnet" | "kcc-testnet" | "polygon-zkevm-testnet" | "linea-testnet" | "base-testnet" | "mantle-testnet" | "scroll-alpha-testnet" | "oasys-mainnet" | "oasys-testnet" | "findora-mainnet" | "findora-forge-testnet" | "sx-mainnet", walletAddress: string): Promise<Response<ResolvedAddress>>;
|
|
@@ -9,12 +9,13 @@ class NameResolverService {
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
12
|
-
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, or an `Unstoppable Domain` resolves automatically.
|
|
12
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
async getResolvedAddress(chainName, walletAddress) {
|
|
16
|
-
let retryCount =
|
|
16
|
+
let retryCount = 1;
|
|
17
17
|
let success = false;
|
|
18
|
+
const maxRetries = 5;
|
|
18
19
|
while (!success) {
|
|
19
20
|
try {
|
|
20
21
|
const urlParams = new URLSearchParams();
|
|
@@ -25,9 +26,15 @@ class NameResolverService {
|
|
|
25
26
|
});
|
|
26
27
|
const data = await response.json();
|
|
27
28
|
if (data.error && data.error_code === 429) {
|
|
28
|
-
retryCount
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (retryCount < maxRetries) {
|
|
30
|
+
retryCount++;
|
|
31
|
+
const delayMs = Math.pow(2, retryCount) * baseDelayMs; // Exponential delay calculation
|
|
32
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
success = true;
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
39
|
else {
|
|
33
40
|
success = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NameResolverService.js","sourceRoot":"","sources":["../src/services/NameResolverService.ts"],"names":[],"mappings":";;;AAwBA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,6BAA6B;
|
|
1
|
+
{"version":3,"file":"NameResolverService.js","sourceRoot":"","sources":["../src/services/NameResolverService.ts"],"names":[],"mappings":";;;AAwBA,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,6BAA6B;AAIvD,MAAa,mBAAmB;IAC5B,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAClC,CAAC;IAGD;;;;;OAKG;IACI,KAAK,CAAC,kBAAkB,CAAC,SAAkjE,EAAE,aAAqB;QACrmE,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,OAAO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