@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
@@ -0,0 +1,261 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const manifestSchema: z.ZodObject<{
4
+ name: z.ZodString;
5
+ version: z.ZodString;
6
+ description: z.ZodString;
7
+ sources: z.ZodObject<{
8
+ module: z.ZodObject<{
9
+ checksum: z.ZodString;
10
+ location: z.ZodObject<{
11
+ npm: z.ZodObject<{
12
+ filePath: z.ZodString;
13
+ packageName: z.ZodString;
14
+ registry: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ filePath: string;
17
+ packageName: string;
18
+ registry: string;
19
+ }, {
20
+ filePath: string;
21
+ packageName: string;
22
+ registry: string;
23
+ }>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ npm: {
26
+ filePath: string;
27
+ packageName: string;
28
+ registry: string;
29
+ };
30
+ }, {
31
+ npm: {
32
+ filePath: string;
33
+ packageName: string;
34
+ registry: string;
35
+ };
36
+ }>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ checksum: string;
39
+ location: {
40
+ npm: {
41
+ filePath: string;
42
+ packageName: string;
43
+ registry: string;
44
+ };
45
+ };
46
+ }, {
47
+ checksum: string;
48
+ location: {
49
+ npm: {
50
+ filePath: string;
51
+ packageName: string;
52
+ registry: string;
53
+ };
54
+ };
55
+ }>;
56
+ provider: z.ZodOptional<z.ZodObject<{
57
+ checksum: z.ZodString;
58
+ location: z.ZodObject<{
59
+ npm: z.ZodObject<{
60
+ filePath: z.ZodString;
61
+ packageName: z.ZodString;
62
+ registry: z.ZodString;
63
+ }, "strip", z.ZodTypeAny, {
64
+ filePath: string;
65
+ packageName: string;
66
+ registry: string;
67
+ }, {
68
+ filePath: string;
69
+ packageName: string;
70
+ registry: string;
71
+ }>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ npm: {
74
+ filePath: string;
75
+ packageName: string;
76
+ registry: string;
77
+ };
78
+ }, {
79
+ npm: {
80
+ filePath: string;
81
+ packageName: string;
82
+ registry: string;
83
+ };
84
+ }>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ checksum: string;
87
+ location: {
88
+ npm: {
89
+ filePath: string;
90
+ packageName: string;
91
+ registry: string;
92
+ };
93
+ };
94
+ }, {
95
+ checksum: string;
96
+ location: {
97
+ npm: {
98
+ filePath: string;
99
+ packageName: string;
100
+ registry: string;
101
+ };
102
+ };
103
+ }>>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ module: {
106
+ checksum: string;
107
+ location: {
108
+ npm: {
109
+ filePath: string;
110
+ packageName: string;
111
+ registry: string;
112
+ };
113
+ };
114
+ };
115
+ provider?: {
116
+ checksum: string;
117
+ location: {
118
+ npm: {
119
+ filePath: string;
120
+ packageName: string;
121
+ registry: string;
122
+ };
123
+ };
124
+ } | undefined;
125
+ }, {
126
+ module: {
127
+ checksum: string;
128
+ location: {
129
+ npm: {
130
+ filePath: string;
131
+ packageName: string;
132
+ registry: string;
133
+ };
134
+ };
135
+ };
136
+ provider?: {
137
+ checksum: string;
138
+ location: {
139
+ npm: {
140
+ filePath: string;
141
+ packageName: string;
142
+ registry: string;
143
+ };
144
+ };
145
+ } | undefined;
146
+ }>;
147
+ network: z.ZodObject<{
148
+ chainIds: z.ZodArray<z.ZodString, "many">;
149
+ namespaces: z.ZodArray<z.ZodString, "many">;
150
+ }, "strip", z.ZodTypeAny, {
151
+ chainIds: string[];
152
+ namespaces: string[];
153
+ }, {
154
+ chainIds: string[];
155
+ namespaces: string[];
156
+ }>;
157
+ cointype: z.ZodString;
158
+ permissions: z.ZodObject<{
159
+ rpc: z.ZodObject<{
160
+ dapps: z.ZodBoolean;
161
+ methods: z.ZodArray<z.ZodString, "many">;
162
+ }, "strip", z.ZodTypeAny, {
163
+ dapps: boolean;
164
+ methods: string[];
165
+ }, {
166
+ dapps: boolean;
167
+ methods: string[];
168
+ }>;
169
+ }, "strip", z.ZodTypeAny, {
170
+ rpc: {
171
+ dapps: boolean;
172
+ methods: string[];
173
+ };
174
+ }, {
175
+ rpc: {
176
+ dapps: boolean;
177
+ methods: string[];
178
+ };
179
+ }>;
180
+ manifestVersion: z.ZodString;
181
+ }, "strip", z.ZodTypeAny, {
182
+ name: string;
183
+ version: string;
184
+ description: string;
185
+ sources: {
186
+ module: {
187
+ checksum: string;
188
+ location: {
189
+ npm: {
190
+ filePath: string;
191
+ packageName: string;
192
+ registry: string;
193
+ };
194
+ };
195
+ };
196
+ provider?: {
197
+ checksum: string;
198
+ location: {
199
+ npm: {
200
+ filePath: string;
201
+ packageName: string;
202
+ registry: string;
203
+ };
204
+ };
205
+ } | undefined;
206
+ };
207
+ network: {
208
+ chainIds: string[];
209
+ namespaces: string[];
210
+ };
211
+ cointype: string;
212
+ permissions: {
213
+ rpc: {
214
+ dapps: boolean;
215
+ methods: string[];
216
+ };
217
+ };
218
+ manifestVersion: string;
219
+ }, {
220
+ name: string;
221
+ version: string;
222
+ description: string;
223
+ sources: {
224
+ module: {
225
+ checksum: string;
226
+ location: {
227
+ npm: {
228
+ filePath: string;
229
+ packageName: string;
230
+ registry: string;
231
+ };
232
+ };
233
+ };
234
+ provider?: {
235
+ checksum: string;
236
+ location: {
237
+ npm: {
238
+ filePath: string;
239
+ packageName: string;
240
+ registry: string;
241
+ };
242
+ };
243
+ } | undefined;
244
+ };
245
+ network: {
246
+ chainIds: string[];
247
+ namespaces: string[];
248
+ };
249
+ cointype: string;
250
+ permissions: {
251
+ rpc: {
252
+ dapps: boolean;
253
+ methods: string[];
254
+ };
255
+ };
256
+ manifestVersion: string;
257
+ }>;
258
+ type Manifest = z.infer<typeof manifestSchema>;
259
+ declare const parseManifest: (params: unknown) => z.SafeParseReturnType<unknown, Manifest>;
260
+
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 chunk7FBUAZNW_cjs = require('./chunk-7FBUAZNW.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, 'BannerType', {
8
+ enumerable: true,
9
+ get: function () { return chunk7FBUAZNW_cjs.b; }
10
+ });
11
+ Object.defineProperty(exports, 'RpcMethod', {
12
+ enumerable: true,
13
+ get: function () { return chunk7FBUAZNW_cjs.a; }
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,125 @@
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
+ }
15
+ type DappInfo = {
16
+ name: string;
17
+ url: string;
18
+ icon: string;
19
+ };
20
+ type RpcRequest = {
21
+ requestId: string;
22
+ sessionId: string;
23
+ method: RpcMethod;
24
+ chainId: Caip2ChainId;
25
+ params: unknown;
26
+ dappInfo: DappInfo;
27
+ context?: Record<string, unknown>;
28
+ };
29
+ type RpcError = JsonRpcError<OptionalDataWithOptionalCause> | EthereumProviderError<OptionalDataWithOptionalCause>;
30
+ type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> = {
31
+ result: R;
32
+ } | {
33
+ error: E;
34
+ };
35
+ interface MessageTypeProperty {
36
+ name: string;
37
+ type: string;
38
+ }
39
+ interface MessageTypes {
40
+ EIP712Domain: MessageTypeProperty[];
41
+ [additionalProperties: string]: MessageTypeProperty[];
42
+ }
43
+ interface TypedData<T extends MessageTypes> {
44
+ types: T;
45
+ primaryType: keyof T;
46
+ domain: Record<string, unknown>;
47
+ message: Record<string, unknown>;
48
+ }
49
+ type TypedDataV1 = {
50
+ name: string;
51
+ type: string;
52
+ value: unknown;
53
+ }[];
54
+ declare enum BannerType {
55
+ WARNING = "warning",
56
+ INFO = "info"
57
+ }
58
+ type Banner = {
59
+ type: BannerType;
60
+ title: string;
61
+ description: string;
62
+ detailedDescription?: string;
63
+ };
64
+ type DisplayData = {
65
+ banner?: Banner;
66
+ title: string;
67
+ dAppInfo?: {
68
+ name: string;
69
+ action: string;
70
+ logoUri?: string;
71
+ };
72
+ network: {
73
+ chainId: number;
74
+ name: string;
75
+ logoUri?: string;
76
+ };
77
+ account?: string;
78
+ messageDetails?: string;
79
+ transactionDetails?: {
80
+ website: string;
81
+ from: string;
82
+ to: string;
83
+ data?: string;
84
+ };
85
+ networkFeeSelector?: boolean;
86
+ disclaimer?: string;
87
+ };
88
+ type SigningData = {
89
+ type: RpcMethod.ETH_SEND_TRANSACTION;
90
+ account: string;
91
+ chainId: number;
92
+ data: TransactionRequest;
93
+ } | {
94
+ type: RpcMethod.ETH_SIGN | RpcMethod.PERSONAL_SIGN;
95
+ account: string;
96
+ chainId: number;
97
+ data: string;
98
+ } | {
99
+ type: RpcMethod.SIGN_TYPED_DATA | RpcMethod.SIGN_TYPED_DATA_V1;
100
+ account: string;
101
+ chainId: number;
102
+ data: TypedData<MessageTypes> | TypedDataV1;
103
+ } | {
104
+ type: RpcMethod.SIGN_TYPED_DATA_V3 | RpcMethod.SIGN_TYPED_DATA_V4;
105
+ account: string;
106
+ chainId: number;
107
+ data: TypedData<MessageTypes>;
108
+ };
109
+ type ApprovalParams = {
110
+ request: RpcRequest;
111
+ displayData: DisplayData;
112
+ signingData: SigningData;
113
+ };
114
+ type ApprovalResponse = {
115
+ result: Hex;
116
+ } | {
117
+ error: RpcError;
118
+ };
119
+ interface ApprovalController {
120
+ requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
121
+ onTransactionConfirmed: (txHash: Hex) => void;
122
+ onTransactionReverted: (txHash: Hex) => void;
123
+ }
124
+
125
+ export { ApprovalController, ApprovalParams, ApprovalResponse, Banner, BannerType, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TypedData, TypedDataV1 };
package/dist/rpc.d.ts ADDED
@@ -0,0 +1,125 @@
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
+ }
15
+ type DappInfo = {
16
+ name: string;
17
+ url: string;
18
+ icon: string;
19
+ };
20
+ type RpcRequest = {
21
+ requestId: string;
22
+ sessionId: string;
23
+ method: RpcMethod;
24
+ chainId: Caip2ChainId;
25
+ params: unknown;
26
+ dappInfo: DappInfo;
27
+ context?: Record<string, unknown>;
28
+ };
29
+ type RpcError = JsonRpcError<OptionalDataWithOptionalCause> | EthereumProviderError<OptionalDataWithOptionalCause>;
30
+ type RpcResponse<R = unknown, E extends RpcError = JsonRpcError<OptionalDataWithOptionalCause>> = {
31
+ result: R;
32
+ } | {
33
+ error: E;
34
+ };
35
+ interface MessageTypeProperty {
36
+ name: string;
37
+ type: string;
38
+ }
39
+ interface MessageTypes {
40
+ EIP712Domain: MessageTypeProperty[];
41
+ [additionalProperties: string]: MessageTypeProperty[];
42
+ }
43
+ interface TypedData<T extends MessageTypes> {
44
+ types: T;
45
+ primaryType: keyof T;
46
+ domain: Record<string, unknown>;
47
+ message: Record<string, unknown>;
48
+ }
49
+ type TypedDataV1 = {
50
+ name: string;
51
+ type: string;
52
+ value: unknown;
53
+ }[];
54
+ declare enum BannerType {
55
+ WARNING = "warning",
56
+ INFO = "info"
57
+ }
58
+ type Banner = {
59
+ type: BannerType;
60
+ title: string;
61
+ description: string;
62
+ detailedDescription?: string;
63
+ };
64
+ type DisplayData = {
65
+ banner?: Banner;
66
+ title: string;
67
+ dAppInfo?: {
68
+ name: string;
69
+ action: string;
70
+ logoUri?: string;
71
+ };
72
+ network: {
73
+ chainId: number;
74
+ name: string;
75
+ logoUri?: string;
76
+ };
77
+ account?: string;
78
+ messageDetails?: string;
79
+ transactionDetails?: {
80
+ website: string;
81
+ from: string;
82
+ to: string;
83
+ data?: string;
84
+ };
85
+ networkFeeSelector?: boolean;
86
+ disclaimer?: string;
87
+ };
88
+ type SigningData = {
89
+ type: RpcMethod.ETH_SEND_TRANSACTION;
90
+ account: string;
91
+ chainId: number;
92
+ data: TransactionRequest;
93
+ } | {
94
+ type: RpcMethod.ETH_SIGN | RpcMethod.PERSONAL_SIGN;
95
+ account: string;
96
+ chainId: number;
97
+ data: string;
98
+ } | {
99
+ type: RpcMethod.SIGN_TYPED_DATA | RpcMethod.SIGN_TYPED_DATA_V1;
100
+ account: string;
101
+ chainId: number;
102
+ data: TypedData<MessageTypes> | TypedDataV1;
103
+ } | {
104
+ type: RpcMethod.SIGN_TYPED_DATA_V3 | RpcMethod.SIGN_TYPED_DATA_V4;
105
+ account: string;
106
+ chainId: number;
107
+ data: TypedData<MessageTypes>;
108
+ };
109
+ type ApprovalParams = {
110
+ request: RpcRequest;
111
+ displayData: DisplayData;
112
+ signingData: SigningData;
113
+ };
114
+ type ApprovalResponse = {
115
+ result: Hex;
116
+ } | {
117
+ error: RpcError;
118
+ };
119
+ interface ApprovalController {
120
+ requestApproval: (params: ApprovalParams) => Promise<ApprovalResponse>;
121
+ onTransactionConfirmed: (txHash: Hex) => void;
122
+ onTransactionReverted: (txHash: Hex) => void;
123
+ }
124
+
125
+ export { ApprovalController, ApprovalParams, ApprovalResponse, Banner, BannerType, DappInfo, DisplayData, MessageTypeProperty, MessageTypes, RpcError, RpcMethod, RpcRequest, RpcResponse, SigningData, TypedData, TypedDataV1 };
package/dist/rpc.js ADDED
@@ -0,0 +1,3 @@
1
+ export { b as BannerType, a as RpcMethod } from './chunk-XMGYJ4KK.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":""}