@avalabs/vm-module-types 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 (115) hide show
  1. package/.turbo/turbo-build.log +107 -21
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/CHANGELOG.md +19 -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-7U2R34EQ.js +3 -0
  13. package/dist/chunk-7U2R34EQ.js.map +1 -0
  14. package/dist/chunk-A4YEBDMG.js +7 -0
  15. package/dist/chunk-A4YEBDMG.js.map +1 -0
  16. package/dist/chunk-AILYKQEY.cjs +4 -0
  17. package/dist/chunk-AILYKQEY.cjs.map +1 -0
  18. package/dist/chunk-BFBDZPL3.cjs +9 -0
  19. package/dist/chunk-BFBDZPL3.cjs.map +1 -0
  20. package/dist/chunk-BHB5UV3J.js +3 -0
  21. package/dist/chunk-BHB5UV3J.js.map +1 -0
  22. package/dist/chunk-CUVJNZP5.js +3 -0
  23. package/dist/chunk-CUVJNZP5.js.map +1 -0
  24. package/dist/chunk-FKFLXQOJ.js +5 -0
  25. package/dist/chunk-FKFLXQOJ.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-ISTALLTN.cjs +8 -0
  29. package/dist/chunk-ISTALLTN.cjs.map +1 -0
  30. package/dist/chunk-JUV577XH.cjs +4 -0
  31. package/dist/chunk-JUV577XH.cjs.map +1 -0
  32. package/dist/chunk-KVTVJNN4.cjs +7 -0
  33. package/dist/chunk-KVTVJNN4.cjs.map +1 -0
  34. package/dist/chunk-OGQBQHLH.cjs +4 -0
  35. package/dist/chunk-OGQBQHLH.cjs.map +1 -0
  36. package/dist/chunk-TSO5BGJ4.js +5 -0
  37. package/dist/chunk-TSO5BGJ4.js.map +1 -0
  38. package/dist/chunk-WOO6UGSQ.js +7 -0
  39. package/dist/chunk-WOO6UGSQ.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 +36 -12
  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/{types.d.cts → manifest.d.cts} +1 -229
  63. package/dist/{types.d.ts → manifest.d.ts} +1 -229
  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 +96 -0
  81. package/dist/rpc.d.ts +96 -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 +117 -0
  105. package/src/token.ts +25 -0
  106. package/src/transaction-history.ts +113 -0
  107. package/dist/chunk-ODMEO2D7.js +0 -7
  108. package/dist/chunk-ODMEO2D7.js.map +0 -1
  109. package/dist/chunk-TJUF73LQ.cjs +0 -14
  110. package/dist/chunk-TJUF73LQ.cjs.map +0 -1
  111. package/dist/types.cjs +0 -32
  112. package/dist/types.js +0 -3
  113. package/src/types.ts +0 -299
  114. /package/dist/{types.cjs.map → balance.cjs.map} +0 -0
  115. /package/dist/{types.js.map → balance.js.map} +0 -0
