@0xtorch/evm 0.0.156 → 0.0.158
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/_cjs/chain/definitions/astar.js +2 -2
- package/_cjs/chain/definitions/astar.js.map +1 -1
- package/_cjs/chain/definitions/astarZkEvm.js +1 -1
- package/_cjs/chain/definitions/astarZkEvm.js.map +1 -1
- package/_cjs/chain/definitions/avalancheC.js +1 -6
- package/_cjs/chain/definitions/avalancheC.js.map +1 -1
- package/_cjs/chain/definitions/fantom.js +0 -16
- package/_cjs/chain/definitions/fantom.js.map +1 -1
- package/_cjs/chain/definitions/moonbeam.js +2 -2
- package/_cjs/chain/definitions/moonbeam.js.map +1 -1
- package/_cjs/chain/definitions/moonriver.js +2 -2
- package/_cjs/chain/definitions/moonriver.js.map +1 -1
- package/_cjs/explorer/blockscout/create.js +49 -24
- package/_cjs/explorer/blockscout/create.js.map +1 -1
- package/_cjs/explorer/etherscan/create.js +53 -26
- package/_cjs/explorer/etherscan/create.js.map +1 -1
- package/_cjs/explorer/etherscanV2/create.js +53 -26
- package/_cjs/explorer/etherscanV2/create.js.map +1 -1
- package/_cjs/explorer/moralis/create.js +15 -3
- package/_cjs/explorer/moralis/create.js.map +1 -1
- package/_esm/chain/definitions/astar.js +2 -2
- package/_esm/chain/definitions/astar.js.map +1 -1
- package/_esm/chain/definitions/astarZkEvm.js +1 -1
- package/_esm/chain/definitions/astarZkEvm.js.map +1 -1
- package/_esm/chain/definitions/avalancheC.js +6 -6
- package/_esm/chain/definitions/avalancheC.js.map +1 -1
- package/_esm/chain/definitions/fantom.js +16 -16
- package/_esm/chain/definitions/fantom.js.map +1 -1
- package/_esm/chain/definitions/moonbeam.js +2 -2
- package/_esm/chain/definitions/moonbeam.js.map +1 -1
- package/_esm/chain/definitions/moonriver.js +2 -2
- package/_esm/chain/definitions/moonriver.js.map +1 -1
- package/_esm/explorer/blockscout/create.js +53 -24
- package/_esm/explorer/blockscout/create.js.map +1 -1
- package/_esm/explorer/etherscan/create.js +57 -26
- package/_esm/explorer/etherscan/create.js.map +1 -1
- package/_esm/explorer/etherscanV2/create.js +57 -26
- package/_esm/explorer/etherscanV2/create.js.map +1 -1
- package/_esm/explorer/moralis/create.js +19 -3
- package/_esm/explorer/moralis/create.js.map +1 -1
- package/_types/explorer/blockscout/create.d.ts.map +1 -1
- package/_types/explorer/etherscan/create.d.ts.map +1 -1
- package/_types/explorer/etherscanV2/create.d.ts.map +1 -1
- package/_types/explorer/index.d.ts +1 -1
- package/_types/explorer/index.d.ts.map +1 -1
- package/_types/explorer/moralis/create.d.ts.map +1 -1
- package/_types/explorer/types.d.ts +9 -8
- package/_types/explorer/types.d.ts.map +1 -1
- package/chain/definitions/astar.ts +2 -2
- package/chain/definitions/astarZkEvm.ts +1 -1
- package/chain/definitions/avalancheC.ts +6 -6
- package/chain/definitions/fantom.ts +16 -16
- package/chain/definitions/moonbeam.ts +2 -2
- package/chain/definitions/moonriver.ts +2 -2
- package/explorer/blockscout/create.ts +49 -21
- package/explorer/etherscan/create.ts +56 -23
- package/explorer/etherscanV2/create.ts +56 -23
- package/explorer/index.ts +1 -1
- package/explorer/moralis/create.ts +23 -4
- package/explorer/types.ts +13 -8
- package/package.json +1 -1
|
@@ -2,6 +2,19 @@ import { toLowerHex, } from '../../types';
|
|
|
2
2
|
import { createInternalTransactionId } from '../../utils/createInternalTransactionId';
|
|
3
3
|
import { createMoralisClient } from './client';
|
|
4
4
|
import { getWalletTransactionHistory } from './getWalletTransactionHistory';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves headers from either a static object or a function that returns headers.
|
|
7
|
+
* This allows for dynamic header generation (e.g., refreshing auth tokens).
|
|
8
|
+
*/
|
|
9
|
+
const resolveHeaders = async (headers) => {
|
|
10
|
+
if (headers === undefined) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
if (typeof headers === 'function') {
|
|
14
|
+
return await headers();
|
|
15
|
+
}
|
|
16
|
+
return headers;
|
|
17
|
+
};
|
|
5
18
|
const maxRequestCount = 100;
|
|
6
19
|
const limit = 100;
|
|
7
20
|
export const createMoralisExplorer = ({ name, baseUrl, chain, apiKey, proxyUrl, }) => {
|
|
@@ -19,6 +32,7 @@ export const createMoralisExplorer = ({ name, baseUrl, chain, apiKey, proxyUrl,
|
|
|
19
32
|
let cursor = undefined;
|
|
20
33
|
while (count < maxRequestCount) {
|
|
21
34
|
count += 1;
|
|
35
|
+
const resolvedHeaders = await resolveHeaders(headers);
|
|
22
36
|
const result = await getWalletTransactionHistory({
|
|
23
37
|
client,
|
|
24
38
|
address: lowerAddress,
|
|
@@ -26,7 +40,7 @@ export const createMoralisExplorer = ({ name, baseUrl, chain, apiKey, proxyUrl,
|
|
|
26
40
|
fromBlock,
|
|
27
41
|
toBlock,
|
|
28
42
|
cursor,
|
|
29
|
-
headers,
|
|
43
|
+
headers: resolvedHeaders,
|
|
30
44
|
});
|
|
31
45
|
cursor = result.cursor ?? undefined;
|
|
32
46
|
for (const transaction of result.result) {
|
|
@@ -64,6 +78,7 @@ export const createMoralisExplorer = ({ name, baseUrl, chain, apiKey, proxyUrl,
|
|
|
64
78
|
let cursor = undefined;
|
|
65
79
|
while (count < maxRequestCount) {
|
|
66
80
|
count += 1;
|
|
81
|
+
const resolvedHeaders = await resolveHeaders(headers);
|
|
67
82
|
const result = await getWalletTransactionHistory({
|
|
68
83
|
client,
|
|
69
84
|
address: lowerAddress,
|
|
@@ -71,7 +86,7 @@ export const createMoralisExplorer = ({ name, baseUrl, chain, apiKey, proxyUrl,
|
|
|
71
86
|
fromBlock,
|
|
72
87
|
toBlock,
|
|
73
88
|
cursor,
|
|
74
|
-
headers,
|
|
89
|
+
headers: resolvedHeaders,
|
|
75
90
|
});
|
|
76
91
|
cursor = result.cursor ?? undefined;
|
|
77
92
|
for (const transaction of result.result) {
|
|
@@ -99,6 +114,7 @@ export const createMoralisExplorer = ({ name, baseUrl, chain, apiKey, proxyUrl,
|
|
|
99
114
|
let cursor = undefined;
|
|
100
115
|
while (count < maxRequestCount) {
|
|
101
116
|
count += 1;
|
|
117
|
+
const resolvedHeaders = await resolveHeaders(headers);
|
|
102
118
|
const result = await getWalletTransactionHistory({
|
|
103
119
|
client,
|
|
104
120
|
address: lowerAddress,
|
|
@@ -106,7 +122,7 @@ export const createMoralisExplorer = ({ name, baseUrl, chain, apiKey, proxyUrl,
|
|
|
106
122
|
fromBlock,
|
|
107
123
|
toBlock,
|
|
108
124
|
cursor,
|
|
109
|
-
headers,
|
|
125
|
+
headers: resolvedHeaders,
|
|
110
126
|
});
|
|
111
127
|
cursor = result.cursor ?? undefined;
|
|
112
128
|
for (const transaction of result.result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../explorer/moralis/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,GACX,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAA;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../explorer/moralis/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,GACX,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAA;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAE3E;;;GAGG;AACH,MAAM,cAAc,GAAG,KAAK,EAC1B,OAAqB,EACwB,EAAE;IAC/C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,MAAM,OA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M,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC9C,CAAC;QACD,WAAW,EAAE,GAAG,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC9C,CAAC;QACD,oBAAoB,EAAE,GAAG,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC9C,CAAC;QACD,YAAY,EAAE,GAAG,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC9C,CAAC;QACD,mCAAmC,EAAE,GAAG,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC9C,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/blockscout/create.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/blockscout/create.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAoC,MAAM,UAAU,CAAA;AA2B1E,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,0CAK9B,0BAA0B,KAAG,QAiL/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/etherscan/create.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/etherscan/create.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAoC,MAAM,UAAU,CAAA;AA6B1E,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,4DAO7B,yBAAyB,KAAG,QA0O9B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/etherscanV2/create.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/etherscanV2/create.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAoC,MAAM,UAAU,CAAA;AA6B1E,KAAK,2BAA2B,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,yDAO/B,2BAA2B,KAAG,QA0OhC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createEtherscan } from './etherscan/create';
|
|
2
2
|
export { createEtherscanV2 } from './etherscanV2/create';
|
|
3
|
-
export type { Explorer } from './types';
|
|
3
|
+
export type { Explorer, HeadersInput } from './types';
|
|
4
4
|
export { createMoralisExplorer } from './moralis/create';
|
|
5
5
|
export { createNoApiExplorer } from './noApiExplorer/create';
|
|
6
6
|
export { createBlockscout } from './blockscout/create';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../explorer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../explorer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/moralis/create.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../explorer/moralis/create.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,UAAU,CAAA;AAoBtD,KAAK,+BAA+B,GAAG;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAKD,eAAO,MAAM,qBAAqB,GAAI,6CAMnC,+BAA+B,KAAG,QA2LpC,CAAA"}
|
|
@@ -14,6 +14,7 @@ export type ContractCreation = {
|
|
|
14
14
|
export type LogWithBlockNumber = Log & {
|
|
15
15
|
blockNumber: number;
|
|
16
16
|
};
|
|
17
|
+
export type HeadersInput = Record<string, string> | (() => Promise<Record<string, string> | undefined>) | undefined;
|
|
17
18
|
export type Explorer = {
|
|
18
19
|
readonly name: string;
|
|
19
20
|
readonly baseUrl: string;
|
|
@@ -30,19 +31,19 @@ type FunctionGetAddressInternalTransactions = (parameters: {
|
|
|
30
31
|
address: Hex;
|
|
31
32
|
fromBlock?: number;
|
|
32
33
|
toBlock?: number;
|
|
33
|
-
headers?:
|
|
34
|
+
headers?: HeadersInput;
|
|
34
35
|
}) => Promise<InternalTransactionWithIndex[]>;
|
|
35
36
|
type FunctionGetAddressTransactionIndexes = (parameters: {
|
|
36
37
|
address: Hex;
|
|
37
38
|
fromBlock?: number;
|
|
38
39
|
toBlock?: number;
|
|
39
|
-
headers?:
|
|
40
|
+
headers?: HeadersInput;
|
|
40
41
|
}) => Promise<TransactionIndex[]>;
|
|
41
42
|
type FunctionGetAddressTokenTransferIndexes = (parameters: {
|
|
42
43
|
address: Hex;
|
|
43
44
|
fromBlock?: number;
|
|
44
45
|
toBlock?: number;
|
|
45
|
-
headers?:
|
|
46
|
+
headers?: HeadersInput;
|
|
46
47
|
}) => Promise<{
|
|
47
48
|
indexes: TransactionIndex[];
|
|
48
49
|
erc20Transfers: Erc20Transfer[];
|
|
@@ -50,26 +51,26 @@ type FunctionGetAddressTokenTransferIndexes = (parameters: {
|
|
|
50
51
|
type FunctionGetBlockNumberOfTimestamp = (parameters: {
|
|
51
52
|
/** Unix timestamp in milliseconds */
|
|
52
53
|
timestamp: number;
|
|
53
|
-
headers?:
|
|
54
|
+
headers?: HeadersInput;
|
|
54
55
|
}) => Promise<number>;
|
|
55
56
|
type FunctionGetContract = (parameters: {
|
|
56
57
|
address: Hex;
|
|
57
|
-
headers?:
|
|
58
|
+
headers?: HeadersInput;
|
|
58
59
|
}) => Promise<Contract | undefined>;
|
|
59
60
|
type FunctionGetContractCreations = (parameters: {
|
|
60
61
|
addresses: Hex[];
|
|
61
|
-
headers?:
|
|
62
|
+
headers?: HeadersInput;
|
|
62
63
|
}) => Promise<ContractCreation[]>;
|
|
63
64
|
type FunctionGetEventLogs = (parameters: {
|
|
64
65
|
address: Hex;
|
|
65
66
|
topic0: LowerHex;
|
|
66
67
|
fromBlock?: number;
|
|
67
68
|
toBlock?: number;
|
|
68
|
-
headers?:
|
|
69
|
+
headers?: HeadersInput;
|
|
69
70
|
}) => Promise<LogWithBlockNumber[]>;
|
|
70
71
|
type FunctionGetInternalTransactionOfTransaction = (parameters: {
|
|
71
72
|
hash: LowerHex;
|
|
72
|
-
headers?:
|
|
73
|
+
headers?: HeadersInput;
|
|
73
74
|
}) => Promise<InternalTransactionWithIndex[]>;
|
|
74
75
|
export {};
|
|
75
76
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../explorer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAEjE,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,EAAE,QAAQ,CAAA;IACzB,eAAe,EAAE,QAAQ,CAAA;IACzB,MAAM,EAAE,QAAQ,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,GAAG,GAAG;IACrC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,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
@@ -89,7 +89,7 @@ export const astarHttpRpcs: HttpRpc[] = [
|
|
|
89
89
|
getLogsMaxBlockRange: 1000n,
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
url: 'https://astar-rpc.dwellir.com',
|
|
92
|
+
url: 'https://astar-rpc.n.dwellir.com',
|
|
93
93
|
getLogsIsUsable: true,
|
|
94
94
|
getLogsMaxBlockRange: 5000n,
|
|
95
95
|
},
|
|
@@ -108,5 +108,5 @@ export const astarHttpRpcs: HttpRpc[] = [
|
|
|
108
108
|
export const astarWebsocketRpcUrls: readonly string[] = [
|
|
109
109
|
'wss://rpc.astar.network',
|
|
110
110
|
'wss://astar.api.onfinality.io/public-ws',
|
|
111
|
-
'wss://astar-rpc.dwellir.com',
|
|
111
|
+
'wss://astar-rpc.n.dwellir.com',
|
|
112
112
|
]
|
|
@@ -70,11 +70,11 @@ export const avalancheCHttpRpcs: HttpRpc[] = [
|
|
|
70
70
|
// getLogsIsUsable: true,
|
|
71
71
|
// getLogsMaxBlockRange: 10_000n,
|
|
72
72
|
// },
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
73
|
+
// {
|
|
74
|
+
// url: 'https://avalanche.public-rpc.com',
|
|
75
|
+
// getLogsIsUsable: true,
|
|
76
|
+
// getLogsMaxBlockRange: 2048n,
|
|
77
|
+
// },
|
|
78
78
|
{
|
|
79
79
|
url: 'https://rpc.ankr.com/avalanche',
|
|
80
80
|
getLogsIsUsable: true,
|
|
@@ -158,5 +158,5 @@ export const avalancheCHttpRpcs: HttpRpc[] = [
|
|
|
158
158
|
]
|
|
159
159
|
|
|
160
160
|
export const avalancheCWebsocketRpcUrls: readonly string[] = [
|
|
161
|
-
'wss://avalanche-c-chain.publicnode.com',
|
|
161
|
+
'wss://avalanche-c-chain-rpc.publicnode.com',
|
|
162
162
|
]
|
|
@@ -68,21 +68,21 @@ export const fantomHttpRpcs: HttpRpc[] = [
|
|
|
68
68
|
getLogsIsUsable: true,
|
|
69
69
|
getLogsMaxBlockRange: 20_000n,
|
|
70
70
|
},
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
71
|
+
// {
|
|
72
|
+
// url: 'https://rpc.ftm.tools/',
|
|
73
|
+
// getLogsIsUsable: true,
|
|
74
|
+
// getLogsMaxBlockRange: 3000n,
|
|
75
|
+
// },
|
|
76
76
|
{
|
|
77
77
|
url: 'https://1rpc.io/ftm',
|
|
78
78
|
getLogsIsUsable: true,
|
|
79
79
|
getLogsMaxBlockRange: 1000n,
|
|
80
80
|
},
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
},
|
|
81
|
+
// {
|
|
82
|
+
// url: 'https://fantom.publicnode.com/',
|
|
83
|
+
// getLogsIsUsable: true,
|
|
84
|
+
// getLogsMaxBlockRange: 40_000n,
|
|
85
|
+
// },
|
|
86
86
|
// Endpoint is not working
|
|
87
87
|
// {
|
|
88
88
|
// url: 'https://fantom.blockpi.network/v1/rpc/public',
|
|
@@ -124,11 +124,11 @@ export const fantomHttpRpcs: HttpRpc[] = [
|
|
|
124
124
|
getLogsIsUsable: true,
|
|
125
125
|
getLogsMaxBlockRange: 10_000n,
|
|
126
126
|
},
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
},
|
|
127
|
+
// {
|
|
128
|
+
// url: 'https://fantom-rpc.publicnode.com',
|
|
129
|
+
// getLogsIsUsable: true,
|
|
130
|
+
// getLogsMaxBlockRange: 10_000n,
|
|
131
|
+
// },
|
|
132
132
|
{
|
|
133
133
|
url: 'https://fantom.api.onfinality.io/public',
|
|
134
134
|
getLogsIsUsable: true,
|
|
@@ -150,5 +150,5 @@ export const fantomHttpRpcs: HttpRpc[] = [
|
|
|
150
150
|
|
|
151
151
|
export const fantomWebsocketRpcUrls: readonly string[] = [
|
|
152
152
|
'wss://wsapi.fantom.network/',
|
|
153
|
-
'wss://fantom.publicnode.com',
|
|
153
|
+
// 'wss://fantom.publicnode.com',
|
|
154
154
|
]
|
|
@@ -85,7 +85,7 @@ export const moonbeamHttpRpcs: HttpRpc[] = [
|
|
|
85
85
|
getLogsMaxBlockRange: 1000n,
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
url: 'https://moonbeam-rpc.dwellir.com',
|
|
88
|
+
url: 'https://moonbeam-rpc.n.dwellir.com',
|
|
89
89
|
getLogsIsUsable: true,
|
|
90
90
|
getLogsMaxBlockRange: 10_000n,
|
|
91
91
|
},
|
|
@@ -120,6 +120,6 @@ export const moonbeamHttpRpcs: HttpRpc[] = [
|
|
|
120
120
|
|
|
121
121
|
export const moonbeamWebsocketRpcUrls: readonly string[] = [
|
|
122
122
|
'wss://moonbeam.api.onfinality.io/public-ws',
|
|
123
|
-
'wss://moonbeam-rpc.dwellir.com',
|
|
123
|
+
'wss://moonbeam-rpc.n.dwellir.com',
|
|
124
124
|
'wss://moonbeam-rpc.publicnode.com',
|
|
125
125
|
]
|
|
@@ -70,7 +70,7 @@ export const moonriverHttpRpcs: HttpRpc[] = [
|
|
|
70
70
|
getLogsMaxBlockRange: 10_000n,
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
url: 'https://moonriver-rpc.dwellir.com',
|
|
73
|
+
url: 'https://moonriver-rpc.n.dwellir.com',
|
|
74
74
|
getLogsIsUsable: true,
|
|
75
75
|
getLogsMaxBlockRange: 10_000n,
|
|
76
76
|
},
|
|
@@ -101,6 +101,6 @@ export const moonriverHttpRpcs: HttpRpc[] = [
|
|
|
101
101
|
export const moonriverWebsocketRpcUrls: readonly string[] = [
|
|
102
102
|
'wss://moonriver.api.onfinality.io/public-ws',
|
|
103
103
|
'wss://moonriver.unitedbloc.com:2001',
|
|
104
|
-
'wss://moonriver-rpc.dwellir.com',
|
|
104
|
+
'wss://moonriver-rpc.n.dwellir.com',
|
|
105
105
|
'wss://moonriver-rpc.publicnode.com',
|
|
106
106
|
]
|
|
@@ -2,7 +2,7 @@ import type { Erc20Transfer, LowerHex } from '../../types'
|
|
|
2
2
|
import type { InternalTransactionWithIndex } from '../../types/internalTransaction'
|
|
3
3
|
import type { TransactionIndex } from '../../types/transactionIndex'
|
|
4
4
|
import { createInternalTransactionId } from '../../utils/createInternalTransactionId'
|
|
5
|
-
import type { Explorer, LogWithBlockNumber } from '../types'
|
|
5
|
+
import type { Explorer, HeadersInput, LogWithBlockNumber } from '../types'
|
|
6
6
|
import { createBlockscoutClient } from './client'
|
|
7
7
|
import { getBlockNumberByTimestamp } from './getBlockNumberByTimestamp'
|
|
8
8
|
import { getContractCreatorAddressHashAndCreationTransactionHash } from './getContractCreatorAddressHashAndCreationTransactionHash'
|
|
@@ -13,6 +13,22 @@ import { getInternalTransactionsByTransactionHash } from './getInternalTransacti
|
|
|
13
13
|
import { getTokenTransferEventsByAddress } from './getTokenTransferEventsByAddress'
|
|
14
14
|
import { getTransactionsByAddress } from './getTransactionsByAddress'
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Resolves headers from either a static object or a function that returns headers.
|
|
18
|
+
* This allows for dynamic header generation (e.g., refreshing auth tokens).
|
|
19
|
+
*/
|
|
20
|
+
const resolveHeaders = async (
|
|
21
|
+
headers: HeadersInput,
|
|
22
|
+
): Promise<Record<string, string> | undefined> => {
|
|
23
|
+
if (headers === undefined) {
|
|
24
|
+
return undefined
|
|
25
|
+
}
|
|
26
|
+
if (typeof headers === 'function') {
|
|
27
|
+
return await headers()
|
|
28
|
+
}
|
|
29
|
+
return headers
|
|
30
|
+
}
|
|
31
|
+
|
|
16
32
|
type CreateBlockscoutParameters = {
|
|
17
33
|
name: string
|
|
18
34
|
baseUrl: string
|
|
@@ -45,12 +61,13 @@ export const createBlockscout = ({
|
|
|
45
61
|
const endblock = toBlock
|
|
46
62
|
const maxPageSize = 10_000
|
|
47
63
|
while (true) {
|
|
64
|
+
const resolvedHeaders = await resolveHeaders(headers)
|
|
48
65
|
const result = await getInternalTransactionsByAddressHash({
|
|
49
66
|
client,
|
|
50
67
|
address,
|
|
51
68
|
startblock,
|
|
52
69
|
endblock,
|
|
53
|
-
headers,
|
|
70
|
+
headers: resolvedHeaders,
|
|
54
71
|
})
|
|
55
72
|
for (const transaction of result) {
|
|
56
73
|
const id = createInternalTransactionId(transaction)
|
|
@@ -77,12 +94,13 @@ export const createBlockscout = ({
|
|
|
77
94
|
const endblock = toBlock
|
|
78
95
|
const maxPageSize = 10_000
|
|
79
96
|
while (true) {
|
|
97
|
+
const resolvedHeaders = await resolveHeaders(headers)
|
|
80
98
|
const result = await getTransactionsByAddress({
|
|
81
99
|
client,
|
|
82
100
|
address,
|
|
83
101
|
startblock,
|
|
84
102
|
endblock,
|
|
85
|
-
headers,
|
|
103
|
+
headers: resolvedHeaders,
|
|
86
104
|
})
|
|
87
105
|
for (const index of result) {
|
|
88
106
|
if (!indexes.has(index.hash)) {
|
|
@@ -109,13 +127,14 @@ export const createBlockscout = ({
|
|
|
109
127
|
const endblock = toBlock
|
|
110
128
|
const maxPageSize = 10_000
|
|
111
129
|
while (true) {
|
|
130
|
+
const resolvedHeaders = await resolveHeaders(headers)
|
|
112
131
|
const { indexes: resultIndexes, erc20Transfers: resultErc20Transfers } =
|
|
113
132
|
await getTokenTransferEventsByAddress({
|
|
114
133
|
client,
|
|
115
134
|
address,
|
|
116
135
|
startblock,
|
|
117
136
|
endblock,
|
|
118
|
-
headers,
|
|
137
|
+
headers: resolvedHeaders,
|
|
119
138
|
})
|
|
120
139
|
for (const index of resultIndexes) {
|
|
121
140
|
if (!indexes.has(index.hash)) {
|
|
@@ -136,24 +155,30 @@ export const createBlockscout = ({
|
|
|
136
155
|
erc20Transfers,
|
|
137
156
|
}
|
|
138
157
|
},
|
|
139
|
-
getBlockNumberOfTimestamp: ({ timestamp, headers }) =>
|
|
140
|
-
|
|
158
|
+
getBlockNumberOfTimestamp: async ({ timestamp, headers }) => {
|
|
159
|
+
const resolvedHeaders = await resolveHeaders(headers)
|
|
160
|
+
return getBlockNumberByTimestamp({
|
|
141
161
|
client,
|
|
142
162
|
timestamp: Math.floor(timestamp / 1000),
|
|
143
|
-
headers,
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
|
|
163
|
+
headers: resolvedHeaders,
|
|
164
|
+
})
|
|
165
|
+
},
|
|
166
|
+
getContract: async ({ address, headers }) => {
|
|
167
|
+
const resolvedHeaders = await resolveHeaders(headers)
|
|
168
|
+
return getContractSourceCodeForAVerifiedContract({
|
|
147
169
|
client,
|
|
148
170
|
address,
|
|
149
|
-
headers,
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
|
|
171
|
+
headers: resolvedHeaders,
|
|
172
|
+
})
|
|
173
|
+
},
|
|
174
|
+
getContractCreations: async ({ addresses, headers }) => {
|
|
175
|
+
const resolvedHeaders = await resolveHeaders(headers)
|
|
176
|
+
return getContractCreatorAddressHashAndCreationTransactionHash({
|
|
153
177
|
client,
|
|
154
178
|
contractaddresses: addresses,
|
|
155
|
-
headers,
|
|
156
|
-
})
|
|
179
|
+
headers: resolvedHeaders,
|
|
180
|
+
})
|
|
181
|
+
},
|
|
157
182
|
getEventLogs: async ({
|
|
158
183
|
address,
|
|
159
184
|
topic0,
|
|
@@ -166,13 +191,14 @@ export const createBlockscout = ({
|
|
|
166
191
|
const toBlock = toBlockParam ?? 'latest'
|
|
167
192
|
const maxPageSize = 10_000
|
|
168
193
|
while (true) {
|
|
194
|
+
const resolvedHeaders = await resolveHeaders(headers)
|
|
169
195
|
const result = await getEventLogsByAddressAndTopic({
|
|
170
196
|
client,
|
|
171
197
|
address,
|
|
172
198
|
topic0,
|
|
173
199
|
fromBlock,
|
|
174
200
|
toBlock,
|
|
175
|
-
headers,
|
|
201
|
+
headers: resolvedHeaders,
|
|
176
202
|
})
|
|
177
203
|
logs.push(...result)
|
|
178
204
|
if (result.length < maxPageSize) {
|
|
@@ -183,11 +209,13 @@ export const createBlockscout = ({
|
|
|
183
209
|
}
|
|
184
210
|
return logs
|
|
185
211
|
},
|
|
186
|
-
getInternalTransactionOfTransaction: ({ hash, headers }) =>
|
|
187
|
-
|
|
212
|
+
getInternalTransactionOfTransaction: async ({ hash, headers }) => {
|
|
213
|
+
const resolvedHeaders = await resolveHeaders(headers)
|
|
214
|
+
return getInternalTransactionsByTransactionHash({
|
|
188
215
|
client,
|
|
189
216
|
txhash: hash,
|
|
190
|
-
headers,
|
|
191
|
-
})
|
|
217
|
+
headers: resolvedHeaders,
|
|
218
|
+
})
|
|
219
|
+
},
|
|
192
220
|
}
|
|
193
221
|
}
|