@avalabs/vm-module-types 0.0.13 → 0.0.16

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 (117) hide show
  1. package/.turbo/turbo-build.log +107 -21
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/CHANGELOG.md +18 -0
  4. package/dist/balance.cjs +6 -0
  5. package/dist/balance.d.cts +103 -0
  6. package/dist/balance.d.ts +103 -0
  7. package/dist/balance.js +3 -0
  8. package/dist/chunk-4PGCXP4C.cjs +10 -0
  9. package/dist/chunk-4PGCXP4C.cjs.map +1 -0
  10. package/dist/chunk-74SNNWSF.cjs +9 -0
  11. package/dist/chunk-74SNNWSF.cjs.map +1 -0
  12. package/dist/chunk-7FBUAZNW.cjs +8 -0
  13. package/dist/chunk-7FBUAZNW.cjs.map +1 -0
  14. package/dist/chunk-7U2R34EQ.js +3 -0
  15. package/dist/chunk-7U2R34EQ.js.map +1 -0
  16. package/dist/chunk-A4YEBDMG.js +7 -0
  17. package/dist/chunk-A4YEBDMG.js.map +1 -0
  18. package/dist/chunk-AILYKQEY.cjs +4 -0
  19. package/dist/chunk-AILYKQEY.cjs.map +1 -0
  20. package/dist/chunk-BFBDZPL3.cjs +9 -0
  21. package/dist/chunk-BFBDZPL3.cjs.map +1 -0
  22. package/dist/chunk-BHB5UV3J.js +3 -0
  23. package/dist/chunk-BHB5UV3J.js.map +1 -0
  24. package/dist/chunk-CUVJNZP5.js +3 -0
  25. package/dist/chunk-CUVJNZP5.js.map +1 -0
  26. package/dist/chunk-H6ZZE5M7.js +5 -0
  27. package/dist/chunk-H6ZZE5M7.js.map +1 -0
  28. package/dist/chunk-JUV577XH.cjs +4 -0
  29. package/dist/chunk-JUV577XH.cjs.map +1 -0
  30. package/dist/chunk-KVTVJNN4.cjs +7 -0
  31. package/dist/chunk-KVTVJNN4.cjs.map +1 -0
  32. package/dist/chunk-OGQBQHLH.cjs +4 -0
  33. package/dist/chunk-OGQBQHLH.cjs.map +1 -0
  34. package/dist/chunk-TSO5BGJ4.js +5 -0
  35. package/dist/chunk-TSO5BGJ4.js.map +1 -0
  36. package/dist/chunk-WOO6UGSQ.js +7 -0
  37. package/dist/chunk-WOO6UGSQ.js.map +1 -0
  38. package/dist/chunk-XMGYJ4KK.js +5 -0
  39. package/dist/chunk-XMGYJ4KK.js.map +1 -0
  40. package/dist/chunk-XQGU7MZ4.cjs +7 -0
  41. package/dist/chunk-XQGU7MZ4.cjs.map +1 -0
  42. package/dist/chunk-YJHKZHST.js +5 -0
  43. package/dist/chunk-YJHKZHST.js.map +1 -0
  44. package/dist/coingecko.cjs +16 -0
  45. package/dist/coingecko.cjs.map +1 -0
  46. package/dist/coingecko.d.cts +23 -0
  47. package/dist/coingecko.d.ts +23 -0
  48. package/dist/coingecko.js +3 -0
  49. package/dist/coingecko.js.map +1 -0
  50. package/dist/common.cjs +12 -0
  51. package/dist/common.cjs.map +1 -0
  52. package/dist/common.d.cts +32 -0
  53. package/dist/common.d.ts +32 -0
  54. package/dist/common.js +3 -0
  55. package/dist/common.js.map +1 -0
  56. package/dist/index.cjs +31 -15
  57. package/dist/index.d.cts +11 -1
  58. package/dist/index.d.ts +11 -1
  59. package/dist/index.js +9 -1
  60. package/dist/manifest.cjs +12 -0
  61. package/dist/manifest.cjs.map +1 -0
  62. package/dist/manifest.d.cts +261 -0
  63. package/dist/manifest.d.ts +261 -0
  64. package/dist/manifest.js +3 -0
  65. package/dist/manifest.js.map +1 -0
  66. package/dist/module.cjs +6 -0
  67. package/dist/module.cjs.map +1 -0
  68. package/dist/module.d.cts +24 -0
  69. package/dist/module.d.ts +24 -0
  70. package/dist/module.js +3 -0
  71. package/dist/module.js.map +1 -0
  72. package/dist/network-fee.cjs +6 -0
  73. package/dist/network-fee.cjs.map +1 -0
  74. package/dist/network-fee.d.cts +18 -0
  75. package/dist/network-fee.d.ts +18 -0
  76. package/dist/network-fee.js +3 -0
  77. package/dist/network-fee.js.map +1 -0
  78. package/dist/rpc.cjs +16 -0
  79. package/dist/rpc.cjs.map +1 -0
  80. package/dist/rpc.d.cts +125 -0
  81. package/dist/rpc.d.ts +125 -0
  82. package/dist/rpc.js +3 -0
  83. package/dist/rpc.js.map +1 -0
  84. package/dist/token.cjs +12 -0
  85. package/dist/token.cjs.map +1 -0
  86. package/dist/token.d.cts +25 -0
  87. package/dist/token.d.ts +25 -0
  88. package/dist/token.js +3 -0
  89. package/dist/token.js.map +1 -0
  90. package/dist/transaction-history.cjs +20 -0
  91. package/dist/transaction-history.cjs.map +1 -0
  92. package/dist/transaction-history.d.cts +106 -0
  93. package/dist/transaction-history.d.ts +106 -0
  94. package/dist/transaction-history.js +3 -0
  95. package/dist/transaction-history.js.map +1 -0
  96. package/package.json +7 -2
  97. package/src/balance.ts +118 -0
  98. package/src/coingecko.ts +15 -0
  99. package/src/common.ts +34 -0
  100. package/src/index.ts +9 -1
  101. package/src/manifest.ts +40 -0
  102. package/src/module.ts +17 -0
  103. package/src/network-fee.ts +7 -0
  104. package/src/rpc.ts +144 -0
  105. package/src/token.ts +25 -0
  106. package/src/transaction-history.ts +113 -0
  107. package/dist/chunk-4RO2H63T.js +0 -7
  108. package/dist/chunk-4RO2H63T.js.map +0 -1
  109. package/dist/chunk-L7UO6W6T.cjs +0 -16
  110. package/dist/chunk-L7UO6W6T.cjs.map +0 -1
  111. package/dist/types.cjs +0 -40
  112. package/dist/types.d.cts +0 -516
  113. package/dist/types.d.ts +0 -516
  114. package/dist/types.js +0 -3
  115. package/src/types.ts +0 -328
  116. /package/dist/{types.cjs.map → balance.cjs.map} +0 -0
  117. /package/dist/{types.js.map → balance.js.map} +0 -0