@@ -1,170 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { TransactionRequest } from 'ethers';
3
- import { JsonRpcError, OptionalDataWithOptionalCause, EthereumProviderError } from '@metamask/rpc-errors';
4
2
 
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 TokenType {
21
- NATIVE = "NATIVE",
22
- ERC20 = "ERC20",
23
- ERC721 = "ERC721",
24
- ERC1155 = "ERC1155"
25
- }
26
- type NetworkFees = {
27
- low: {
28
- maxPriorityFeePerGas: bigint;
29
- maxFeePerGas: bigint;
30
- };
31
- medium: {
32
- maxPriorityFeePerGas: bigint;
33
- maxFeePerGas: bigint;
34
- };
35
- high: {
36
- maxPriorityFeePerGas: bigint;
37
- maxFeePerGas: bigint;
38
- };
39
- baseFee: bigint;
40
- };
41
- declare enum RpcMethod {
42
- ETH_SEND_TRANSACTION = "eth_sendTransaction",
43
- SIGN_TYPED_DATA_V3 = "eth_signTypedData_v3",
44
- SIGN_TYPED_DATA_V4 = "eth_signTypedData_v4",
45
- SIGN_TYPED_DATA_V1 = "eth_signTypedData_v1",
46
- SIGN_TYPED_DATA = "eth_signTypedData",
47
- PERSONAL_SIGN = "personal_sign",
48
- ETH_SIGN = "eth_sign"
49
- }
50
- type DappInfo = {
51
- name: string;
52
- url: string;
53
- icon: string;
54
- };
55
- type RpcRequest = {
56
- requestId: string;
57
- sessionId: string;
58
- method: RpcMethod;
59
- chainId: Caip2ChainId;
60
- params: unknown;
61
- dappInfo: DappInfo;
62
- context?: Record<string, unknown>;
63
- };
64
- type RpcError = JsonRpcError<OptionalDataWithOptionalCause> | EthereumProviderError<OptionalDataWithOptionalCause>;
65
- type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> = {
66
- result: R;
67
- } | {
68
- error: E;
69
- };
70
- type Network = {
71
- chainId: number;
72
- chainName: string;
73
- rpcUrl: string;
74
- networkToken: NetworkToken;
75
- utilityAddresses?: {
76
- multicall: string;
77
- };
78
- logoUrl?: string;
79
- isTestnet?: boolean;
80
- explorerUrl?: string;
81
- };
82
- interface Module {
83
- getManifest: () => Manifest | undefined;
84
- getBalances: () => Promise<string>;
85
- getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>;
86
- getNetworkFee: (network: Network) => Promise<NetworkFees>;
87
- getAddress: () => Promise<string>;
88
- getTokens: (network: Network) => Promise<NetworkContractToken[]>;
89
- onRpcRequest: (request: RpcRequest, network: Network) => Promise<RpcResponse>;
90
- }
91
- type GetTransactionHistory = {
92
- network: Network;
93
- address: string;
94
- nextPageToken?: string;
95
- offset?: number;
96
- };
97
- type TransactionHistoryResponse = {
98
- transactions: Transaction[];
99
- nextPageToken?: string;
100
- };
101
- type Transaction = {
102
- isContractCall: boolean;
103
- isIncoming: boolean;
104
- isOutgoing: boolean;
105
- isSender: boolean;
106
- timestamp: number;
107
- hash: string;
108
- from: string;
109
- to: string;
110
- tokens: TxToken[];
111
- gasPrice?: string;
112
- gasUsed: string;
113
- txType?: TransactionType;
114
- chainId: string;
115
- method?: string;
116
- explorerLink: string;
117
- };
118
- interface TxToken {
119
- decimal?: string;
120
- name: string;
121
- symbol: string;
122
- amount: string;
123
- imageUri?: string;
124
- from?: RichAddress;
125
- to?: RichAddress;
126
- collectableTokenId?: string;
127
- type: TokenType;
128
- }
129
- type RichAddress = {
130
- /**
131
- * The contract name.
132
- */
133
- name?: string;
134
- /**
135
- * The contract symbol.
136
- */
137
- symbol?: string;
138
- /**
139
- * The number of decimals the token uses. For example `6`, means to divide the token amount by `1000000` to get its user representation.
140
- */
141
- decimals?: number;
142
- /**
143
- * The logo uri for the address.
144
- */
145
- logoUri?: string;
146
- /**
147
- * A wallet or contract address in mixed-case checksum encoding.
148
- */
149
- address: string;
150
- };
151
- interface NetworkToken {
152
- name: string;
153
- symbol: string;
154
- description: string;
155
- decimals: number;
156
- logoUri: string;
157
- }
158
- interface NetworkContractToken {
159
- address: string;
160
- chainId?: number;
161
- color?: string;
162
- contractType: string;
163
- decimals: number;
164
- logoUri?: string;
165
- name: string;
166
- symbol: string;
167
- }
168
3
  declare const manifestSchema: z.ZodObject<{
169
4
  name: z.ZodString;
170
5
  version: z.ZodString;
@@ -422,68 +257,5 @@ declare const manifestSchema: z.ZodObject<{
422
257
  }>;
423
258
  type Manifest = z.infer<typeof manifestSchema>;
424
259
  declare const parseManifest: (params: unknown) => z.SafeParseReturnType<unknown, Manifest>;
425
- type Caip2ChainId = string;
426
- type Hex = `0x${string}`;
427
- declare enum Environment {
428
- PRODUCTION = "production",
429
- DEV = "dev"
430
- }
431
- type DisplayData = {
432
- title: string;
433
- network: {
434
- chainId: number;
435
- name: string;
436
- logoUrl?: string;
437
- };
438
- messageDetails?: string;
439
- transactionDetails?: {
440
- website: string;
441
- from: string;
442
- to: string;
443
- data?: string;
444
- };
445
- networkFeeSelector?: boolean;
446
- };
447
- /**
448
- * Enum for different types of signing data.
449
- */
450
- declare enum SigningDataType {
451
- EVM_TRANSACTION = "evm_transaction",
452
- EVM_MESSAGE_ETH_SIGN = "evm_message_eth_sign",
453
- EVM_MESSAGE_PERSONAL_SIGN = "evm_message_personal_sign",
454
- EVM_MESSAGE_ETH_SIGN_TYPED_DATA = "evm_message_eth_sign_typed_data",
455
- EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V1 = "evm_message_eth_sign_typed_data_v1",
456
- EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V3 = "evm_message_eth_sign_typed_data_v3",
457
- EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V4 = "evm_message_eth_sign_typed_data_v4",
458
- AVALANCHE_TRANSACTION = "avalanche_transaction",
459
- AVALANCHE_MESSAGE = "avalanche_message",
460
- BTC_TRANSACTION = "btc_transaction"
461
- }
462
- type SigningData = {
463
- type: SigningDataType.EVM_TRANSACTION;
464
- account: string;
465
- chainId: number;
466
- data: TransactionRequest;
467
- } | {
468
- type: SigningDataType.EVM_MESSAGE_ETH_SIGN;
469
- account: string;
470
- chainId: number;
471
- data: string;
472
- };
473
- type ApprovalParams = {
474
- request: RpcRequest;
475
- displayData: DisplayData;
476
- signingData: SigningData;
477
- };
478
- type ApprovalResponse = {
479
- result: Hex;
480
- } | {
481
- error: RpcError;
482
- };
483
- interface ApprovalController {
484
- requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
485
- onTransactionConfirmed: (txHash: Hex) => void;
486
- onTransactionReverted: (txHash: Hex) => void;
487
- }
488
260
 
489
- export { ApprovalController, ApprovalParams, ApprovalResponse, Caip2ChainId, DappInfo, DisplayData, Environment, GetTransactionHistory, Hex, Manifest, Module, Network, NetworkContractToken, NetworkFees, NetworkToken, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningDataType, TokenType, Transaction, TransactionHistoryResponse, TransactionType, TxToken, parseManifest };
261
+ export { Manifest, parseManifest };
@@ -0,0 +1,3 @@
1
+ export { a as parseManifest } from './chunk-A4YEBDMG.js';
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ require('./chunk-OGQBQHLH.cjs');
4
+
5
+ //# sourceMappingURL=out.js.map
6
+ //# sourceMappingURL=module.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { GetBalancesParams, GetBalancesResponse } from './balance.cjs';
2
+ import { Network } from './common.cjs';
3
+ import { Manifest } from './manifest.cjs';
4
+ import { NetworkFees } from './network-fee.cjs';
5
+ import { RpcRequest, RpcResponse } from './rpc.cjs';
6
+ import { NetworkContractToken } from './token.cjs';
7
+ import { GetTransactionHistory, TransactionHistoryResponse } from './transaction-history.cjs';
8
+ import 'bn.js';
9
+ import '@avalabs/glacier-sdk';
10
+ import 'zod';
11
+ import 'ethers';
12
+ import '@metamask/rpc-errors';
13
+
14
+ interface Module {
15
+ getManifest: () => Manifest | undefined;
16
+ getBalances: (params: GetBalancesParams) => Promise<GetBalancesResponse>;
17
+ getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>;
18
+ getNetworkFee: (network: Network) => Promise<NetworkFees>;
19
+ getAddress: () => Promise<string>;
20
+ getTokens: (network: Network) => Promise<NetworkContractToken[]>;
21
+ onRpcRequest: (request: RpcRequest, chain: Network) => Promise<RpcResponse>;
22
+ }
23
+
24
+ export { Module };
@@ -0,0 +1,24 @@
1
+ import { GetBalancesParams, GetBalancesResponse } from './balance.js';
2
+ import { Network } from './common.js';
3
+ import { Manifest } from './manifest.js';
4
+ import { NetworkFees } from './network-fee.js';
5
+ import { RpcRequest, RpcResponse } from './rpc.js';
6
+ import { NetworkContractToken } from './token.js';
7
+ import { GetTransactionHistory, TransactionHistoryResponse } from './transaction-history.js';
8
+ import 'bn.js';
9
+ import '@avalabs/glacier-sdk';
10
+ import 'zod';
11
+ import 'ethers';
12
+ import '@metamask/rpc-errors';
13
+
14
+ interface Module {
15
+ getManifest: () => Manifest | undefined;
16
+ getBalances: (params: GetBalancesParams) => Promise<GetBalancesResponse>;
17
+ getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>;
18
+ getNetworkFee: (network: Network) => Promise<NetworkFees>;
19
+ getAddress: () => Promise<string>;
20
+ getTokens: (network: Network) => Promise<NetworkContractToken[]>;
21
+ onRpcRequest: (request: RpcRequest, chain: Network) => Promise<RpcResponse>;
22
+ }
23
+
24
+ export { Module };
package/dist/module.js ADDED
@@ -0,0 +1,3 @@
1
+ import './chunk-CUVJNZP5.js';
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ require('./chunk-AILYKQEY.cjs');
4
+
5
+ //# sourceMappingURL=out.js.map
6
+ //# sourceMappingURL=network-fee.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ type NetworkFees = {
2
+ low: {
3
+ maxFeePerGas: bigint;
4
+ maxPriorityFeePerGas?: bigint;
5
+ };
6
+ medium: {
7
+ maxFeePerGas: bigint;
8
+ maxPriorityFeePerGas?: bigint;
9
+ };
10
+ high: {
11
+ maxFeePerGas: bigint;
12
+ maxPriorityFeePerGas?: bigint;
13
+ };
14
+ baseFee: bigint;
15
+ isFixedFee: boolean;
16
+ };
17
+
18
+ export { NetworkFees };
@@ -0,0 +1,18 @@
1
+ type NetworkFees = {
2
+ low: {
3
+ maxFeePerGas: bigint;
4
+ maxPriorityFeePerGas?: bigint;
5
+ };
6
+ medium: {
7
+ maxFeePerGas: bigint;
8
+ maxPriorityFeePerGas?: bigint;
9
+ };
10
+ high: {
11
+ maxFeePerGas: bigint;
12
+ maxPriorityFeePerGas?: bigint;
13
+ };
14
+ baseFee: bigint;
15
+ isFixedFee: boolean;
16
+ };
17
+
18
+ export { NetworkFees };
@@ -0,0 +1,3 @@
1
+ import './chunk-7U2R34EQ.js';
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=network-fee.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
package/dist/rpc.cjs ADDED
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var chunkISTALLTN_cjs = require('./chunk-ISTALLTN.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, 'RpcMethod', {
8
+ enumerable: true,
9
+ get: function () { return chunkISTALLTN_cjs.a; }
10
+ });
11
+ Object.defineProperty(exports, 'SigningDataType', {
12
+ enumerable: true,
13
+ get: function () { return chunkISTALLTN_cjs.b; }
14
+ });
15
+ //# sourceMappingURL=out.js.map
16
+ //# sourceMappingURL=rpc.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
package/dist/rpc.d.cts ADDED
@@ -0,0 +1,96 @@
1
+ import { TransactionRequest } from 'ethers';
2
+ import { Caip2ChainId, Hex } from './common.cjs';
3
+ import { JsonRpcError, OptionalDataWithOptionalCause, EthereumProviderError } from '@metamask/rpc-errors';
4
+ import './token.cjs';
5
+
6
+ declare enum RpcMethod {
7
+ ETH_SEND_TRANSACTION = "eth_sendTransaction",
8
+ SIGN_TYPED_DATA_V3 = "eth_signTypedData_v3",
9
+ SIGN_TYPED_DATA_V4 = "eth_signTypedData_v4",
10
+ SIGN_TYPED_DATA_V1 = "eth_signTypedData_v1",
11
+ SIGN_TYPED_DATA = "eth_signTypedData",
12
+ PERSONAL_SIGN = "personal_sign",
13
+ ETH_SIGN = "eth_sign",
14
+ WALLET_ADD_ETHEREUM_CHAIN = "wallet_addEthereumChain",
15
+ WALLET_SWITCH_ETHEREUM_CHAIN = "wallet_switchEthereumChain",
16
+ WALLET_GET_ETHEREUM_CHAIN = "wallet_getEthereumChain"
17
+ }
18
+ type DappInfo = {
19
+ name: string;
20
+ url: string;
21
+ icon: string;
22
+ };
23
+ type RpcRequest = {
24
+ requestId: string;
25
+ sessionId: string;
26
+ method: RpcMethod;
27
+ chainId: Caip2ChainId;
28
+ params: unknown;
29
+ dappInfo: DappInfo;
30
+ context?: Record<string, unknown>;
31
+ };
32
+ type RpcError = JsonRpcError<OptionalDataWithOptionalCause> | EthereumProviderError<OptionalDataWithOptionalCause>;
33
+ type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> = {
34
+ result: R;
35
+ } | {
36
+ error: E;
37
+ };
38
+ type DisplayData = {
39
+ title: string;
40
+ network: {
41
+ chainId: number;
42
+ name: string;
43
+ logoUri?: string;
44
+ };
45
+ messageDetails?: string;
46
+ transactionDetails?: {
47
+ website: string;
48
+ from: string;
49
+ to: string;
50
+ data?: string;
51
+ };
52
+ networkFeeSelector?: boolean;
53
+ };
54
+ /**
55
+ * Enum for different types of signing data.
56
+ */
57
+ declare enum SigningDataType {
58
+ EVM_TRANSACTION = "evm_transaction",
59
+ EVM_MESSAGE_ETH_SIGN = "evm_message_eth_sign",
60
+ EVM_MESSAGE_PERSONAL_SIGN = "evm_message_personal_sign",
61
+ EVM_MESSAGE_ETH_SIGN_TYPED_DATA = "evm_message_eth_sign_typed_data",
62
+ EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V1 = "evm_message_eth_sign_typed_data_v1",
63
+ EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V3 = "evm_message_eth_sign_typed_data_v3",
64
+ EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V4 = "evm_message_eth_sign_typed_data_v4",
65
+ AVALANCHE_TRANSACTION = "avalanche_transaction",
66
+ AVALANCHE_MESSAGE = "avalanche_message",
67
+ BTC_TRANSACTION = "btc_transaction"
68
+ }
69
+ type SigningData = {
70
+ type: SigningDataType.EVM_TRANSACTION;
71
+ account: string;
72
+ chainId: number;
73
+ data: TransactionRequest;
74
+ } | {
75
+ type: SigningDataType.EVM_MESSAGE_ETH_SIGN;
76
+ account: string;
77
+ chainId: number;
78
+ data: string;
79
+ };
80
+ type ApprovalParams = {
81
+ request: RpcRequest;
82
+ displayData: DisplayData;
83
+ signingData: SigningData;
84
+ };
85
+ type ApprovalResponse = {
86
+ result: Hex;
87
+ } | {
88
+ error: RpcError;
89
+ };
90
+ interface ApprovalController {
91
+ requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
92
+ onTransactionConfirmed: (txHash: Hex) => void;
93
+ onTransactionReverted: (txHash: Hex) => void;
94
+ }
95
+
96
+ export { ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningDataType };
package/dist/rpc.d.ts ADDED
@@ -0,0 +1,96 @@
1
+ import { TransactionRequest } from 'ethers';
2
+ import { Caip2ChainId, Hex } from './common.js';
3
+ import { JsonRpcError, OptionalDataWithOptionalCause, EthereumProviderError } from '@metamask/rpc-errors';
4
+ import './token.js';
5
+
6
+ declare enum RpcMethod {
7
+ ETH_SEND_TRANSACTION = "eth_sendTransaction",
8
+ SIGN_TYPED_DATA_V3 = "eth_signTypedData_v3",
9
+ SIGN_TYPED_DATA_V4 = "eth_signTypedData_v4",
10
+ SIGN_TYPED_DATA_V1 = "eth_signTypedData_v1",
11
+ SIGN_TYPED_DATA = "eth_signTypedData",
12
+ PERSONAL_SIGN = "personal_sign",
13
+ ETH_SIGN = "eth_sign",
14
+ WALLET_ADD_ETHEREUM_CHAIN = "wallet_addEthereumChain",
15
+ WALLET_SWITCH_ETHEREUM_CHAIN = "wallet_switchEthereumChain",
16
+ WALLET_GET_ETHEREUM_CHAIN = "wallet_getEthereumChain"
17
+ }
18
+ type DappInfo = {
19
+ name: string;
20
+ url: string;
21
+ icon: string;
22
+ };
23
+ type RpcRequest = {
24
+ requestId: string;
25
+ sessionId: string;
26
+ method: RpcMethod;
27
+ chainId: Caip2ChainId;
28
+ params: unknown;
29
+ dappInfo: DappInfo;
30
+ context?: Record<string, unknown>;
31
+ };
32
+ type RpcError = JsonRpcError<OptionalDataWithOptionalCause> | EthereumProviderError<OptionalDataWithOptionalCause>;
33
+ type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> = {
34
+ result: R;
35
+ } | {
36
+ error: E;
37
+ };
38
+ type DisplayData = {
39
+ title: string;
40
+ network: {
41
+ chainId: number;
42
+ name: string;
43
+ logoUri?: string;
44
+ };
45
+ messageDetails?: string;
46
+ transactionDetails?: {
47
+ website: string;
48
+ from: string;
49
+ to: string;
50
+ data?: string;
51
+ };
52
+ networkFeeSelector?: boolean;
53
+ };
54
+ /**
55
+ * Enum for different types of signing data.
56
+ */
57
+ declare enum SigningDataType {
58
+ EVM_TRANSACTION = "evm_transaction",
59
+ EVM_MESSAGE_ETH_SIGN = "evm_message_eth_sign",
60
+ EVM_MESSAGE_PERSONAL_SIGN = "evm_message_personal_sign",
61
+ EVM_MESSAGE_ETH_SIGN_TYPED_DATA = "evm_message_eth_sign_typed_data",
62
+ EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V1 = "evm_message_eth_sign_typed_data_v1",
63
+ EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V3 = "evm_message_eth_sign_typed_data_v3",
64
+ EVM_MESSAGE_ETH_SIGN_TYPED_DATA_V4 = "evm_message_eth_sign_typed_data_v4",
65
+ AVALANCHE_TRANSACTION = "avalanche_transaction",
66
+ AVALANCHE_MESSAGE = "avalanche_message",
67
+ BTC_TRANSACTION = "btc_transaction"
68
+ }
69
+ type SigningData = {
70
+ type: SigningDataType.EVM_TRANSACTION;
71
+ account: string;
72
+ chainId: number;
73
+ data: TransactionRequest;
74
+ } | {
75
+ type: SigningDataType.EVM_MESSAGE_ETH_SIGN;
76
+ account: string;
77
+ chainId: number;
78
+ data: string;
79
+ };
80
+ type ApprovalParams = {
81
+ request: RpcRequest;
82
+ displayData: DisplayData;
83
+ signingData: SigningData;
84
+ };
85
+ type ApprovalResponse = {
86
+ result: Hex;
87
+ } | {
88
+ error: RpcError;
89
+ };
90
+ interface ApprovalController {
91
+ requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
92
+ onTransactionConfirmed: (txHash: Hex) => void;
93
+ onTransactionReverted: (txHash: Hex) => void;
94
+ }
95
+
96
+ export { ApprovalController, ApprovalParams, ApprovalResponse, DappInfo, DisplayData, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, SigningDataType };
package/dist/rpc.js ADDED
@@ -0,0 +1,3 @@
1
+ export { a as RpcMethod, b as SigningDataType } from './chunk-FKFLXQOJ.js';
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=rpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
package/dist/token.cjs ADDED
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkKVTVJNN4_cjs = require('./chunk-KVTVJNN4.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, 'TokenType', {
8
+ enumerable: true,
9
+ get: function () { return chunkKVTVJNN4_cjs.a; }
10
+ });
11
+ //# sourceMappingURL=out.js.map
12
+ //# sourceMappingURL=token.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ interface NetworkToken {
2
+ name: string;
3
+ symbol: string;
4
+ decimals: number;
5
+ logoUri?: string;
6
+ description?: string;
7
+ }
8
+ interface NetworkContractToken {
9
+ address: string;
10
+ chainId?: number;
11
+ color?: string;
12
+ contractType: string;
13
+ decimals: number;
14
+ logoUri?: string;
15
+ name: string;
16
+ symbol: string;
17
+ }
18
+ declare enum TokenType {
19
+ NATIVE = "NATIVE",
20
+ ERC20 = "ERC20",
21
+ ERC721 = "ERC721",
22
+ ERC1155 = "ERC1155"
23
+ }
24
+
25
+ export { NetworkContractToken, NetworkToken, TokenType };
@@ -0,0 +1,25 @@
1
+ interface NetworkToken {
2
+ name: string;
3
+ symbol: string;
4
+ decimals: number;
5
+ logoUri?: string;
6
+ description?: string;
7
+ }
8
+ interface NetworkContractToken {
9
+ address: string;
10
+ chainId?: number;
11
+ color?: string;
12
+ contractType: string;
13
+ decimals: number;
14
+ logoUri?: string;
15
+ name: string;
16
+ symbol: string;
17
+ }
18
+ declare enum TokenType {
19
+ NATIVE = "NATIVE",
20
+ ERC20 = "ERC20",
21
+ ERC721 = "ERC721",
22
+ ERC1155 = "ERC1155"
23
+ }
24
+
25
+ export { NetworkContractToken, NetworkToken, TokenType };
package/dist/token.js ADDED
@@ -0,0 +1,3 @@
1
+ export { a as TokenType } from './chunk-TSO5BGJ4.js';
2
+ //# sourceMappingURL=out.js.map
3
+ //# sourceMappingURL=token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}