@avalabs/evm-module 0.0.12 → 0.0.15

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.
Files changed (42) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +11 -6
  4. package/CHANGELOG.md +27 -0
  5. package/dist/index.cjs +10 -7
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +6 -5
  8. package/dist/index.d.ts +6 -5
  9. package/dist/index.js +10 -8
  10. package/dist/index.js.map +1 -1
  11. package/package.json +17 -10
  12. package/src/contracts/openzeppelin/ERC1155.ts +440 -0
  13. package/src/contracts/openzeppelin/ERC20.ts +330 -0
  14. package/src/contracts/openzeppelin/ERC721.ts +420 -0
  15. package/src/contracts/openzeppelin/common.ts +131 -0
  16. package/src/contracts/openzeppelin/factories/ERC1155__factory.ts +388 -0
  17. package/src/contracts/openzeppelin/factories/ERC20__factory.ts +353 -0
  18. package/src/contracts/openzeppelin/factories/ERC721__factory.ts +413 -0
  19. package/src/contracts/openzeppelin/factories/index.ts +6 -0
  20. package/src/contracts/openzeppelin/index.ts +10 -0
  21. package/src/handlers/eth-send-transaction/eth-send-transaction.test.ts +2 -2
  22. package/src/handlers/eth-send-transaction/eth-send-transaction.ts +1 -1
  23. package/src/handlers/get-balances/evm-balance-service/get-erc20-balances.test.ts +78 -0
  24. package/src/handlers/get-balances/evm-balance-service/get-erc20-balances.ts +85 -0
  25. package/src/handlers/get-balances/evm-balance-service/get-native-token-balances.test.ts +102 -0
  26. package/src/handlers/get-balances/evm-balance-service/get-native-token-balances.ts +54 -0
  27. package/src/handlers/get-balances/get-balances.test.ts +252 -0
  28. package/src/handlers/get-balances/get-balances.ts +109 -0
  29. package/src/handlers/get-balances/glacier-balance-service/get-erc20-balances.test.ts +76 -0
  30. package/src/handlers/get-balances/glacier-balance-service/get-erc20-balances.ts +107 -0
  31. package/src/handlers/get-balances/glacier-balance-service/get-native-token-balances.test.ts +61 -0
  32. package/src/handlers/get-balances/glacier-balance-service/get-native-token-balances.ts +46 -0
  33. package/src/handlers/get-network-fee/get-network-fee.test.ts +1 -1
  34. package/src/handlers/get-network-fee/get-network-fee.ts +1 -1
  35. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-transaction-from-glacier.test.ts +72 -59
  36. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-transactions-from-glacier.ts +4 -11
  37. package/src/handlers/get-transaction-history/get-transaction-history.test.ts +7 -2
  38. package/src/handlers/get-transaction-history/get-transaction-history.ts +13 -3
  39. package/src/module.ts +18 -8
  40. package/src/services/glacier-service/glacier-service.ts +259 -0
  41. package/tsconfig.json +1 -0
  42. /package/{src/manifest.json → manifest.json} +0 -0
