@riocrypto/common-server 1.0.619 → 1.0.620
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.
|
@@ -2,6 +2,6 @@ import { AxiosInstance, AxiosStatic } from "axios";
|
|
|
2
2
|
export declare class EtherscanClient {
|
|
3
3
|
private axios;
|
|
4
4
|
constructor(axios: AxiosStatic | AxiosInstance);
|
|
5
|
-
getTransactions(address: string): Promise<any[]>;
|
|
6
|
-
getTokenTransactions(contractAddress: string, address: string): Promise<any[]>;
|
|
5
|
+
getTransactions(address: string, page: string, offset: string): Promise<any[]>;
|
|
6
|
+
getTokenTransactions(contractAddress: string, address: string, page: string, offset: string): Promise<any[]>;
|
|
7
7
|
}
|
|
@@ -15,23 +15,23 @@ class EtherscanClient {
|
|
|
15
15
|
constructor(axios) {
|
|
16
16
|
this.axios = axios;
|
|
17
17
|
}
|
|
18
|
-
getTransactions(address) {
|
|
18
|
+
getTransactions(address, page, offset) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
const ETHERSCAN_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("ETHERSCAN_API_KEY");
|
|
21
21
|
if (!ETHERSCAN_API_KEY) {
|
|
22
22
|
throw new Error("Unable to get ETHERSCAN_API_KEY");
|
|
23
23
|
}
|
|
24
|
-
const { data } = yield this.axios.get(`https://api.etherscan.io/api?module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&page
|
|
24
|
+
const { data } = yield this.axios.get(`https://api.etherscan.io/api?module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&page=${page}&offset=${offset}&sort=asc&apikey=${ETHERSCAN_API_KEY}`);
|
|
25
25
|
return data.result;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
getTokenTransactions(contractAddress, address) {
|
|
28
|
+
getTokenTransactions(contractAddress, address, page, offset) {
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
const ETHERSCAN_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("ETHERSCAN_API_KEY");
|
|
31
31
|
if (!ETHERSCAN_API_KEY) {
|
|
32
32
|
throw new Error("Unable to get ETHERSCAN_API_KEY");
|
|
33
33
|
}
|
|
34
|
-
const { data } = yield this.axios.get(`https://api.etherscan.io/api?module=account&action=tokentx&contractaddress=${contractAddress}&address=${address}&startblock=0&endblock=99999999&page
|
|
34
|
+
const { data } = yield this.axios.get(`https://api.etherscan.io/api?module=account&action=tokentx&contractaddress=${contractAddress}&address=${address}&startblock=0&endblock=99999999&page=${page}&offset=${offset}&sort=asc&apikey=${ETHERSCAN_API_KEY}`);
|
|
35
35
|
return data.result;
|
|
36
36
|
});
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.620",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
25
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
26
26
|
"@google-cloud/storage": "^6.9.5",
|
|
27
|
-
"@riocrypto/common": "^1.0.
|
|
27
|
+
"@riocrypto/common": "^1.0.585",
|
|
28
28
|
"@types/express": "^4.17.13",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"ccxt": "^3.0.30",
|