@metamask-previews/keyring-internal-api 0.0.1-672cc7b → 0.0.1-72196d6

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 (79) hide show
  1. package/dist/{internal/api.js → api.cjs} +14 -4
  2. package/dist/api.cjs.map +1 -0
  3. package/dist/{internal/api.d.ts → api.d.cts} +394 -72
  4. package/dist/api.d.cts.map +1 -0
  5. package/dist/api.d.mts +737 -0
  6. package/dist/api.d.mts.map +1 -0
  7. package/dist/api.mjs +145 -0
  8. package/dist/api.mjs.map +1 -0
  9. package/dist/eth/EthKeyring.cjs +3 -0
  10. package/dist/eth/EthKeyring.cjs.map +1 -0
  11. package/dist/{internal/eth/EthKeyring.d.ts → eth/EthKeyring.d.cts} +4 -4
  12. package/dist/eth/EthKeyring.d.cts.map +1 -0
  13. package/dist/eth/EthKeyring.d.mts +33 -0
  14. package/dist/eth/EthKeyring.d.mts.map +1 -0
  15. package/dist/eth/EthKeyring.mjs +2 -0
  16. package/dist/eth/EthKeyring.mjs.map +1 -0
  17. package/dist/{internal/eth/EthKeyring.js → eth/index.cjs} +1 -1
  18. package/dist/eth/index.cjs.map +1 -0
  19. package/dist/eth/index.d.cts +2 -0
  20. package/dist/eth/index.d.cts.map +1 -0
  21. package/dist/eth/index.d.mts +2 -0
  22. package/dist/eth/index.d.mts.map +1 -0
  23. package/dist/eth/index.mjs +2 -0
  24. package/dist/eth/index.mjs.map +1 -0
  25. package/dist/{btc/index.js → index.cjs} +3 -2
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.cts +4 -0
  28. package/dist/index.d.cts.map +1 -0
  29. package/dist/index.d.mts +4 -0
  30. package/dist/index.d.mts.map +1 -0
  31. package/dist/index.mjs +3 -0
  32. package/dist/index.mjs.map +1 -0
  33. package/dist/{internal/types.js → types.cjs} +23 -19
  34. package/dist/types.cjs.map +1 -0
  35. package/dist/{internal/types.d.ts → types.d.cts} +131 -69
  36. package/dist/types.d.cts.map +1 -0
  37. package/dist/types.d.mts +392 -0
  38. package/dist/types.d.mts.map +1 -0
  39. package/dist/types.mjs +50 -0
  40. package/dist/types.mjs.map +1 -0
  41. package/package.json +31 -20
  42. package/dist/btc/index.d.ts +0 -1
  43. package/dist/btc/index.js.map +0 -1
  44. package/dist/btc/types.d.ts +0 -33
  45. package/dist/btc/types.js +0 -40
  46. package/dist/btc/types.js.map +0 -1
  47. package/dist/eth/erc4337/index.d.ts +0 -1
  48. package/dist/eth/erc4337/index.js +0 -18
  49. package/dist/eth/erc4337/index.js.map +0 -1
  50. package/dist/eth/erc4337/types.d.ts +0 -97
  51. package/dist/eth/erc4337/types.js +0 -61
  52. package/dist/eth/erc4337/types.js.map +0 -1
  53. package/dist/eth/index.d.ts +0 -3
  54. package/dist/eth/index.js +0 -20
  55. package/dist/eth/index.js.map +0 -1
  56. package/dist/eth/types.d.ts +0 -80
  57. package/dist/eth/types.js +0 -73
  58. package/dist/eth/types.js.map +0 -1
  59. package/dist/eth/utils.d.ts +0 -8
  60. package/dist/eth/utils.js +0 -15
  61. package/dist/eth/utils.js.map +0 -1
  62. package/dist/index.d.ts +0 -3
  63. package/dist/index.js +0 -20
  64. package/dist/index.js.map +0 -1
  65. package/dist/internal/api.js.map +0 -1
  66. package/dist/internal/eth/EthKeyring.js.map +0 -1
  67. package/dist/internal/eth/index.d.ts +0 -1
  68. package/dist/internal/eth/index.js +0 -18
  69. package/dist/internal/eth/index.js.map +0 -1
  70. package/dist/internal/events.d.ts +0 -169
  71. package/dist/internal/events.js +0 -83
  72. package/dist/internal/events.js.map +0 -1
  73. package/dist/internal/index.d.ts +0 -5
  74. package/dist/internal/index.js +0 -22
  75. package/dist/internal/index.js.map +0 -1
  76. package/dist/internal/rpc.d.ts +0 -25
  77. package/dist/internal/rpc.js +0 -33
  78. package/dist/internal/rpc.js.map +0 -1
  79. package/dist/internal/types.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.mts","sourceRoot":"","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;;;;;;;;;;;EAOtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAE9E,eAAO,MAAM,4BAA4B,oDAAgB,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAKhF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,oDAAgB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
