@cityofzion/bs-ethereum 2.0.3 → 2.1.0
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/BSEthereum.js +4 -6
- package/dist/MoralisBDSEthereum.d.ts +15 -0
- package/dist/MoralisBDSEthereum.js +323 -0
- package/dist/MoralisEDSEthereum.d.ts +8 -0
- package/dist/MoralisEDSEthereum.js +139 -0
- package/dist/RpcBDSEthereum.d.ts +3 -2
- package/dist/RpcBDSEthereum.js +17 -25
- package/dist/assets/abis/ERC271.d.ts +44 -0
- package/dist/assets/abis/ERC271.js +349 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +2 -4
- package/dist/BitqueryBDSEthereum.d.ts +0 -15
- package/dist/BitqueryBDSEthereum.js +0 -228
- package/dist/BitqueryEDSEthereum.d.ts +0 -9
- package/dist/BitqueryEDSEthereum.js +0 -90
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const ERC271_ABI: ({
|
|
2
|
+
anonymous: boolean;
|
|
3
|
+
inputs: {
|
|
4
|
+
indexed: boolean;
|
|
5
|
+
internalType: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
constant?: undefined;
|
|
12
|
+
outputs?: undefined;
|
|
13
|
+
payable?: undefined;
|
|
14
|
+
stateMutability?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
constant: boolean;
|
|
17
|
+
inputs: never[];
|
|
18
|
+
name: string;
|
|
19
|
+
outputs: {
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
}[];
|
|
23
|
+
payable: boolean;
|
|
24
|
+
stateMutability: string;
|
|
25
|
+
type: string;
|
|
26
|
+
anonymous?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
inputs: {
|
|
29
|
+
internalType: string;
|
|
30
|
+
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
}[];
|
|
33
|
+
name: string;
|
|
34
|
+
outputs: {
|
|
35
|
+
internalType: string;
|
|
36
|
+
name: string;
|
|
37
|
+
type: string;
|
|
38
|
+
}[];
|
|
39
|
+
stateMutability: string;
|
|
40
|
+
type: string;
|
|
41
|
+
anonymous?: undefined;
|
|
42
|
+
constant?: undefined;
|
|
43
|
+
payable?: undefined;
|
|
44
|
+
})[];
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ERC271_ABI = void 0;
|
|
4
|
+
exports.ERC271_ABI = [
|
|
5
|
+
{
|
|
6
|
+
anonymous: false,
|
|
7
|
+
inputs: [
|
|
8
|
+
{
|
|
9
|
+
indexed: true,
|
|
10
|
+
internalType: 'address',
|
|
11
|
+
name: 'owner',
|
|
12
|
+
type: 'address',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
indexed: true,
|
|
16
|
+
internalType: 'address',
|
|
17
|
+
name: 'approved',
|
|
18
|
+
type: 'address',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
indexed: true,
|
|
22
|
+
internalType: 'uint256',
|
|
23
|
+
name: 'tokenId',
|
|
24
|
+
type: 'uint256',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
name: 'Approval',
|
|
28
|
+
type: 'event',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
anonymous: false,
|
|
32
|
+
inputs: [
|
|
33
|
+
{
|
|
34
|
+
indexed: true,
|
|
35
|
+
internalType: 'address',
|
|
36
|
+
name: 'owner',
|
|
37
|
+
type: 'address',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
indexed: true,
|
|
41
|
+
internalType: 'address',
|
|
42
|
+
name: 'operator',
|
|
43
|
+
type: 'address',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
indexed: false,
|
|
47
|
+
internalType: 'bool',
|
|
48
|
+
name: 'approved',
|
|
49
|
+
type: 'bool',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
name: 'ApprovalForAll',
|
|
53
|
+
type: 'event',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
anonymous: false,
|
|
57
|
+
inputs: [
|
|
58
|
+
{
|
|
59
|
+
indexed: true,
|
|
60
|
+
internalType: 'address',
|
|
61
|
+
name: 'from',
|
|
62
|
+
type: 'address',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
indexed: true,
|
|
66
|
+
internalType: 'address',
|
|
67
|
+
name: 'to',
|
|
68
|
+
type: 'address',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
indexed: true,
|
|
72
|
+
internalType: 'uint256',
|
|
73
|
+
name: 'tokenId',
|
|
74
|
+
type: 'uint256',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
name: 'Transfer',
|
|
78
|
+
type: 'event',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
inputs: [
|
|
82
|
+
{
|
|
83
|
+
internalType: 'address',
|
|
84
|
+
name: 'to',
|
|
85
|
+
type: 'address',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
internalType: 'uint256',
|
|
89
|
+
name: 'tokenId',
|
|
90
|
+
type: 'uint256',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
name: 'approve',
|
|
94
|
+
outputs: [],
|
|
95
|
+
stateMutability: 'nonpayable',
|
|
96
|
+
type: 'function',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
constant: true,
|
|
100
|
+
inputs: [],
|
|
101
|
+
name: 'totalSupply',
|
|
102
|
+
outputs: [
|
|
103
|
+
{
|
|
104
|
+
name: '',
|
|
105
|
+
type: 'uint256',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
payable: false,
|
|
109
|
+
stateMutability: 'view',
|
|
110
|
+
type: 'function',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
inputs: [
|
|
114
|
+
{
|
|
115
|
+
internalType: 'address',
|
|
116
|
+
name: 'owner',
|
|
117
|
+
type: 'address',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
name: 'balanceOf',
|
|
121
|
+
outputs: [
|
|
122
|
+
{
|
|
123
|
+
internalType: 'uint256',
|
|
124
|
+
name: 'balance',
|
|
125
|
+
type: 'uint256',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
stateMutability: 'view',
|
|
129
|
+
type: 'function',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
inputs: [
|
|
133
|
+
{
|
|
134
|
+
internalType: 'uint256',
|
|
135
|
+
name: 'tokenId',
|
|
136
|
+
type: 'uint256',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
name: 'getApproved',
|
|
140
|
+
outputs: [
|
|
141
|
+
{
|
|
142
|
+
internalType: 'address',
|
|
143
|
+
name: 'operator',
|
|
144
|
+
type: 'address',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
stateMutability: 'view',
|
|
148
|
+
type: 'function',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
inputs: [
|
|
152
|
+
{
|
|
153
|
+
internalType: 'address',
|
|
154
|
+
name: 'owner',
|
|
155
|
+
type: 'address',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
internalType: 'address',
|
|
159
|
+
name: 'operator',
|
|
160
|
+
type: 'address',
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
name: 'isApprovedForAll',
|
|
164
|
+
outputs: [
|
|
165
|
+
{
|
|
166
|
+
internalType: 'bool',
|
|
167
|
+
name: '',
|
|
168
|
+
type: 'bool',
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
stateMutability: 'view',
|
|
172
|
+
type: 'function',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
inputs: [],
|
|
176
|
+
name: 'name',
|
|
177
|
+
outputs: [
|
|
178
|
+
{
|
|
179
|
+
internalType: 'string',
|
|
180
|
+
name: '',
|
|
181
|
+
type: 'string',
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
stateMutability: 'view',
|
|
185
|
+
type: 'function',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
inputs: [
|
|
189
|
+
{
|
|
190
|
+
internalType: 'uint256',
|
|
191
|
+
name: 'tokenId',
|
|
192
|
+
type: 'uint256',
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
name: 'ownerOf',
|
|
196
|
+
outputs: [
|
|
197
|
+
{
|
|
198
|
+
internalType: 'address',
|
|
199
|
+
name: 'owner',
|
|
200
|
+
type: 'address',
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
stateMutability: 'view',
|
|
204
|
+
type: 'function',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
inputs: [
|
|
208
|
+
{
|
|
209
|
+
internalType: 'address',
|
|
210
|
+
name: 'from',
|
|
211
|
+
type: 'address',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
internalType: 'address',
|
|
215
|
+
name: 'to',
|
|
216
|
+
type: 'address',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
internalType: 'uint256',
|
|
220
|
+
name: 'tokenId',
|
|
221
|
+
type: 'uint256',
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
name: 'safeTransferFrom',
|
|
225
|
+
outputs: [],
|
|
226
|
+
stateMutability: 'nonpayable',
|
|
227
|
+
type: 'function',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
inputs: [
|
|
231
|
+
{
|
|
232
|
+
internalType: 'address',
|
|
233
|
+
name: 'from',
|
|
234
|
+
type: 'address',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
internalType: 'address',
|
|
238
|
+
name: 'to',
|
|
239
|
+
type: 'address',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
internalType: 'uint256',
|
|
243
|
+
name: 'tokenId',
|
|
244
|
+
type: 'uint256',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
internalType: 'bytes',
|
|
248
|
+
name: 'data',
|
|
249
|
+
type: 'bytes',
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
name: 'safeTransferFrom',
|
|
253
|
+
outputs: [],
|
|
254
|
+
stateMutability: 'nonpayable',
|
|
255
|
+
type: 'function',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
inputs: [
|
|
259
|
+
{
|
|
260
|
+
internalType: 'address',
|
|
261
|
+
name: 'operator',
|
|
262
|
+
type: 'address',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
internalType: 'bool',
|
|
266
|
+
name: '_approved',
|
|
267
|
+
type: 'bool',
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
name: 'setApprovalForAll',
|
|
271
|
+
outputs: [],
|
|
272
|
+
stateMutability: 'nonpayable',
|
|
273
|
+
type: 'function',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
inputs: [
|
|
277
|
+
{
|
|
278
|
+
internalType: 'bytes4',
|
|
279
|
+
name: 'interfaceId',
|
|
280
|
+
type: 'bytes4',
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
name: 'supportsInterface',
|
|
284
|
+
outputs: [
|
|
285
|
+
{
|
|
286
|
+
internalType: 'bool',
|
|
287
|
+
name: '',
|
|
288
|
+
type: 'bool',
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
stateMutability: 'view',
|
|
292
|
+
type: 'function',
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
inputs: [],
|
|
296
|
+
name: 'symbol',
|
|
297
|
+
outputs: [
|
|
298
|
+
{
|
|
299
|
+
internalType: 'string',
|
|
300
|
+
name: '',
|
|
301
|
+
type: 'string',
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
stateMutability: 'view',
|
|
305
|
+
type: 'function',
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
inputs: [
|
|
309
|
+
{
|
|
310
|
+
internalType: 'uint256',
|
|
311
|
+
name: 'tokenId',
|
|
312
|
+
type: 'uint256',
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
name: 'tokenURI',
|
|
316
|
+
outputs: [
|
|
317
|
+
{
|
|
318
|
+
internalType: 'string',
|
|
319
|
+
name: '',
|
|
320
|
+
type: 'string',
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
stateMutability: 'view',
|
|
324
|
+
type: 'function',
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
inputs: [
|
|
328
|
+
{
|
|
329
|
+
internalType: 'address',
|
|
330
|
+
name: 'from',
|
|
331
|
+
type: 'address',
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
internalType: 'address',
|
|
335
|
+
name: 'to',
|
|
336
|
+
type: 'address',
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
internalType: 'uint256',
|
|
340
|
+
name: 'tokenId',
|
|
341
|
+
type: 'uint256',
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
name: 'transferFrom',
|
|
345
|
+
outputs: [],
|
|
346
|
+
stateMutability: 'nonpayable',
|
|
347
|
+
type: 'function',
|
|
348
|
+
},
|
|
349
|
+
];
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from './BSEthereum';
|
|
|
2
2
|
export * from './GhostMarketNDSEthereum';
|
|
3
3
|
export * from './RpcNDSEthereum';
|
|
4
4
|
export * from './BSEthereumHelper';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './MoralisBDSEthereum';
|
|
6
6
|
export * from './RpcBDSEthereum';
|
|
7
|
-
export * from './
|
|
7
|
+
export * from './MoralisEDSEthereum';
|
|
8
8
|
export * from './EthersLedgerServiceEthereum';
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ __exportStar(require("./BSEthereum"), exports);
|
|
|
18
18
|
__exportStar(require("./GhostMarketNDSEthereum"), exports);
|
|
19
19
|
__exportStar(require("./RpcNDSEthereum"), exports);
|
|
20
20
|
__exportStar(require("./BSEthereumHelper"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
21
|
+
__exportStar(require("./MoralisBDSEthereum"), exports);
|
|
22
22
|
__exportStar(require("./RpcBDSEthereum"), exports);
|
|
23
|
-
__exportStar(require("./
|
|
23
|
+
__exportStar(require("./MoralisEDSEthereum"), exports);
|
|
24
24
|
__exportStar(require("./EthersLedgerServiceEthereum"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-ethereum",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"axios": "1.5.1",
|
|
14
14
|
"ethers": "5.7.2",
|
|
15
|
-
"graphql": "~16.8.0",
|
|
16
|
-
"dayjs": "~1.11.9",
|
|
17
15
|
"query-string": "7.1.3",
|
|
18
16
|
"@ethersproject/json-wallets": "5.7.0",
|
|
19
17
|
"@ethersproject/bytes": "5.7.0",
|
|
@@ -22,7 +20,7 @@
|
|
|
22
20
|
"@ledgerhq/hw-app-eth": "~6.35.7",
|
|
23
21
|
"@ethersproject/abstract-signer": "~5.7.0",
|
|
24
22
|
"@ethersproject/properties": "~5.7.0",
|
|
25
|
-
"@cityofzion/blockchain-service": "1.0
|
|
23
|
+
"@cityofzion/blockchain-service": "1.1.0"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
26
|
"@ledgerhq/hw-transport-node-hid": "~6.28.5",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BalanceResponse, ContractResponse, Token, TransactionsByAddressParams, TransactionsByAddressResponse, TransactionResponse, Network } from '@cityofzion/blockchain-service';
|
|
2
|
-
import { RpcBDSEthereum } from './RpcBDSEthereum';
|
|
3
|
-
import { BSEthereumNetworkId } from './BSEthereumHelper';
|
|
4
|
-
export declare class BitqueryBDSEthereum extends RpcBDSEthereum {
|
|
5
|
-
#private;
|
|
6
|
-
static MIRROR_URL: string;
|
|
7
|
-
static MIRROR_NETWORK_BY_NETWORK_ID: Partial<Record<BSEthereumNetworkId, string>>;
|
|
8
|
-
maxTimeToConfirmTransactionInMs: number;
|
|
9
|
-
constructor(network: Network<BSEthereumNetworkId>);
|
|
10
|
-
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
11
|
-
getTransactionsByAddress({ address, page, }: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
|
12
|
-
getContract(): Promise<ContractResponse>;
|
|
13
|
-
getTokenInfo(hash: string): Promise<Token>;
|
|
14
|
-
getBalance(address: string): Promise<BalanceResponse[]>;
|
|
15
|
-
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
15
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
16
|
-
};
|
|
17
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
18
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
19
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
20
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
|
-
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
|
-
var _BitqueryBDSEthereum_instances, _BitqueryBDSEthereum_client, _BitqueryBDSEthereum_network, _BitqueryBDSEthereum_tokenCache, _BitqueryBDSEthereum_parseTransactionTransfer;
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.BitqueryBDSEthereum = void 0;
|
|
28
|
-
const RpcBDSEthereum_1 = require("./RpcBDSEthereum");
|
|
29
|
-
const axios_1 = __importDefault(require("axios"));
|
|
30
|
-
const BSEthereumHelper_1 = require("./BSEthereumHelper");
|
|
31
|
-
class BitqueryBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
|
|
32
|
-
constructor(network) {
|
|
33
|
-
super(network);
|
|
34
|
-
_BitqueryBDSEthereum_instances.add(this);
|
|
35
|
-
_BitqueryBDSEthereum_client.set(this, void 0);
|
|
36
|
-
_BitqueryBDSEthereum_network.set(this, void 0);
|
|
37
|
-
_BitqueryBDSEthereum_tokenCache.set(this, new Map());
|
|
38
|
-
this.maxTimeToConfirmTransactionInMs = 1000 * 60 * 8;
|
|
39
|
-
__classPrivateFieldSet(this, _BitqueryBDSEthereum_network, network, "f");
|
|
40
|
-
__classPrivateFieldSet(this, _BitqueryBDSEthereum_client, axios_1.default.create({
|
|
41
|
-
baseURL: BitqueryBDSEthereum.MIRROR_URL,
|
|
42
|
-
}), "f");
|
|
43
|
-
}
|
|
44
|
-
getTransaction(hash) {
|
|
45
|
-
const _super = Object.create(null, {
|
|
46
|
-
getTransaction: { get: () => super.getTransaction }
|
|
47
|
-
});
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const mirrorNetwork = BitqueryBDSEthereum.MIRROR_NETWORK_BY_NETWORK_ID[__classPrivateFieldGet(this, _BitqueryBDSEthereum_network, "f").id];
|
|
50
|
-
if (!mirrorNetwork) {
|
|
51
|
-
return _super.getTransaction.call(this, hash);
|
|
52
|
-
}
|
|
53
|
-
const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f").get(`/get-transaction/${hash}`, {
|
|
54
|
-
params: { network: mirrorNetwork },
|
|
55
|
-
});
|
|
56
|
-
if (!result.data || !result.data.ethereum.transfers.length)
|
|
57
|
-
throw new Error('Transaction not found');
|
|
58
|
-
const transfers = result.data.ethereum.transfers.map(__classPrivateFieldGet(this, _BitqueryBDSEthereum_instances, "m", _BitqueryBDSEthereum_parseTransactionTransfer));
|
|
59
|
-
const { block: { height, timestamp: { unixtime }, }, transaction: { gasValue, hash: transactionHash }, } = result.data.ethereum.transfers[0];
|
|
60
|
-
return {
|
|
61
|
-
block: height,
|
|
62
|
-
time: unixtime,
|
|
63
|
-
hash: transactionHash,
|
|
64
|
-
fee: String(gasValue),
|
|
65
|
-
transfers,
|
|
66
|
-
notifications: [],
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
getTransactionsByAddress({ address, page = 1, }) {
|
|
71
|
-
const _super = Object.create(null, {
|
|
72
|
-
getTransactionsByAddress: { get: () => super.getTransactionsByAddress }
|
|
73
|
-
});
|
|
74
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
const mirrorNetwork = BitqueryBDSEthereum.MIRROR_NETWORK_BY_NETWORK_ID[__classPrivateFieldGet(this, _BitqueryBDSEthereum_network, "f").id];
|
|
77
|
-
if (!mirrorNetwork) {
|
|
78
|
-
return _super.getTransactionsByAddress.call(this, { address, page });
|
|
79
|
-
}
|
|
80
|
-
const limit = 10;
|
|
81
|
-
const offset = limit * (page - 1);
|
|
82
|
-
const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f").get(`/get-transactions/${address}`, {
|
|
83
|
-
params: { network: mirrorNetwork, limit, offset },
|
|
84
|
-
});
|
|
85
|
-
if (!result.data)
|
|
86
|
-
throw new Error('Address does not have transactions');
|
|
87
|
-
const totalCount = ((_a = result.data.ethereum.sentCount[0].count) !== null && _a !== void 0 ? _a : 0) + ((_b = result.data.ethereum.receiverCount[0].count) !== null && _b !== void 0 ? _b : 0);
|
|
88
|
-
const mixedTransfers = [...((_e = (_d = (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.ethereum) === null || _d === void 0 ? void 0 : _d.sent) !== null && _e !== void 0 ? _e : []), ...((_h = (_g = (_f = result === null || result === void 0 ? void 0 : result.data) === null || _f === void 0 ? void 0 : _f.ethereum) === null || _g === void 0 ? void 0 : _g.received) !== null && _h !== void 0 ? _h : [])];
|
|
89
|
-
const transactions = new Map();
|
|
90
|
-
mixedTransfers.forEach(transfer => {
|
|
91
|
-
const transactionTransfer = __classPrivateFieldGet(this, _BitqueryBDSEthereum_instances, "m", _BitqueryBDSEthereum_parseTransactionTransfer).call(this, transfer);
|
|
92
|
-
const existingTransaction = transactions.get(transfer.transaction.hash);
|
|
93
|
-
if (existingTransaction) {
|
|
94
|
-
existingTransaction.transfers.push(transactionTransfer);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
transactions.set(transfer.transaction.hash, {
|
|
98
|
-
block: transfer.block.height,
|
|
99
|
-
hash: transfer.transaction.hash,
|
|
100
|
-
time: transfer.block.timestamp.unixtime,
|
|
101
|
-
fee: String(transfer.transaction.gasValue),
|
|
102
|
-
transfers: [transactionTransfer],
|
|
103
|
-
notifications: [],
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
return {
|
|
107
|
-
totalCount,
|
|
108
|
-
limit: limit * 2,
|
|
109
|
-
transactions: Array.from(transactions.values()),
|
|
110
|
-
};
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
getContract() {
|
|
114
|
-
const _super = Object.create(null, {
|
|
115
|
-
getContract: { get: () => super.getContract }
|
|
116
|
-
});
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const mirrorNetwork = BitqueryBDSEthereum.MIRROR_NETWORK_BY_NETWORK_ID[__classPrivateFieldGet(this, _BitqueryBDSEthereum_network, "f").id];
|
|
119
|
-
if (!mirrorNetwork) {
|
|
120
|
-
return _super.getContract.call(this);
|
|
121
|
-
}
|
|
122
|
-
throw new Error("Bitquery doesn't support contract info");
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
getTokenInfo(hash) {
|
|
126
|
-
const _super = Object.create(null, {
|
|
127
|
-
getTokenInfo: { get: () => super.getTokenInfo }
|
|
128
|
-
});
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
const mirrorNetwork = BitqueryBDSEthereum.MIRROR_NETWORK_BY_NETWORK_ID[__classPrivateFieldGet(this, _BitqueryBDSEthereum_network, "f").id];
|
|
131
|
-
if (!mirrorNetwork) {
|
|
132
|
-
return _super.getTokenInfo.call(this, hash);
|
|
133
|
-
}
|
|
134
|
-
if (__classPrivateFieldGet(this, _BitqueryBDSEthereum_tokenCache, "f").has(hash)) {
|
|
135
|
-
return __classPrivateFieldGet(this, _BitqueryBDSEthereum_tokenCache, "f").get(hash);
|
|
136
|
-
}
|
|
137
|
-
const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f").get(`/get-token-info/${hash}`, {
|
|
138
|
-
params: { network: mirrorNetwork },
|
|
139
|
-
});
|
|
140
|
-
if (!result.data || result.data.ethereum.smartContractCalls.length <= 0)
|
|
141
|
-
throw new Error('Token not found');
|
|
142
|
-
const { address: { address }, currency: { decimals, name, symbol, tokenType }, } = result.data.ethereum.smartContractCalls[0].smartContract;
|
|
143
|
-
if (tokenType !== 'ERC20')
|
|
144
|
-
throw new Error('Token is not ERC20');
|
|
145
|
-
const token = {
|
|
146
|
-
hash: address,
|
|
147
|
-
symbol,
|
|
148
|
-
decimals,
|
|
149
|
-
name,
|
|
150
|
-
};
|
|
151
|
-
__classPrivateFieldGet(this, _BitqueryBDSEthereum_tokenCache, "f").set(hash, token);
|
|
152
|
-
return token;
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
getBalance(address) {
|
|
156
|
-
const _super = Object.create(null, {
|
|
157
|
-
getBalance: { get: () => super.getBalance }
|
|
158
|
-
});
|
|
159
|
-
var _a, _b, _c, _d;
|
|
160
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
const mirrorNetwork = BitqueryBDSEthereum.MIRROR_NETWORK_BY_NETWORK_ID[__classPrivateFieldGet(this, _BitqueryBDSEthereum_network, "f").id];
|
|
162
|
-
if (!mirrorNetwork) {
|
|
163
|
-
return _super.getBalance.call(this, address);
|
|
164
|
-
}
|
|
165
|
-
const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f").get(`/get-balance/${address}`, {
|
|
166
|
-
params: { network: mirrorNetwork },
|
|
167
|
-
});
|
|
168
|
-
const data = (_b = (_a = result.data) === null || _a === void 0 ? void 0 : _a.ethereum.address[0].balances) !== null && _b !== void 0 ? _b : [];
|
|
169
|
-
const nativeBalance = (_d = (_c = result.data) === null || _c === void 0 ? void 0 : _c.ethereum.address[0].balance) !== null && _d !== void 0 ? _d : 0;
|
|
170
|
-
const nativeToken = BSEthereumHelper_1.BSEthereumHelper.getNativeAsset(__classPrivateFieldGet(this, _BitqueryBDSEthereum_network, "f"));
|
|
171
|
-
const balances = [
|
|
172
|
-
{
|
|
173
|
-
amount: nativeBalance.toString(),
|
|
174
|
-
token: nativeToken,
|
|
175
|
-
},
|
|
176
|
-
];
|
|
177
|
-
data.forEach(({ value, currency: { address, decimals, symbol, name } }) => {
|
|
178
|
-
if (value < 0 || address === nativeToken.hash)
|
|
179
|
-
return;
|
|
180
|
-
balances.push({
|
|
181
|
-
amount: value.toString(),
|
|
182
|
-
token: {
|
|
183
|
-
hash: address,
|
|
184
|
-
symbol,
|
|
185
|
-
name,
|
|
186
|
-
decimals,
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
return balances;
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
exports.BitqueryBDSEthereum = BitqueryBDSEthereum;
|
|
195
|
-
_BitqueryBDSEthereum_client = new WeakMap(), _BitqueryBDSEthereum_network = new WeakMap(), _BitqueryBDSEthereum_tokenCache = new WeakMap(), _BitqueryBDSEthereum_instances = new WeakSet(), _BitqueryBDSEthereum_parseTransactionTransfer = function _BitqueryBDSEthereum_parseTransactionTransfer({ amount, currency: { tokenType, address, decimals, symbol, name }, entityId, sender, receiver, }) {
|
|
196
|
-
if (tokenType === 'ERC721') {
|
|
197
|
-
return {
|
|
198
|
-
from: sender.address,
|
|
199
|
-
to: receiver.address,
|
|
200
|
-
tokenId: entityId,
|
|
201
|
-
contractHash: address,
|
|
202
|
-
type: 'nft',
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
return {
|
|
206
|
-
from: sender.address,
|
|
207
|
-
to: receiver.address,
|
|
208
|
-
contractHash: address,
|
|
209
|
-
amount: amount.toString(),
|
|
210
|
-
token: {
|
|
211
|
-
decimals: decimals,
|
|
212
|
-
hash: address,
|
|
213
|
-
symbol: symbol,
|
|
214
|
-
name: name,
|
|
215
|
-
},
|
|
216
|
-
type: 'token',
|
|
217
|
-
};
|
|
218
|
-
};
|
|
219
|
-
BitqueryBDSEthereum.MIRROR_URL = 'https://i4l7kcg43c.execute-api.us-east-1.amazonaws.com/production/';
|
|
220
|
-
BitqueryBDSEthereum.MIRROR_NETWORK_BY_NETWORK_ID = {
|
|
221
|
-
'1': 'ethereum',
|
|
222
|
-
'25': 'cronos',
|
|
223
|
-
'56': 'bsc',
|
|
224
|
-
'137': 'matic',
|
|
225
|
-
'250': 'fantom',
|
|
226
|
-
'42220': 'celo_mainnet',
|
|
227
|
-
'43114': 'avalanche',
|
|
228
|
-
};
|