@pioneer-platform/eth-network 8.6.0 → 8.6.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.
@@ -1,58 +0,0 @@
1
- import { GasOracleResponse, TransactionHistoryParam, TokenBalanceParam } from './types';
2
- import { BigNumberish } from 'ethers';
3
- import { Txs } from '@xchainjs/xchain-client/lib';
4
- /**
5
- * SafeGasPrice, ProposeGasPrice And FastGasPrice returned in string-Gwei
6
- *
7
- * @see https://etherscan.io/apis#gastracker
8
- *
9
- * @param {string} baseUrl The etherscan node url.
10
- * @param {string} apiKey The etherscan API key. (optional)
11
- * @returns {GasOracleResponse} LastBlock, SafeGasPrice, ProposeGasPrice, FastGasPrice
12
- */
13
- export declare const getGasOracle: (baseUrl: string, apiKey?: string) => Promise<GasOracleResponse>;
14
- /**
15
- * Get token balance
16
- *
17
- * @see https://etherscan.io/apis#tokens
18
- *
19
- * @param {string} baseUrl The etherscan node url.
20
- * @param {string} address The address.
21
- * @param {string} assetAddress The token contract address.
22
- * @param {string} apiKey The etherscan API key. (optional)
23
- * @returns {BigNumberish} The token balance
24
- */
25
- export declare const getTokenBalance: ({ baseUrl, address, assetAddress, apiKey, }: TokenBalanceParam & {
26
- baseUrl: string;
27
- apiKey?: string;
28
- }) => Promise<BigNumberish>;
29
- /**
30
- * Get ETH transaction history
31
- *
32
- * @see https://etherscan.io/apis#accounts
33
- *
34
- * @param {string} baseUrl The etherscan node url.
35
- * @param {string} address The address.
36
- * @param {TransactionHistoryParam} params The search options.
37
- * @param {string} apiKey The etherscan API key. (optional)
38
- * @returns {Array<ETHTransactionInfo>} The ETH transaction history
39
- */
40
- export declare const getETHTransactionHistory: ({ baseUrl, address, page, offset, startblock, endblock, apiKey, }: TransactionHistoryParam & {
41
- baseUrl: string;
42
- apiKey?: string;
43
- }) => Promise<Txs>;
44
- /**
45
- * Get token transaction history
46
- *
47
- * @see https://etherscan.io/apis#accounts
48
- *
49
- * @param {string} baseUrl The etherscan node url.
50
- * @param {string} address The address.
51
- * @param {TransactionHistoryParam} params The search options.
52
- * @param {string} apiKey The etherscan API key. (optional)
53
- * @returns {Array<Txs>} The token transaction history
54
- */
55
- export declare const getTokenTransactionHistory: ({ baseUrl, address, assetAddress, page, offset, startblock, endblock, apiKey, }: TransactionHistoryParam & {
56
- baseUrl: string;
57
- apiKey?: string;
58
- }) => Promise<Txs>;
@@ -1,104 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getTokenTransactionHistory = exports.getETHTransactionHistory = exports.getTokenBalance = exports.getGasOracle = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const utils_1 = require("./utils");
9
- const lib_1 = require("@xchainjs/xchain-util/lib");
10
- const getApiKeyQueryParameter = (apiKey) => (!!apiKey ? `&apiKey=${apiKey}` : '');
11
- /**
12
- * SafeGasPrice, ProposeGasPrice And FastGasPrice returned in string-Gwei
13
- *
14
- * @see https://etherscan.io/apis#gastracker
15
- *
16
- * @param {string} baseUrl The etherscan node url.
17
- * @param {string} apiKey The etherscan API key. (optional)
18
- * @returns {GasOracleResponse} LastBlock, SafeGasPrice, ProposeGasPrice, FastGasPrice
19
- */
20
- const getGasOracle = (baseUrl, apiKey) => {
21
- const url = baseUrl + '/api?module=gastracker&action=gasoracle';
22
- return axios_1.default.get(url + getApiKeyQueryParameter(apiKey)).then((response) => response.data.result);
23
- };
24
- exports.getGasOracle = getGasOracle;
25
- /**
26
- * Get token balance
27
- *
28
- * @see https://etherscan.io/apis#tokens
29
- *
30
- * @param {string} baseUrl The etherscan node url.
31
- * @param {string} address The address.
32
- * @param {string} assetAddress The token contract address.
33
- * @param {string} apiKey The etherscan API key. (optional)
34
- * @returns {BigNumberish} The token balance
35
- */
36
- const getTokenBalance = ({ baseUrl, address, assetAddress, apiKey, }) => {
37
- const url = baseUrl + `/api?module=account&action=tokenbalance&contractaddress=${assetAddress}&address=${address}`;
38
- return axios_1.default.get(url + getApiKeyQueryParameter(apiKey)).then((response) => response.data.result);
39
- };
40
- exports.getTokenBalance = getTokenBalance;
41
- /**
42
- * Get ETH transaction history
43
- *
44
- * @see https://etherscan.io/apis#accounts
45
- *
46
- * @param {string} baseUrl The etherscan node url.
47
- * @param {string} address The address.
48
- * @param {TransactionHistoryParam} params The search options.
49
- * @param {string} apiKey The etherscan API key. (optional)
50
- * @returns {Array<ETHTransactionInfo>} The ETH transaction history
51
- */
52
- const getETHTransactionHistory = async ({ baseUrl, address, page, offset, startblock, endblock, apiKey, }) => {
53
- let url = baseUrl + `/api?module=account&action=txlist&sort=desc` + getApiKeyQueryParameter(apiKey);
54
- if (address)
55
- url += `&address=${address}`;
56
- if (offset)
57
- url += `&offset=${offset}`;
58
- if (page)
59
- url += `&page=${page}`;
60
- if (startblock)
61
- url += `&startblock=${startblock}`;
62
- if (endblock)
63
- url += `&endblock=${endblock}`;
64
- const ethTransactions = await axios_1.default.get(url).then((response) => response.data.result);
65
- return (0, utils_1.filterSelfTxs)(ethTransactions)
66
- .filter((tx) => !(0, lib_1.bn)(tx.value).isZero())
67
- .map(utils_1.getTxFromEthTransaction);
68
- };
69
- exports.getETHTransactionHistory = getETHTransactionHistory;
70
- /**
71
- * Get token transaction history
72
- *
73
- * @see https://etherscan.io/apis#accounts
74
- *
75
- * @param {string} baseUrl The etherscan node url.
76
- * @param {string} address The address.
77
- * @param {TransactionHistoryParam} params The search options.
78
- * @param {string} apiKey The etherscan API key. (optional)
79
- * @returns {Array<Txs>} The token transaction history
80
- */
81
- const getTokenTransactionHistory = async ({ baseUrl, address, assetAddress, page, offset, startblock, endblock, apiKey, }) => {
82
- let url = baseUrl + `/api?module=account&action=tokentx&sort=desc` + getApiKeyQueryParameter(apiKey);
83
- if (address)
84
- url += `&address=${address}`;
85
- if (assetAddress)
86
- url += `&contractaddress=${assetAddress}`;
87
- if (offset)
88
- url += `&offset=${offset}`;
89
- if (page)
90
- url += `&page=${page}`;
91
- if (startblock)
92
- url += `&startblock=${startblock}`;
93
- if (endblock)
94
- url += `&endblock=${endblock}`;
95
- const tokenTransactions = await axios_1.default.get(url).then((response) => response.data.result);
96
- return (0, utils_1.filterSelfTxs)(tokenTransactions)
97
- .filter((tx) => !(0, lib_1.bn)(tx.value).isZero())
98
- .reduce((acc, cur) => {
99
- const tx = (0, utils_1.getTxFromTokenTransaction)(cur);
100
- return tx ? [...acc, tx] : acc;
101
- }, []);
102
- };
103
- exports.getTokenTransactionHistory = getTokenTransactionHistory;
104
- //# sourceMappingURL=etherscan-api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"etherscan-api.js","sourceRoot":"","sources":["../src/etherscan-api.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAUzB,mCAA2F;AAC3F,mDAA8C;AAE9C,MAAM,uBAAuB,GAAG,CAAC,MAAe,EAAU,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAElG;;;;;;;;GAQG;AACI,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,MAAe,EAA8B,EAAE;IAC3F,MAAM,GAAG,GAAG,OAAO,GAAG,yCAAyC,CAAA;IAE/D,OAAO,eAAK,CAAC,GAAG,CAAC,GAAG,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAClG,CAAC,CAAA;AAJY,QAAA,YAAY,gBAIxB;AAED;;;;;;;;;;GAUG;AACI,MAAM,eAAe,GAAG,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,YAAY,EACZ,MAAM,GACmD,EAAyB,EAAE;IACpF,MAAM,GAAG,GAAG,OAAO,GAAG,2DAA2D,YAAY,YAAY,OAAO,EAA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