package/package.json CHANGED
@@ -1,23 +1,28 @@
1
1
  {
2
2
  "name": "@avalabs/evm-module",
3
- "version": "0.0.12",
3
+ "version": "0.0.15",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "type": "module",
8
8
  "dependencies": {
9
- "@avalabs/vm-module-types": "0.0.12",
10
- "@avalabs/utils-sdk": "v2.8.0-alpha.187",
11
- "@avalabs/chains-sdk": "v2.8.0-alpha.187",
12
- "@avalabs/etherscan-sdk": "v2.8.0-alpha.187",
13
- "@avalabs/glacier-sdk": "v2.8.0-alpha.187",
14
- "@avalabs/wallets-sdk": "v2.8.0-alpha.187",
9
+ "@avalabs/vm-module-types": "0.0.15",
10
+ "@zodios/core": "10.9.6",
11
+ "@avalabs/coingecko-sdk": "v2.8.0-alpha.193",
12
+ "@avalabs/utils-sdk": "2.8.0-alpha.193",
13
+ "@avalabs/etherscan-sdk": "v2.8.0-alpha.193",
14
+ "@avalabs/glacier-sdk": "v2.8.0-alpha.193",
15
+ "@avalabs/wallets-sdk": "v2.8.0-alpha.193",
15
16
  "bn.js": "5.2.1",
16
17
  "lodash.startcase": "4.4.0",
17
18
  "@metamask/rpc-errors": "6.3.0",
18
- "zod": "3.23.8"
19
+ "zod": "3.23.8",
20
+ "@internal/utils": "0.0.3"
19
21
  },
20
22
  "devDependencies": {
23
+ "typechain": "8.3.1",
24
+ "@typechain/ethers-v6": "0.5.0",
25
+ "@openzeppelin/contracts": "4.9.3",
21
26
  "@types/bn.js": "5.1.5",
22
27
  "@types/jest": "29.5.7",
23
28
  "@types/lodash.startcase": "4.4.9",
@@ -26,7 +31,7 @@
26
31
  "tsup": "7.2.0",
27
32
  "ethers": "6.8.1",
28
33
  "@internal/tsup-config": "0.0.1",
29
- "eslint-config-custom": "0.0.2"
34
+ "eslint-config-custom": "0.0.3"
30
35
  },
31
36
  "peerDependencies": {
32
37
  "ethers": "^6.8.1"
@@ -35,6 +40,8 @@
35
40
  "build": "tsup",
36
41
  "lint": "eslint \"src/**/*.ts\"",
37
42
  "test": "jest",
38
- "test:watch": "jest --watch"
43
+ "test:watch": "jest --watch",
44
+ "gen:contracts": "typechain --target=ethers-v6 --out-dir src/contracts/openzeppelin ./node_modules/@openzeppelin/contracts/build/contracts/ERC20.json ./node_modules/@openzeppelin/contracts/build/contracts/ERC721.json ./node_modules/@openzeppelin/contracts/build/contracts/ERC1155.json",
45
+ "postinstall": "pnpm run gen:contracts"
39
46
  }
40
47
  }