package/dist/types.d.cts DELETED
@@ -1,516 +0,0 @@
1
- import { z } from 'zod';
2
- import { TransactionRequest } from 'ethers';
3
- import { JsonRpcError, OptionalDataWithOptionalCause, EthereumProviderError } from '@metamask/rpc-errors';
4
-
5
- declare enum TransactionType {
6
- BRIDGE = "Bridge",
7
- SWAP = "Swap",
8
- SEND = "Send",
9
- RECEIVE = "Receive",
10
- NFT_BUY = "NFTBuy",
11
- APPROVE = "Approve",
12
- TRANSFER = "Transfer",
13
- NFT_SEND = "NFTSend",
14
- NFT_RECEIVE = "NFTReceive",
15
- AIRDROP = "Airdrop",
16
- FILL_ORDER = "FillOrder",
17
- UNWRAP = "Unwrap",
18
- UNKNOWN = "UNKNOWN"
19
- }
20
- declare enum PChainTransactionType {
21
- ADD_VALIDATOR_TX = "AddValidatorTx",
22
- ADD_SUBNET_VALIDATOR_TX = "AddSubnetValidatorTx",
23
- ADD_DELEGATOR_TX = "AddDelegatorTx",
24
- CREATE_CHAIN_TX = "CreateChainTx",
25
- CREATE_SUBNET_TX = "CreateSubnetTx",
26
- IMPORT_TX = "ImportTx",
27
- EXPORT_TX = "ExportTx",
28
- ADVANCE_TIME_TX = "AdvanceTimeTx",
29
- REWARD_VALIDATOR_TX = "RewardValidatorTx",
30
- REMOVE_SUBNET_VALIDATOR_TX = "RemoveSubnetValidatorTx",
31
- TRANSFORM_SUBNET_TX = "TransformSubnetTx",
32
- ADD_PERMISSIONLESS_VALIDATOR_TX = "AddPermissionlessValidatorTx",
33
- ADD_PERMISSIONLESS_DELEGATOR_TX = "AddPermissionlessDelegatorTx",
34
- BASE_TX = "BaseTx",
35
- TRANSFER_SUBNET_OWNERSHIP_TX = "TransferSubnetOwnershipTx",
36
- UNKNOWN = "UNKNOWN"
37
- }
38
- declare enum XChainTransactionType {
39
- BASE_TX = "BaseTx",
40
- CREATE_ASSET_TX = "CreateAssetTx",
41
- OPERATION_TX = "OperationTx",
42
- IMPORT_TX = "ImportTx",
43
- EXPORT_TX = "ExportTx",
44
- UNKNOWN = "UNKNOWN"
45
- }
46
- declare enum TokenType {
47
- NATIVE = "NATIVE",
48
- ERC20 = "ERC20",
49
- ERC721 = "ERC721",
50
- ERC1155 = "ERC1155"
51
- }
52
- type NetworkFees = {
53
- low: {
54
- maxFeePerGas: bigint;
55
- maxPriorityFeePerGas?: bigint;
56
- };
57
- medium: {
58
- maxFeePerGas: bigint;
59
- maxPriorityFeePerGas?: bigint;
60
- };
61
- high: {
62
- maxFeePerGas: bigint;
63
- maxPriorityFeePerGas?: bigint;
64
- };
65
- baseFee: bigint;
66
- isFixedFee: boolean;
67
- };
68
- declare enum RpcMethod {
69
- ETH_SEND_TRANSACTION = "eth_sendTransaction",
70
- SIGN_TYPED_DATA_V3 = "eth_signTypedData_v3",
71
- SIGN_TYPED_DATA_V4 = "eth_signTypedData_v4",
72
- SIGN_TYPED_DATA_V1 = "eth_signTypedData_v1",
73
- SIGN_TYPED_DATA = "eth_signTypedData",
74
- PERSONAL_SIGN = "personal_sign",
75
- ETH_SIGN = "eth_sign"
76
- }
77
- type DappInfo = {
78
- name: string;
79
- url: string;
80
- icon: string;
81
- };
82
- type RpcRequest = {
83
- requestId: string;
84
- sessionId: string;
85
- method: RpcMethod;
86
- chainId: Caip2ChainId;
87
- params: unknown;
88
- dappInfo: DappInfo;
89
- context?: Record<string, unknown>;
90
- };
91
- type RpcError = JsonRpcError<OptionalDataWithOptionalCause> | EthereumProviderError<OptionalDataWithOptionalCause>;
92
- type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> = {
93
- result: R;
94
- } | {
95
- error: E;
96
- };
97
- type Network = {
98
- chainId: number;
99
- chainName: string;
100
- rpcUrl: string;
101
- networkToken: NetworkToken;
102
- utilityAddresses?: {
103
- multicall: string;
104
- };
105
- logoUrl?: string;
106
- isTestnet?: boolean;
107
- explorerUrl?: string;
108
- };
109
- interface Module {
110
- getManifest: () => Manifest | undefined;
111
- getBalances: () => Promise<string>;
112
- getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>;
113
- getNetworkFee: (network: Network) => Promise<NetworkFees>;
114
- getAddress: () => Promise<string>;
115
- getTokens: (network: Network) => Promise<NetworkContractToken[]>;
116
- onRpcRequest: (request: RpcRequest, network: Network) => Promise<RpcResponse>;
117
- }
118
- type GetTransactionHistory = {
119
- network: Network;
120
- address: string;
121
- nextPageToken?: string;
122
- offset?: number;
123
- };
124
- type TransactionHistoryResponse = {
125
- transactions: Transaction[];
126
- nextPageToken?: string;
127
- };
128
- type Transaction = {
129
- isContractCall: boolean;
130
- isIncoming: boolean;
131
- isOutgoing: boolean;
132
- isSender: boolean;
133
- timestamp: number;
134
- hash: string;
135
- from: string;
136
- to: string;
137
- tokens: TxToken[];
138
- gasPrice?: string;
139
- gasUsed: string;
140
- txType?: TransactionType | PChainTransactionType | XChainTransactionType;
141
- chainId: string;
142
- method?: string;
143
- explorerLink: string;
144
- };
145
- interface TxToken {
146
- decimal?: string;
147
- name: string;
148
- symbol: string;
149
- amount: string;
150
- imageUri?: string;
151
- from?: RichAddress;
152
- to?: RichAddress;
153
- collectableTokenId?: string;
154
- type: TokenType;
155
- }
156
- type RichAddress = {
157
- /**
158
- * The contract name.
159
- */
160
- name?: string;
161
- /**
162
- * The contract symbol.
163
- */
164
- symbol?: string;
165
- /**
166
- * The number of decimals the token uses. For example `6`, means to divide the token amount by `1000000` to get its user representation.
167
- */
168
- decimals?: number;
169
- /**
170
- * The logo uri for the address.
171
- */
172
- logoUri?: string;
173
- /**
174
- * A wallet or contract address in mixed-case checksum encoding.
175
- */
176
- address: string;
177
- };
178
- interface NetworkToken {
179
- name: string;
180
- symbol: string;
181
- description: string;
182
- decimals: number;
183
- logoUri: string;
184
- }
185
- interface NetworkContractToken {
186
- address: string;
187
- chainId?: number;
188
- color?: string;
189
- contractType: string;
190
- decimals: number;
191
- logoUri?: string;
192
- name: string;
193
- symbol: string;
194
- }
195
- declare const manifestSchema: z.ZodObject<{
196
- name: z.ZodString;
197
- version: z.ZodString;
198
- description: z.ZodString;
199
- sources: z.ZodObject<{
200
- module: z.ZodObject<{
201
- checksum: z.ZodString;
202
- location: z.ZodObject<{
203
- npm: z.ZodObject<{
204
- filePath: z.ZodString;
205
- packageName: z.ZodString;
206
- registry: z.ZodString;
207
- }, "strip", z.ZodTypeAny, {
208
- filePath: string;
209
- packageName: string;
210
- registry: string;
211
- }, {
212
- filePath: string;
213
- packageName: string;
214
- registry: string;
215
- }>;
216
- }, "strip", z.ZodTypeAny, {
217
- npm: {
218
- filePath: string;
219
- packageName: string;
220
- registry: string;
221
- };
222
- }, {
223
- npm: {
224
- filePath: string;
225
- packageName: string;
226
- registry: string;
227
- };
228
- }>;
229
- }, "strip", z.ZodTypeAny, {
230
- checksum: string;
231
- location: {
232
- npm: {
233
- filePath: string;
234
- packageName: string;
235
- registry: string;
236
- };
237
- };
238
- }, {
239
- checksum: string;
240
- location: {
241
- npm: {
242
- filePath: string;
243
- packageName: string;
244
- registry: string;
245
- };
246
- };
247
- }>;
248
- provider: z.ZodOptional<z.ZodObject<{
249
- checksum: z.ZodString;
250
- location: z.ZodObject<{
251
- npm: z.ZodObject<{
252
- filePath: z.ZodString;
253
- packageName: z.ZodString;
254
- registry: z.ZodString;
255
- }, "strip", z.ZodTypeAny, {
256
- filePath: string;
257
- packageName: string;
258
- registry: string;
259
- }, {
260
- filePath: string;
261
- packageName: string;
262
- registry: string;
263
- }>;
264
- }, "strip", z.ZodTypeAny, {
265
- npm: {
266
- filePath: string;
267
- packageName: string;
268
- registry: string;
269
- };
270
- }, {
271
- npm: {
272
- filePath: string;
273
- packageName: string;
274
- registry: string;
275
- };
276
- }>;
277
- }, "strip", z.ZodTypeAny, {
278
- checksum: string;
279
- location: {
280
- npm: {
281
- filePath: string;
282
- packageName: string;
283
- registry: string;
284
- };
285
- };
286
- }, {
287
- checksum: string;
288
- location: {
289
- npm: {
290
- filePath: string;
291
- packageName: string;
292
- registry: string;
293
- };
294
- };
295
- }>>;
296
- }, "strip", z.ZodTypeAny, {
297
- module: {
298
- checksum: string;
299
- location: {
300
- npm: {
301
- filePath: string;
302
- packageName: string;
303
- registry: string;
304
- };
305
- };
306
- };
307
- provider?: {
308
- checksum: string;
309
- location: {
310
- npm: {
311
- filePath: string;
312
- packageName: string;
313
- registry: string;
314
- };
315
- };
316
- } | undefined;
317
- }, {
318
- module: {
319
- checksum: string;
320
- location: {
321
- npm: {
322
- filePath: string;
323
- packageName: string;
324
- registry: string;
325
- };
326
- };
327
- };
328
- provider?: {
329
- checksum: string;
330
- location: {
331
- npm: {
332
- filePath: string;
333
- packageName: string;
334
- registry: string;
335
- };
336
- };
337
- } | undefined;
338
- }>;
339
- network: z.ZodObject<{
340
- chainIds: z.ZodArray<z.ZodString, "many">;
341
- namespaces: z.ZodArray<z.ZodString, "many">;
342
- }, "strip", z.ZodTypeAny, {
343
- chainIds: string[];
344
- namespaces: string[];
345
- }, {
346
- chainIds: string[];
347
- namespaces: string[];
348
- }>;
349
- cointype: z.ZodString;
350
- permissions: z.ZodObject<{
351
- rpc: z.ZodObject<{
352
- dapps: z.ZodBoolean;
353
- methods: z.ZodArray<z.ZodString, "many">;
354
- }, "strip", z.ZodTypeAny, {
355
- dapps: boolean;
356
- methods: string[];
357
- }, {
358
- dapps: boolean;
359
- methods: string[];
360
- }>;
361
- }, "strip", z.ZodTypeAny, {
362
- rpc: {
363
- dapps: boolean;
364
- methods: string[];
365
- };
366
- }, {
367
- rpc: {
368
- dapps: boolean;
369
- methods: string[];
370
- };
371
- }>;
372
- manifestVersion: z.ZodString;
373
- }, "strip", z.ZodTypeAny, {
374
- name: string;
375
- version: string;
376
- description: string;
377
- sources: {
378
- module: {
379
- checksum: string;
380
- location: {
381
- npm: {
382
- filePath: string;
383
- packageName: string;
384
- registry: string;
385
- };
386
- };
387
- };
388
- provider?: {
389
- checksum: string;
390
- location: {
391
- npm: {
392
- filePath: string;
393
- packageName: string;
394
- registry: string;
395
- };
396
- };
397
- } | undefined;
398
- };
399
- network: {
400
- chainIds: string[];
401
- namespaces: string[];
402
- };
403
- cointype: string;
404
- permissions: {
405
- rpc: {
406
- dapps: boolean;
407
- methods: string[];
408
- };
409
- };
410
- manifestVersion: string;
411
- }, {
412
- name: string;
413
- version: string;
414
- description: string;
415
- sources: {
416
- module: {
417
- checksum: string;
418
- location: {
419
- npm: {
420
- filePath: string;
421
- packageName: string;
422
- registry: string;
423
- };
424
- };
425
- };
426
- provider?: {
427
- checksum: string;
428
- location: {
429
- npm: {
430
- filePath: string;
431
- packageName: string;
432
- registry: string;
433
- };
434
- };
435
- } | undefined;
436
- };
437
- network: {
438
- chainIds: string[];
439
- namespaces: string[];
440
- };
441
- cointype: string;
442
- permissions: {
443
- rpc: {
444
- dapps: boolean;
445
- methods: string[];
446
- };
447
- };
448
- manifestVersion: string;
449
- }>;
450
- type Manifest = z.infer<typeof manifestSchema>;
451
- declare const parseManifest: (params: unknown) => z.SafeParseReturnType<unknown, Manifest>;
452
- type Caip2ChainId = string;
453
- type Hex = `0x${string}`;
454
- declare enum Environment {
455
- PRODUCTION = "production",
456
- DEV = "dev"
457
- }
458
- type DisplayData = {
459
- title: string;
460
- network: {
461
- chainId: number;
462
- name: string;
463
- logoUrl?: string;
464
- };
465
- messageDetails?: string;
466
- transactionDetails?: {
467
- website: string;
468
- from: string;
469
- to: string;
470
- data?: string;
471
- };
472
- networkFeeSelector?: boolean;
473
- };
474
- /**
475
- * Enum for different types of signing data.
476
- */
477
- declare enum SigningDataType {
478
- EVM_TRANSACTION = "evm_transaction",
479
- EVM_MESSAGE_ETH_SIGN = "evm_message_eth_sign",
480
- EVM_MESSAGE_PERSONAL_SIGN = "evm_message_personal_sign",
481
- EVM_MESSAGE_ETH_SIGN_TYPED_DATA = "evm_message_eth_sign_typed_data",
482
- EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V1 = "evm_message_eth_sign_typed_data_v1",
483
- EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V3 = "evm_message_eth_sign_typed_data_v3",
484
- EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V4 = "evm_message_eth_sign_typed_data_v4",
485
- AVALANCHE_TRANSACTION = "avalanche_transaction",
486
- AVALANCHE_MESSAGE = "avalanche_message",
487
- BTC_TRANSACTION = "btc_transaction"
488
- }
489
- type SigningData = {
490
- type: SigningDataType.EVM_TRANSACTION;
491
- account: string;
492
- chainId: number;
493
- data: TransactionRequest;
494
- } | {
495
- type: SigningDataType.EVM_MESSAGE_ETH_SIGN;
496
- account: string;
497
- chainId: number;
498
- data: string;
499
- };
500
- type ApprovalParams = {
501
- request: RpcRequest;
502
- displayData: DisplayData;
503
- signingData: SigningData;
504
- };
505
- type ApprovalResponse = {
506
- result: Hex;
507
- } | {
508
- error: RpcError;
509
- };
510
- interface ApprovalController {
511
- requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
512
- onTransactionConfirmed: (txHash: Hex) => void;
513
- onTransactionReverted: (txHash: Hex) => void;
514
- }
515
-
516
- export { ApprovalController, ApprovalParams, ApprovalResponse, Caip2ChainId, DappInfo, DisplayData, Environment, GetTransactionHistory, Hex, Manifest, Module, Network, NetworkContractToken, NetworkFees, NetworkToken, PChainTransactionType, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningDataType, TokenType, Transaction, TransactionHistoryResponse, TransactionType, TxToken, XChainTransactionType, parseManifest };