package/dist/api.mjs ADDED
@@ -0,0 +1,145 @@
1
+ import { BalanceStruct, CaipAssetTypeStruct, KeyringAccountDataStruct, KeyringAccountStruct, KeyringRequestStruct, KeyringResponseStruct, KeyringRpcMethod, PaginationStruct, TransactionsPageStruct } from "@metamask/keyring-api";
2
+ import { object, UuidStruct } from "@metamask/keyring-utils";
3
+ import { array, literal, number, record, string, union } from "@metamask/superstruct";
4
+ import { JsonStruct } from "@metamask/utils";
5
+ const CommonHeader = {
6
+ jsonrpc: literal('2.0'),
7
+ id: union([string(), number(), literal(null)]),
8
+ };
9
+ // ----------------------------------------------------------------------------
10
+ // List accounts
11
+ export const ListAccountsRequestStruct = object({
12
+ ...CommonHeader,
13
+ method: literal('keyring_listAccounts'),
14
+ });
15
+ export const ListAccountsResponseStruct = array(KeyringAccountStruct);
16
+ // ----------------------------------------------------------------------------
17
+ // Get account
18
+ export const GetAccountRequestStruct = object({
19
+ ...CommonHeader,
20
+ method: literal('keyring_getAccount'),
21
+ params: object({
22
+ id: UuidStruct,
23
+ }),
24
+ });
25
+ export const GetAccountResponseStruct = KeyringAccountStruct;
26
+ // ----------------------------------------------------------------------------
27
+ // Create account
28
+ export const CreateAccountRequestStruct = object({
29
+ ...CommonHeader,
30
+ method: literal('keyring_createAccount'),
31
+ params: object({
32
+ options: record(string(), JsonStruct),
33
+ }),
34
+ });
35
+ export const CreateAccountResponseStruct = KeyringAccountStruct;
36
+ // ----------------------------------------------------------------------------
37
+ // List account transactions
38
+ export const ListAccountTransactionsRequestStruct = object({
39
+ ...CommonHeader,
40
+ method: literal('keyring_listAccountTransactions'),
41
+ params: object({
42
+ id: UuidStruct,
43
+ pagination: PaginationStruct,
44
+ }),
45
+ });
46
+ export const ListAccountTransactionsResponseStruct = TransactionsPageStruct;
47
+ // ----------------------------------------------------------------------------
48
+ // Get account balances
49
+ export const GetAccountBalancesRequestStruct = object({
50
+ ...CommonHeader,
51
+ method: literal(`${KeyringRpcMethod.GetAccountBalances}`),
52
+ params: object({
53
+ id: UuidStruct,
54
+ assets: array(CaipAssetTypeStruct),
55
+ }),
56
+ });
57
+ export const GetAccountBalancesResponseStruct = record(CaipAssetTypeStruct, BalanceStruct);
58
+ // ----------------------------------------------------------------------------
59
+ // Filter account chains
60
+ export const FilterAccountChainsStruct = object({
61
+ ...CommonHeader,
62
+ method: literal('keyring_filterAccountChains'),
63
+ params: object({
64
+ id: UuidStruct,
65
+ chains: array(string()),
66
+ }),
67
+ });
68
+ export const FilterAccountChainsResponseStruct = array(string());
69
+ // ----------------------------------------------------------------------------
70
+ // Update account
71
+ export const UpdateAccountRequestStruct = object({
72
+ ...CommonHeader,
73
+ method: literal('keyring_updateAccount'),
74
+ params: object({
75
+ account: KeyringAccountStruct,
76
+ }),
77
+ });
78
+ export const UpdateAccountResponseStruct = literal(null);
79
+ // ----------------------------------------------------------------------------
80
+ // Delete account
81
+ export const DeleteAccountRequestStruct = object({
82
+ ...CommonHeader,
83
+ method: literal('keyring_deleteAccount'),
84
+ params: object({
85
+ id: UuidStruct,
86
+ }),
87
+ });
88
+ export const DeleteAccountResponseStruct = literal(null);
89
+ // ----------------------------------------------------------------------------
90
+ // Export account
91
+ export const ExportAccountRequestStruct = object({
92
+ ...CommonHeader,
93
+ method: literal('keyring_exportAccount'),
94
+ params: object({
95
+ id: UuidStruct,
96
+ }),
97
+ });
98
+ export const ExportAccountResponseStruct = KeyringAccountDataStruct;
99
+ // ----------------------------------------------------------------------------
100
+ // List requests
101
+ export const ListRequestsRequestStruct = object({
102
+ ...CommonHeader,
103
+ method: literal('keyring_listRequests'),
104
+ });
105
+ export const ListRequestsResponseStruct = array(KeyringRequestStruct);
106
+ // ----------------------------------------------------------------------------
107
+ // Get request
108
+ export const GetRequestRequestStruct = object({
109
+ ...CommonHeader,
110
+ method: literal('keyring_getRequest'),
111
+ params: object({
112
+ id: UuidStruct,
113
+ }),
114
+ });
115
+ export const GetRequestResponseStruct = KeyringRequestStruct;
116
+ // ----------------------------------------------------------------------------
117
+ // Submit request
118
+ export const SubmitRequestRequestStruct = object({
119
+ ...CommonHeader,
120
+ method: literal('keyring_submitRequest'),
121
+ params: KeyringRequestStruct,
122
+ });
123
+ export const SubmitRequestResponseStruct = KeyringResponseStruct;
124
+ // ----------------------------------------------------------------------------
125
+ // Approve request
126
+ export const ApproveRequestRequestStruct = object({
127
+ ...CommonHeader,
128
+ method: literal('keyring_approveRequest'),
129
+ params: object({
130
+ id: UuidStruct,
131
+ data: record(string(), JsonStruct),
132
+ }),
133
+ });
134
+ export const ApproveRequestResponseStruct = literal(null);
135
+ // ----------------------------------------------------------------------------
136
+ // Reject request
137
+ export const RejectRequestRequestStruct = object({
138
+ ...CommonHeader,
139
+ method: literal('keyring_rejectRequest'),
140
+ params: object({
141
+ id: UuidStruct,
142
+ }),
143
+ });
144
+ export const RejectRequestResponseStruct = literal(null);
145
+ //# sourceMappingURL=api.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.mjs","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACvB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CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAIjE,+EAA+E;AAC/E,kBAAkB;AAElB,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n KeyringRpcMethod,\n PaginationStruct,\n TransactionsPageStruct,\n} from '@metamask/keyring-api';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List account transactions\n\nexport const ListAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountTransactions'),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type ListAccountTransactionsRequest = Infer<\n typeof ListAccountTransactionsRequestStruct\n>;\n\nexport const ListAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type ListAccountTransactionsResponse = Infer<\n typeof ListAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_deleteAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=EthKeyring.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthKeyring.cjs","sourceRoot":"","sources":["../../src/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyringExecutionContext,\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '@metamask/keyring-api';\nimport type { Json, Keyring } from '@metamask/utils';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
@@ -1,7 +1,6 @@
1
- import type { KeyringExecutionContext } from '@metamask/keyring-api';
2
- import type { Json, Keyring } from '@metamask/utils';
3
- import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from '../../eth';
4
- export declare type EthKeyring<State extends Json> = Keyring<State> & {
1
+ import type { KeyringExecutionContext, EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from "@metamask/keyring-api";
2
+ import type { Json, Keyring } from "@metamask/utils";
3
+ export type EthKeyring<State extends Json> = Keyring<State> & {
5
4
  /**
6
5
  * Convert a base transaction to a base UserOperation.
7
6
  *
@@ -31,3 +30,4 @@ export declare type EthKeyring<State extends Json> = Keyring<State> & {
31
30
  */
32
31
  signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
33
32
  };
33
+ //# sourceMappingURL=EthKeyring.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthKeyring.d.cts","sourceRoot":"","sources":["../../src/eth/EthKeyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACtB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB;AAErD,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG;IAC5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { KeyringExecutionContext, EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from "@metamask/keyring-api";
2
+ import type { Json, Keyring } from "@metamask/utils";
3
+ export type EthKeyring<State extends Json> = Keyring<State> & {
4
+ /**
5
+ * Convert a base transaction to a base UserOperation.
6
+ *
7
+ * @param address - Address of the sender.
8
+ * @param transactions - Base transactions to include in the UserOperation.
9
+ * @param context - Keyring execution context.
10
+ * @returns A pseudo-UserOperation that can be used to construct a real.
11
+ */
12
+ prepareUserOperation?(address: string, transactions: EthBaseTransaction[], context: KeyringExecutionContext): Promise<EthBaseUserOperation>;
13
+ /**
14
+ * Patches properties of a UserOperation. Currently, only the
15
+ * `paymasterAndData` can be patched.
16
+ *
17
+ * @param address - Address of the sender.
18
+ * @param userOp - UserOperation to patch.
19
+ * @param context - Keyring execution context.
20
+ * @returns A patch to apply to the UserOperation.
21
+ */
22
+ patchUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<EthUserOperationPatch>;
23
+ /**
24
+ * Signs an UserOperation.
25
+ *
26
+ * @param address - Address of the sender.
27
+ * @param userOp - UserOperation to sign.
28
+ * @param context - Keyring execution context.
29
+ * @returns The signature of the UserOperation.
30
+ */
31
+ signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
32
+ };
33
+ //# sourceMappingURL=EthKeyring.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthKeyring.d.mts","sourceRoot":"","sources":["../../src/eth/EthKeyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACtB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB;AAErD,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG;IAC5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EthKeyring.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EthKeyring.mjs","sourceRoot":"","sources":["../../src/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyringExecutionContext,\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '@metamask/keyring-api';\nimport type { Json, Keyring } from '@metamask/utils';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=EthKeyring.js.map
3
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
@@ -0,0 +1,2 @@
1
+ export type * from "./EthKeyring.cjs";
2
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
@@ -0,0 +1,2 @@
1
+ export type * from "./EthKeyring.mjs";
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- //# sourceMappingURL=index.js.map
17
+ __exportStar(require("./api.cjs"), exports);
18
+ __exportStar(require("./types.cjs"), exports);
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,4CAAsB;AACtB,8CAAwB","sourcesContent":["export type * from './eth';\nexport * from './api';\nexport * from './types';\n"]}
@@ -0,0 +1,4 @@
1
+ export type * from "./eth/index.cjs";
2
+ export * from "./api.cjs";
3
+ export * from "./types.cjs";
4
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAA2B;AAC3B,0BAAsB;AACtB,4BAAwB"}
@@ -0,0 +1,4 @@
1
+ export type * from "./eth/index.mjs";
2
+ export * from "./api.mjs";
3
+ export * from "./types.mjs";
4
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAA2B;AAC3B,0BAAsB;AACtB,4BAAwB"}
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./api.mjs";
2
+ export * from "./types.mjs";
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,0BAAsB;AACtB,4BAAwB","sourcesContent":["export type * from './eth';\nexport * from './api';\nexport * from './types';\n"]}
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
3
+ /* eslint-disable @typescript-eslint/no-duplicate-type-constituents */
4
+ // Those rules seem to be triggering a false positive on the `InternalAccountStructs`
5
+ // and `InternalAccountTypes`.
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
7
+ exports.InternalAccountStruct = exports.InternalAccountStructs = exports.InternalSolDataAccountStruct = exports.InternalBtcP2wpkhAccountStruct = exports.InternalEthErc4337AccountStruct = exports.InternalEthEoaAccountStruct = exports.InternalAccountMetadataStruct = void 0;
4
8
  const keyring_api_1 = require("@metamask/keyring-api");
5
9
  const keyring_utils_1 = require("@metamask/keyring-utils");
6
10
  const superstruct_1 = require("@metamask/superstruct");
7
- const types_1 = require("../btc/types");
8
- const types_2 = require("../eth/types");
9
11
  exports.InternalAccountMetadataStruct = (0, keyring_utils_1.object)({
10
12
  metadata: (0, keyring_utils_1.object)({
11
13
  name: (0, superstruct_1.string)(),
@@ -22,28 +24,30 @@ exports.InternalAccountMetadataStruct = (0, keyring_utils_1.object)({
22
24
  }),
23
25
  }),
24
26
  });
25
- /**
26
- * Creates an `InternalAccount` from an existing account `superstruct` object.
27
- *
28
- * @param accountStruct - An account `superstruct` object.
29
- * @returns The `InternalAccount` associated to `accountStruct`.
30
- */
31
- function asInternalAccountStruct(accountStruct) {
32
- return (0, keyring_utils_1.object)({
33
- ...accountStruct.schema,
34
- ...exports.InternalAccountMetadataStruct.schema,
35
- });
36
- }
37
- exports.InternalEthEoaAccountStruct = asInternalAccountStruct(types_2.EthEoaAccountStruct);
38
- exports.InternalEthErc4337AccountStruct = asInternalAccountStruct(types_2.EthErc4337AccountStruct);
39
- exports.InternalBtcP2wpkhAccountStruct = asInternalAccountStruct(types_1.BtcP2wpkhAccountStruct);
27
+ exports.InternalEthEoaAccountStruct = (0, keyring_utils_1.object)({
28
+ ...keyring_api_1.EthEoaAccountStruct.schema,
29
+ ...exports.InternalAccountMetadataStruct.schema,
30
+ });
31
+ exports.InternalEthErc4337AccountStruct = (0, keyring_utils_1.object)({
32
+ ...keyring_api_1.EthErc4337AccountStruct.schema,
33
+ ...exports.InternalAccountMetadataStruct.schema,
34
+ });
35
+ exports.InternalBtcP2wpkhAccountStruct = (0, keyring_utils_1.object)({
36
+ ...keyring_api_1.BtcP2wpkhAccountStruct.schema,
37
+ ...exports.InternalAccountMetadataStruct.schema,
38
+ });
39
+ exports.InternalSolDataAccountStruct = (0, keyring_utils_1.object)({
40
+ ...keyring_api_1.SolDataAccountStruct.schema,
41
+ ...exports.InternalAccountMetadataStruct.schema,
42
+ });
40
43
  exports.InternalAccountStructs = {
41
44
  [`${keyring_api_1.EthAccountType.Eoa}`]: exports.InternalEthEoaAccountStruct,
42
45
  [`${keyring_api_1.EthAccountType.Erc4337}`]: exports.InternalEthErc4337AccountStruct,
43
46
  [`${keyring_api_1.BtcAccountType.P2wpkh}`]: exports.InternalBtcP2wpkhAccountStruct,
47
+ [`${keyring_api_1.SolAccountType.DataAccount}`]: exports.InternalSolDataAccountStruct,
44
48
  };
45
49
  exports.InternalAccountStruct = (0, keyring_utils_1.object)({
46
50
  ...keyring_api_1.KeyringAccountStruct.schema,
47
51
  ...exports.InternalAccountMetadataStruct.schema,
48
52
  });
49
- //# sourceMappingURL=types.js.map
53
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,sEAAsE;AACtE,qFAAqF;AACrF,8BAA8B;;;AAE9B,uDAS+B;AAC/B,2DAAgE;AAEhE,uDAAgE;AAOnD,QAAA,6BAA6B,GAAG,IAAA,sBAAM,EAAC;IAClD,QAAQ,EAAE,IAAA,sBAAM,EAAC;QACf,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,iBAAiB,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAC1C,IAAI,EAAE,IAAA,6BAAa,EACjB,IAAA,sBAAM,EAAC;YACL,EAAE,EAAE,IAAA,oBAAM,GAAE;YACZ,OAAO,EAAE,IAAA,qBAAO,GAAE;YAClB,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC,CACH;QACD,YAAY,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QACrC,UAAU,EAAE,IAAA,oBAAM,GAAE;QACpB,OAAO,EAAE,IAAA,sBAAM,EAAC;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,IAAA,sBAAM,EAAC;IAChD,GAAG,iCAAmB,CAAC,MAAM;IAC7B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,IAAA,sBAAM,EAAC;IACpD,GAAG,qCAAuB,CAAC,MAAM;IACjC,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,8BAA8B,GAAG,IAAA,sBAAM,EAAC;IACnD,GAAG,oCAAsB,CAAC,MAAM;IAChC,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEU,QAAA,4BAA4B,GAAG,IAAA,sBAAM,EAAC;IACjD,GAAG,kCAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAcU,QAAA,sBAAsB,GAM/B;IACF,CAAC,GAAG,4BAAc,CAAC,GAAG,EAAE,CAAC,EAAE,mCAA2B;IACtD,CAAC,GAAG,4BAAc,CAAC,OAAO,EAAE,CAAC,EAAE,uCAA+B;IAC9D,CAAC,GAAG,4BAAc,CAAC,MAAM,EAAE,CAAC,EAAE,sCAA8B;IAC5D,CAAC,GAAG,4BAAc,CAAC,WAAW,EAAE,CAAC,EAAE,oCAA4B;CAChE,CAAC;AAQW,QAAA,qBAAqB,GAAG,IAAA,sBAAM,EAAC;IAC1C,GAAG,kCAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n// Those rules seem to be triggering a false positive on the `InternalAccountStructs`\n// and `InternalAccountTypes`.\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n BtcP2wpkhAccountStruct,\n EthEoaAccountStruct,\n EthErc4337AccountStruct,\n SolDataAccountStruct,\n} from '@metamask/keyring-api';\nimport { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}