@@ -0,0 +1,440 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import type {
5
+ BaseContract,
6
+ BigNumberish,
7
+ BytesLike,
8
+ FunctionFragment,
9
+ Result,
10
+ Interface,
11
+ EventFragment,
12
+ AddressLike,
13
+ ContractRunner,
14
+ ContractMethod,
15
+ Listener,
16
+ } from "ethers";
17
+ import type {
18
+ TypedContractEvent,
19
+ TypedDeferredTopicFilter,
20
+ TypedEventLog,
21
+ TypedLogDescription,
22
+ TypedListener,
23
+ TypedContractMethod,
24
+ } from "./common";
25
+
26
+ export interface ERC1155Interface extends Interface {
27
+ getFunction(
28
+ nameOrSignature:
29
+ | "balanceOf"
30
+ | "balanceOfBatch"
31
+ | "isApprovedForAll"
32
+ | "safeBatchTransferFrom"
33
+ | "safeTransferFrom"
34
+ | "setApprovalForAll"
35
+ | "supportsInterface"
36
+ | "uri"
37
+ ): FunctionFragment;
38
+
39
+ getEvent(
40
+ nameOrSignatureOrTopic:
41
+ | "ApprovalForAll"
42
+ | "TransferBatch"
43
+ | "TransferSingle"
44
+ | "URI"
45
+ ): EventFragment;
46
+
47
+ encodeFunctionData(
48
+ functionFragment: "balanceOf",
49
+ values: [AddressLike, BigNumberish]
50
+ ): string;
51
+ encodeFunctionData(
52
+ functionFragment: "balanceOfBatch",
53
+ values: [AddressLike[], BigNumberish[]]
54
+ ): string;
55
+ encodeFunctionData(
56
+ functionFragment: "isApprovedForAll",
57
+ values: [AddressLike, AddressLike]
58
+ ): string;
59
+ encodeFunctionData(
60
+ functionFragment: "safeBatchTransferFrom",
61
+ values: [
62
+ AddressLike,
63
+ AddressLike,
64
+ BigNumberish[],
65
+ BigNumberish[],
66
+ BytesLike
67
+ ]
68
+ ): string;
69
+ encodeFunctionData(
70
+ functionFragment: "safeTransferFrom",
71
+ values: [AddressLike, AddressLike, BigNumberish, BigNumberish, BytesLike]
72
+ ): string;
73
+ encodeFunctionData(
74
+ functionFragment: "setApprovalForAll",
75
+ values: [AddressLike, boolean]
76
+ ): string;
77
+ encodeFunctionData(
78
+ functionFragment: "supportsInterface",
79
+ values: [BytesLike]
80
+ ): string;
81
+ encodeFunctionData(functionFragment: "uri", values: [BigNumberish]): string;
82
+
83
+ decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result;
84
+ decodeFunctionResult(
85
+ functionFragment: "balanceOfBatch",
86
+ data: BytesLike
87
+ ): Result;
88
+ decodeFunctionResult(
89
+ functionFragment: "isApprovedForAll",
90
+ data: BytesLike
91
+ ): Result;
92
+ decodeFunctionResult(
93
+ functionFragment: "safeBatchTransferFrom",
94
+ data: BytesLike
95
+ ): Result;
96
+ decodeFunctionResult(
97
+ functionFragment: "safeTransferFrom",
98
+ data: BytesLike
99
+ ): Result;
100
+ decodeFunctionResult(
101
+ functionFragment: "setApprovalForAll",
102
+ data: BytesLike
103
+ ): Result;
104
+ decodeFunctionResult(
105
+ functionFragment: "supportsInterface",
106
+ data: BytesLike
107
+ ): Result;
108
+ decodeFunctionResult(functionFragment: "uri", data: BytesLike): Result;
109
+ }
110
+
111
+ export namespace ApprovalForAllEvent {
112
+ export type InputTuple = [
113
+ account: AddressLike,
114
+ operator: AddressLike,
115
+ approved: boolean
116
+ ];
117
+ export type OutputTuple = [
118
+ account: string,
119
+ operator: string,
120
+ approved: boolean
121
+ ];
122
+ export interface OutputObject {
123
+ account: string;
124
+ operator: string;
125
+ approved: boolean;
126
+ }
127
+ export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
128
+ export type Filter = TypedDeferredTopicFilter<Event>;
129
+ export type Log = TypedEventLog<Event>;
130
+ export type LogDescription = TypedLogDescription<Event>;
131
+ }
132
+
133
+ export namespace TransferBatchEvent {
134
+ export type InputTuple = [
135
+ operator: AddressLike,
136
+ from: AddressLike,
137
+ to: AddressLike,
138
+ ids: BigNumberish[],
139
+ values: BigNumberish[]
140
+ ];
141
+ export type OutputTuple = [
142
+ operator: string,
143
+ from: string,
144
+ to: string,
145
+ ids: bigint[],
146
+ values: bigint[]
147
+ ];
148
+ export interface OutputObject {
149
+ operator: string;
150
+ from: string;
151
+ to: string;
152
+ ids: bigint[];
153
+ values: bigint[];
154
+ }
155
+ export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
156
+ export type Filter = TypedDeferredTopicFilter<Event>;
157
+ export type Log = TypedEventLog<Event>;
158
+ export type LogDescription = TypedLogDescription<Event>;
159
+ }
160
+
161
+ export namespace TransferSingleEvent {
162
+ export type InputTuple = [
163
+ operator: AddressLike,
164
+ from: AddressLike,
165
+ to: AddressLike,
166
+ id: BigNumberish,
167
+ value: BigNumberish
168
+ ];
169
+ export type OutputTuple = [
170
+ operator: string,
171
+ from: string,
172
+ to: string,
173
+ id: bigint,
174
+ value: bigint
175
+ ];
176
+ export interface OutputObject {
177
+ operator: string;
178
+ from: string;
179
+ to: string;
180
+ id: bigint;
181
+ value: bigint;
182
+ }
183
+ export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
184
+ export type Filter = TypedDeferredTopicFilter<Event>;
185
+ export type Log = TypedEventLog<Event>;
186
+ export type LogDescription = TypedLogDescription<Event>;
187
+ }
188
+
189
+ export namespace URIEvent {
190
+ export type InputTuple = [value: string, id: BigNumberish];
191
+ export type OutputTuple = [value: string, id: bigint];
192
+ export interface OutputObject {
193
+ value: string;
194
+ id: bigint;
195
+ }
196
+ export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
197
+ export type Filter = TypedDeferredTopicFilter<Event>;
198
+ export type Log = TypedEventLog<Event>;
199
+ export type LogDescription = TypedLogDescription<Event>;
200
+ }
201
+
202
+ export interface ERC1155 extends BaseContract {
203
+ connect(runner?: ContractRunner | null): ERC1155;
204
+ waitForDeployment(): Promise<this>;
205
+
206
+ interface: ERC1155Interface;
207
+
208
+ queryFilter<TCEvent extends TypedContractEvent>(
209
+ event: TCEvent,
210
+ fromBlockOrBlockhash?: string | number | undefined,
211
+ toBlock?: string | number | undefined
212
+ ): Promise<Array<TypedEventLog<TCEvent>>>;
213
+ queryFilter<TCEvent extends TypedContractEvent>(
214
+ filter: TypedDeferredTopicFilter<TCEvent>,
215
+ fromBlockOrBlockhash?: string | number | undefined,
216
+ toBlock?: string | number | undefined
217
+ ): Promise<Array<TypedEventLog<TCEvent>>>;
218
+
219
+ on<TCEvent extends TypedContractEvent>(
220
+ event: TCEvent,
221
+ listener: TypedListener<TCEvent>
222
+ ): Promise<this>;
223
+ on<TCEvent extends TypedContractEvent>(
224
+ filter: TypedDeferredTopicFilter<TCEvent>,
225
+ listener: TypedListener<TCEvent>
226
+ ): Promise<this>;
227
+
228
+ once<TCEvent extends TypedContractEvent>(
229
+ event: TCEvent,
230
+ listener: TypedListener<TCEvent>
231
+ ): Promise<this>;
232
+ once<TCEvent extends TypedContractEvent>(
233
+ filter: TypedDeferredTopicFilter<TCEvent>,
234
+ listener: TypedListener<TCEvent>
235
+ ): Promise<this>;
236
+
237
+ listeners<TCEvent extends TypedContractEvent>(
238
+ event: TCEvent
239
+ ): Promise<Array<TypedListener<TCEvent>>>;
240
+ listeners(eventName?: string): Promise<Array<Listener>>;
241
+ removeAllListeners<TCEvent extends TypedContractEvent>(
242
+ event?: TCEvent
243
+ ): Promise<this>;
244
+
245
+ balanceOf: TypedContractMethod<
246
+ [account: AddressLike, id: BigNumberish],
247
+ [bigint],
248
+ "view"
249
+ >;
250
+
251
+ balanceOfBatch: TypedContractMethod<
252
+ [accounts: AddressLike[], ids: BigNumberish[]],
253
+ [bigint[]],
254
+ "view"
255
+ >;
256
+
257
+ isApprovedForAll: TypedContractMethod<
258
+ [account: AddressLike, operator: AddressLike],
259
+ [boolean],
260
+ "view"
261
+ >;
262
+
263
+ safeBatchTransferFrom: TypedContractMethod<
264
+ [
265
+ from: AddressLike,
266
+ to: AddressLike,
267
+ ids: BigNumberish[],
268
+ amounts: BigNumberish[],
269
+ data: BytesLike
270
+ ],
271
+ [void],
272
+ "nonpayable"
273
+ >;
274
+
275
+ safeTransferFrom: TypedContractMethod<
276
+ [
277
+ from: AddressLike,
278
+ to: AddressLike,
279
+ id: BigNumberish,
280
+ amount: BigNumberish,
281
+ data: BytesLike
282
+ ],
283
+ [void],
284
+ "nonpayable"
285
+ >;
286
+
287
+ setApprovalForAll: TypedContractMethod<
288
+ [operator: AddressLike, approved: boolean],
289
+ [void],
290
+ "nonpayable"
291
+ >;
292
+
293
+ supportsInterface: TypedContractMethod<
294
+ [interfaceId: BytesLike],
295
+ [boolean],
296
+ "view"
297
+ >;
298
+
299
+ uri: TypedContractMethod<[arg0: BigNumberish], [string], "view">;
300
+
301
+ getFunction<T extends ContractMethod = ContractMethod>(
302
+ key: string | FunctionFragment
303
+ ): T;
304
+
305
+ getFunction(
306
+ nameOrSignature: "balanceOf"
307
+ ): TypedContractMethod<
308
+ [account: AddressLike, id: BigNumberish],
309
+ [bigint],
310
+ "view"
311
+ >;
312
+ getFunction(
313
+ nameOrSignature: "balanceOfBatch"
314
+ ): TypedContractMethod<
315
+ [accounts: AddressLike[], ids: BigNumberish[]],
316
+ [bigint[]],
317
+ "view"
318
+ >;
319
+ getFunction(
320
+ nameOrSignature: "isApprovedForAll"
321
+ ): TypedContractMethod<
322
+ [account: AddressLike, operator: AddressLike],
323
+ [boolean],
324
+ "view"
325
+ >;
326
+ getFunction(
327
+ nameOrSignature: "safeBatchTransferFrom"
328
+ ): TypedContractMethod<
329
+ [
330
+ from: AddressLike,
331
+ to: AddressLike,
332
+ ids: BigNumberish[],
333
+ amounts: BigNumberish[],
334
+ data: BytesLike
335
+ ],
336
+ [void],
337
+ "nonpayable"
338
+ >;
339
+ getFunction(
340
+ nameOrSignature: "safeTransferFrom"
341
+ ): TypedContractMethod<
342
+ [
343
+ from: AddressLike,
344
+ to: AddressLike,
345
+ id: BigNumberish,
346
+ amount: BigNumberish,
347
+ data: BytesLike
348
+ ],
349
+ [void],
350
+ "nonpayable"
351
+ >;
352
+ getFunction(
353
+ nameOrSignature: "setApprovalForAll"
354
+ ): TypedContractMethod<
355
+ [operator: AddressLike, approved: boolean],
356
+ [void],
357
+ "nonpayable"
358
+ >;
359
+ getFunction(
360
+ nameOrSignature: "supportsInterface"
361
+ ): TypedContractMethod<[interfaceId: BytesLike], [boolean], "view">;
362
+ getFunction(
363
+ nameOrSignature: "uri"
364
+ ): TypedContractMethod<[arg0: BigNumberish], [string], "view">;
365
+
366
+ getEvent(
367
+ key: "ApprovalForAll"
368
+ ): TypedContractEvent<
369
+ ApprovalForAllEvent.InputTuple,
370
+ ApprovalForAllEvent.OutputTuple,
371
+ ApprovalForAllEvent.OutputObject
372
+ >;
373
+ getEvent(
374
+ key: "TransferBatch"
375
+ ): TypedContractEvent<
376
+ TransferBatchEvent.InputTuple,
377
+ TransferBatchEvent.OutputTuple,
378
+ TransferBatchEvent.OutputObject
379
+ >;
380
+ getEvent(
381
+ key: "TransferSingle"
382
+ ): TypedContractEvent<
383
+ TransferSingleEvent.InputTuple,
384
+ TransferSingleEvent.OutputTuple,
385
+ TransferSingleEvent.OutputObject
386
+ >;
387
+ getEvent(
388
+ key: "URI"
389
+ ): TypedContractEvent<
390
+ URIEvent.InputTuple,
391
+ URIEvent.OutputTuple,
392
+ URIEvent.OutputObject
393
+ >;
394
+
395
+ filters: {
396
+ "ApprovalForAll(address,address,bool)": TypedContractEvent<
397
+ ApprovalForAllEvent.InputTuple,
398
+ ApprovalForAllEvent.OutputTuple,
399
+ ApprovalForAllEvent.OutputObject
400
+ >;
401
+ ApprovalForAll: TypedContractEvent<
402
+ ApprovalForAllEvent.InputTuple,
403
+ ApprovalForAllEvent.OutputTuple,
404
+ ApprovalForAllEvent.OutputObject
405
+ >;
406
+
407
+ "TransferBatch(address,address,address,uint256[],uint256[])": TypedContractEvent<
408
+ TransferBatchEvent.InputTuple,
409
+ TransferBatchEvent.OutputTuple,
410
+ TransferBatchEvent.OutputObject
411
+ >;
412
+ TransferBatch: TypedContractEvent<
413
+ TransferBatchEvent.InputTuple,
414
+ TransferBatchEvent.OutputTuple,
415
+ TransferBatchEvent.OutputObject
416
+ >;
417
+
418
+ "TransferSingle(address,address,address,uint256,uint256)": TypedContractEvent<
419
+ TransferSingleEvent.InputTuple,
420
+ TransferSingleEvent.OutputTuple,
421
+ TransferSingleEvent.OutputObject
422
+ >;
423
+ TransferSingle: TypedContractEvent<
424
+ TransferSingleEvent.InputTuple,
425
+ TransferSingleEvent.OutputTuple,
426
+ TransferSingleEvent.OutputObject
427
+ >;
428
+
429
+ "URI(string,uint256)": TypedContractEvent<
430
+ URIEvent.InputTuple,
431
+ URIEvent.OutputTuple,
432
+ URIEvent.OutputObject
433
+ >;
434
+ URI: TypedContractEvent<
435
+ URIEvent.InputTuple,
436
+ URIEvent.OutputTuple,
437
+ URIEvent.OutputObject
438
+ >;
439
+ };
440
+ }