@metamask-previews/keyring-api 21.0.0-45ee2b8 → 21.0.0-855692d

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.
package/dist/rpc.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BatchResponseStruct = exports.BatchRequestStruct = exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsRequestStruct = exports.ResolveAccountAddressResponseStruct = exports.ResolveAccountAddressRequestStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.ListAccountAssetsResponseStruct = exports.ListAccountAssetsRequestStruct = exports.ListAccountTransactionsResponseStruct = exports.ListAccountTransactionsRequestStruct = exports.DiscoverAccountsResponseStruct = exports.DiscoverAccountsRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = exports.KeyringRpcMethod = void 0;
3
+ exports.BatchResponseStruct = exports.BatchRequestStruct = exports.BatchRequestResponseStruct = exports.BatchRequestRequestStruct = exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsRequestStruct = exports.ResolveAccountAddressResponseStruct = exports.ResolveAccountAddressRequestStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.ListAccountAssetsResponseStruct = exports.ListAccountAssetsRequestStruct = exports.ListAccountTransactionsResponseStruct = exports.ListAccountTransactionsRequestStruct = exports.DiscoverAccountsResponseStruct = exports.DiscoverAccountsRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = exports.KeyringRpcMethod = void 0;
4
4
  exports.isKeyringRpcMethod = isKeyringRpcMethod;
5
5
  const keyring_utils_1 = require("@metamask/keyring-utils");
6
6
  const superstruct_1 = require("@metamask/superstruct");
@@ -217,54 +217,56 @@ exports.RejectRequestRequestStruct = (0, superstruct_1.object)({
217
217
  exports.RejectRequestResponseStruct = (0, superstruct_1.literal)(null);
218
218
  // ----------------------------------------------------------------------------
219
219
  // Batch RPC requests
220
+ exports.BatchRequestRequestStruct = (0, superstruct_1.union)([
221
+ exports.ListAccountsRequestStruct,
222
+ exports.GetAccountRequestStruct,
223
+ exports.CreateAccountRequestStruct,
224
+ exports.DiscoverAccountsRequestStruct,
225
+ exports.ListAccountAssetsRequestStruct,
226
+ exports.ListAccountTransactionsRequestStruct,
227
+ exports.GetAccountBalancesRequestStruct,
228
+ exports.ResolveAccountAddressRequestStruct,
229
+ exports.FilterAccountChainsRequestStruct,
230
+ exports.UpdateAccountRequestStruct,
231
+ exports.DeleteAccountRequestStruct,
232
+ exports.ExportAccountRequestStruct,
233
+ exports.ListRequestsRequestStruct,
234
+ exports.GetRequestRequestStruct,
235
+ exports.SubmitRequestRequestStruct,
236
+ exports.ApproveRequestRequestStruct,
237
+ exports.RejectRequestRequestStruct,
238
+ ]);
239
+ exports.BatchRequestResponseStruct = (0, superstruct_1.union)([
240
+ exports.ListAccountsResponseStruct,
241
+ exports.ListAccountsResponseStruct,
242
+ exports.GetAccountResponseStruct,
243
+ exports.CreateAccountResponseStruct,
244
+ exports.DiscoverAccountsResponseStruct,
245
+ exports.ListAccountAssetsResponseStruct,
246
+ exports.ListAccountTransactionsResponseStruct,
247
+ exports.GetAccountBalancesResponseStruct,
248
+ exports.ResolveAccountAddressResponseStruct,
249
+ exports.FilterAccountChainsResponseStruct,
250
+ exports.UpdateAccountResponseStruct,
251
+ exports.DeleteAccountResponseStruct,
252
+ exports.ExportAccountResponseStruct,
253
+ exports.ListRequestsResponseStruct,
254
+ exports.GetRequestResponseStruct,
255
+ exports.SubmitRequestResponseStruct,
256
+ exports.ApproveRequestResponseStruct,
257
+ exports.RejectRequestResponseStruct,
258
+ ]);
220
259
  exports.BatchRequestStruct = (0, superstruct_1.object)({
221
260
  ...CommonHeader,
222
261
  method: (0, superstruct_1.literal)('keyring_batch'),
223
262
  params: (0, superstruct_1.object)({
224
263
  id: keyring_utils_1.UuidStruct,
225
- requests: (0, superstruct_1.array)((0, superstruct_1.union)([
226
- exports.ListAccountsRequestStruct,
227
- exports.GetAccountRequestStruct,
228
- exports.CreateAccountRequestStruct,
229
- exports.DiscoverAccountsRequestStruct,
230
- exports.ListAccountAssetsRequestStruct,
231
- exports.ListAccountTransactionsRequestStruct,
232
- exports.GetAccountBalancesRequestStruct,
233
- exports.ResolveAccountAddressRequestStruct,
234
- exports.FilterAccountChainsRequestStruct,
235
- exports.UpdateAccountRequestStruct,
236
- exports.DeleteAccountRequestStruct,
237
- exports.ExportAccountRequestStruct,
238
- exports.ListRequestsRequestStruct,
239
- exports.GetRequestRequestStruct,
240
- exports.SubmitRequestRequestStruct,
241
- exports.ApproveRequestRequestStruct,
242
- exports.RejectRequestRequestStruct,
243
- ])),
264
+ requests: (0, superstruct_1.array)(exports.BatchRequestRequestStruct),
244
265
  }),
245
266
  });
246
267
  exports.BatchResponseStruct = (0, superstruct_1.array)((0, superstruct_1.union)([
247
268
  (0, superstruct_1.object)({
248
- response: (0, superstruct_1.union)([
249
- exports.ListAccountsResponseStruct,
250
- exports.ListAccountsResponseStruct,
251
- exports.GetAccountResponseStruct,
252
- exports.CreateAccountResponseStruct,
253
- exports.DiscoverAccountsResponseStruct,
254
- exports.ListAccountAssetsResponseStruct,
255
- exports.ListAccountTransactionsResponseStruct,
256
- exports.GetAccountBalancesResponseStruct,
257
- exports.ResolveAccountAddressResponseStruct,
258
- exports.FilterAccountChainsResponseStruct,
259
- exports.UpdateAccountResponseStruct,
260
- exports.DeleteAccountResponseStruct,
261
- exports.ExportAccountResponseStruct,
262
- exports.ListRequestsResponseStruct,
263
- exports.GetRequestResponseStruct,
264
- exports.SubmitRequestResponseStruct,
265
- exports.ApproveRequestResponseStruct,
266
- exports.RejectRequestResponseStruct,
267
- ]),
269
+ response: exports.BatchRequestResponseStruct,
268
270
  }),
269
271
  (0, superstruct_1.object)({
270
272
  error: (0, superstruct_1.string)(),
package/dist/rpc.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.cjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";;;AA4DA,gDAEC;AA9DD,2DAA2E;AAE3E,uDAS+B;AAC/B,2CAA6C;AAG7C,yCAae;AAEf;;GAEG;AACH,IAAY,gBAmBX;AAnBD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,iEAA6C,CAAA;IAC7C,mEAA+C,CAAA;IAC/C,+EAA2D,CAAA;IAC3D,qEAAiD,CAAA;IACjD,2EAAuD,CAAA;IACvD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,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A8B;YAC9B,4CAAoC;YACpC,uCAA+B;YAC/B,0CAAkC;YAClC,wCAAgC;YAChC,kCAA0B;YAC1B,kCAA0B;YAC1B,kCAA0B;YAC1B,iCAAyB;YACzB,+BAAuB;YACvB,kCAA0B;YAC1B,mCAA2B;YAC3B,kCAA0B;SAC3B,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,mBAAmB,GAAG,IAAA,mBAAK,EACtC,IAAA,mBAAK,EAAC;IACJ,IAAA,oBAAM,EAAC;QACL,QAAQ,EAAE,IAAA,mBAAK,EAAC;YACd,kCAA0B;YAC1B,kCAA0B;YAC1B,gCAAwB;YACxB,mCAA2B;YAC3B,sCAA8B;YAC9B,uCAA+B;YAC/B,6CAAqC;YACrC,wCAAgC;YAChC,2CAAmC;YACnC,yCAAiC;YACjC,mCAA2B;YAC3B,mCAA2B;YAC3B,mCAA2B;YAC3B,kCAA0B;YAC1B,gCAAwB;YACxB,mCAA2B;YAC3B,oCAA4B;YAC5B,mCAA2B;SAC5B,CAAC;KACH,CAAC;IACF,IAAA,oBAAM,EAAC;QACL,KAAK,EAAE,IAAA,oBAAM,GAAE;KAChB,CAAC;CACH,CAAC,CACH,CAAC","sourcesContent":["import { UuidStruct, JsonRpcRequestStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n object,\n literal,\n nullable,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport type { Keyring } from './api';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n CaipChainIdStruct,\n BalanceStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n PaginationStruct,\n CaipAccountIdStruct,\n DiscoveredAccountStruct,\n} from './api';\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n DiscoverAccounts = 'keyring_discoverAccounts',\n ListAccountAssets = 'keyring_listAccountAssets',\n ListAccountTransactions = 'keyring_listAccountTransactions',\n GetAccountBalances = 'keyring_getAccountBalances',\n ResolveAccountAddress = 'keyring_resolveAccountAddress',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n Batch = 'keyring_batch',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n/**\n * Keyring RPC interface.\n */\nexport type KeyringRpc = Keyring & {\n /**\n * Batch keyring RPC requests.\n *\n * @returns A promise that resolves to an array of results or errors for each\n * keyring RPC requests.\n */\n batch(requests: BatchRequest[]): Promise<BatchResponse>;\n};\n\n// ----------------------------------------------------------------------------\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// Discover accounts\n\nexport const DiscoverAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_discoverAccounts'),\n params: object({\n scopes: array(CaipChainIdStruct),\n entropySource: string(),\n groupIndex: number(),\n }),\n});\n\nexport type DiscoverAccountsRequest = Infer<\n typeof DiscoverAccountsRequestStruct\n>;\n\nexport const DiscoverAccountsResponseStruct = array(DiscoveredAccountStruct);\n\nexport type DiscoverAccountsResponse = Infer<\n typeof DiscoverAccountsResponseStruct\n>;\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// List account assets\n\nexport const ListAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountAssets'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ListAccountAssetsRequest = Infer<\n typeof ListAccountAssetsRequestStruct\n>;\n\nexport const ListAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type ListAccountAssetsResponse = Infer<\n typeof ListAccountAssetsResponseStruct\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// Resolve account address\n\nexport const ResolveAccountAddressRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_resolveAccountAddress'),\n params: object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n }),\n});\n\nexport type ResolveAccountAddressRequest = Infer<\n typeof ResolveAccountAddressRequestStruct\n>;\n\nexport const ResolveAccountAddressResponseStruct = nullable(\n object({\n address: CaipAccountIdStruct,\n }),\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsRequestStruct = 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 FilterAccountChainsRequestStruct\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\n// ----------------------------------------------------------------------------\n// Batch RPC requests\n\nexport const BatchRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_batch'),\n params: object({\n id: UuidStruct,\n requests: array(\n union([\n ListAccountsRequestStruct,\n GetAccountRequestStruct,\n CreateAccountRequestStruct,\n DiscoverAccountsRequestStruct,\n ListAccountAssetsRequestStruct,\n ListAccountTransactionsRequestStruct,\n GetAccountBalancesRequestStruct,\n ResolveAccountAddressRequestStruct,\n FilterAccountChainsRequestStruct,\n UpdateAccountRequestStruct,\n DeleteAccountRequestStruct,\n ExportAccountRequestStruct,\n ListRequestsRequestStruct,\n GetRequestRequestStruct,\n SubmitRequestRequestStruct,\n ApproveRequestRequestStruct,\n RejectRequestRequestStruct,\n ]),\n ),\n }),\n});\n\nexport type BatchRequest = Infer<typeof BatchRequestStruct>;\n\nexport const BatchResponseStruct = array(\n union([\n object({\n response: union([\n ListAccountsResponseStruct,\n ListAccountsResponseStruct,\n GetAccountResponseStruct,\n CreateAccountResponseStruct,\n DiscoverAccountsResponseStruct,\n ListAccountAssetsResponseStruct,\n ListAccountTransactionsResponseStruct,\n GetAccountBalancesResponseStruct,\n ResolveAccountAddressResponseStruct,\n FilterAccountChainsResponseStruct,\n UpdateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n ListRequestsResponseStruct,\n GetRequestResponseStruct,\n SubmitRequestResponseStruct,\n ApproveRequestResponseStruct,\n RejectRequestResponseStruct,\n ]),\n }),\n object({\n error: string(),\n }),\n ]),\n);\n\nexport type BatchResponse = Infer<typeof BatchResponseStruct>;\n\nexport type BatchResponseOne = BatchResponse[number];\n"]}
1
+ {"version":3,"file":"rpc.cjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";;;AA4DA,gDAEC;AA9DD,2DAA2E;AAE3E,uDAS+B;AAC/B,2CAA6C;AAG7C,yCAae;AAEf;;GAEG;AACH,IAAY,gBAmBX;AAnBD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,iEAA6C,CAAA;IAC7C,mEAA+C,CAAA;IAC/C,+EAA2D,CAAA;IAC3D,qEAAiD,CAAA;IACjD,2EAAuD,CAAA;IACvD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,6DAAyC,CAAA;IACzC,2DAAuC,CAAA;IACvC,2CAAuB,CAAA;AACzB,CAAC,EAnBW,gBAAgB,gCAAhB,gBAAgB,QAmB3B;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAeD,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBA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f,MAAM,EAAE,IAAA,qBAAO,EAAC,eAAe,CAAC;IAChC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,QAAQ,EAAE,IAAA,mBAAK,EAAC,iCAAyB,CAAC;KAC3C,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,mBAAmB,GAAG,IAAA,mBAAK,EACtC,IAAA,mBAAK,EAAC;IACJ,IAAA,oBAAM,EAAC;QACL,QAAQ,EAAE,kCAA0B;KACrC,CAAC;IACF,IAAA,oBAAM,EAAC;QACL,KAAK,EAAE,IAAA,oBAAM,GAAE;KAChB,CAAC;CACH,CAAC,CACH,CAAC","sourcesContent":["import { UuidStruct, JsonRpcRequestStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n object,\n literal,\n nullable,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport type { Keyring } from './api';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n CaipChainIdStruct,\n BalanceStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n PaginationStruct,\n CaipAccountIdStruct,\n DiscoveredAccountStruct,\n} from './api';\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n DiscoverAccounts = 'keyring_discoverAccounts',\n ListAccountAssets = 'keyring_listAccountAssets',\n ListAccountTransactions = 'keyring_listAccountTransactions',\n GetAccountBalances = 'keyring_getAccountBalances',\n ResolveAccountAddress = 'keyring_resolveAccountAddress',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n Batch = 'keyring_batch',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n/**\n * Keyring RPC interface.\n */\nexport type KeyringRpc = Keyring & {\n /**\n * Batch keyring RPC requests.\n *\n * @returns A promise that resolves to an array of results or errors for each\n * keyring RPC requests.\n */\n batch(requests: BatchRequestRequest[]): Promise<BatchResponse>;\n};\n\n// ----------------------------------------------------------------------------\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// Discover accounts\n\nexport const DiscoverAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_discoverAccounts'),\n params: object({\n scopes: array(CaipChainIdStruct),\n entropySource: string(),\n groupIndex: number(),\n }),\n});\n\nexport type DiscoverAccountsRequest = Infer<\n typeof DiscoverAccountsRequestStruct\n>;\n\nexport const DiscoverAccountsResponseStruct = array(DiscoveredAccountStruct);\n\nexport type DiscoverAccountsResponse = Infer<\n typeof DiscoverAccountsResponseStruct\n>;\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// List account assets\n\nexport const ListAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountAssets'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ListAccountAssetsRequest = Infer<\n typeof ListAccountAssetsRequestStruct\n>;\n\nexport const ListAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type ListAccountAssetsResponse = Infer<\n typeof ListAccountAssetsResponseStruct\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// Resolve account address\n\nexport const ResolveAccountAddressRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_resolveAccountAddress'),\n params: object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n }),\n});\n\nexport type ResolveAccountAddressRequest = Infer<\n typeof ResolveAccountAddressRequestStruct\n>;\n\nexport const ResolveAccountAddressResponseStruct = nullable(\n object({\n address: CaipAccountIdStruct,\n }),\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsRequestStruct = 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 FilterAccountChainsRequestStruct\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\n// ----------------------------------------------------------------------------\n// Batch RPC requests\n\nexport const BatchRequestRequestStruct = union([\n ListAccountsRequestStruct,\n GetAccountRequestStruct,\n CreateAccountRequestStruct,\n DiscoverAccountsRequestStruct,\n ListAccountAssetsRequestStruct,\n ListAccountTransactionsRequestStruct,\n GetAccountBalancesRequestStruct,\n ResolveAccountAddressRequestStruct,\n FilterAccountChainsRequestStruct,\n UpdateAccountRequestStruct,\n DeleteAccountRequestStruct,\n ExportAccountRequestStruct,\n ListRequestsRequestStruct,\n GetRequestRequestStruct,\n SubmitRequestRequestStruct,\n ApproveRequestRequestStruct,\n RejectRequestRequestStruct,\n]);\n\nexport type BatchRequestRequest = Infer<typeof BatchRequestRequestStruct>;\n\nexport const BatchRequestResponseStruct = union([\n ListAccountsResponseStruct,\n ListAccountsResponseStruct,\n GetAccountResponseStruct,\n CreateAccountResponseStruct,\n DiscoverAccountsResponseStruct,\n ListAccountAssetsResponseStruct,\n ListAccountTransactionsResponseStruct,\n GetAccountBalancesResponseStruct,\n ResolveAccountAddressResponseStruct,\n FilterAccountChainsResponseStruct,\n UpdateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n ListRequestsResponseStruct,\n GetRequestResponseStruct,\n SubmitRequestResponseStruct,\n ApproveRequestResponseStruct,\n RejectRequestResponseStruct,\n]);\n\nexport type BatchRequestResponse = Infer<typeof BatchRequestResponseStruct>;\n\nexport const BatchRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_batch'),\n params: object({\n id: UuidStruct,\n requests: array(BatchRequestRequestStruct),\n }),\n});\n\nexport type BatchRequest = Infer<typeof BatchRequestStruct>;\n\nexport const BatchResponseStruct = array(\n union([\n object({\n response: BatchRequestResponseStruct,\n }),\n object({\n error: string(),\n }),\n ]),\n);\n\nexport type BatchResponse = Infer<typeof BatchResponseStruct>;\n\nexport type BatchResponseOne = BatchResponse[number];\n"]}
package/dist/rpc.d.cts CHANGED
@@ -40,7 +40,7 @@ export type KeyringRpc = Keyring & {
40
40
  * @returns A promise that resolves to an array of results or errors for each
41
41
  * keyring RPC requests.
42
42
  */
43
- batch(requests: BatchRequest[]): Promise<BatchResponse>;
43
+ batch(requests: BatchRequestRequest[]): Promise<BatchResponse>;
44
44
  };
45
45
  export declare const ListAccountsRequestStruct: import("@metamask/superstruct").Struct<{
46
46
  method: "keyring_listAccounts";
@@ -1035,6 +1035,282 @@ export declare const RejectRequestRequestStruct: import("@metamask/superstruct")
1035
1035
  export type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;
1036
1036
  export declare const RejectRequestResponseStruct: import("@metamask/superstruct").Struct<null, null>;
1037
1037
  export type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;
1038
+ export declare const BatchRequestRequestStruct: import("@metamask/superstruct").Struct<{
1039
+ method: "keyring_listAccounts";
1040
+ id: string | number | null;
1041
+ jsonrpc: "2.0";
1042
+ } | {
1043
+ method: "keyring_getAccount";
1044
+ id: string | number | null;
1045
+ jsonrpc: "2.0";
1046
+ params: {
1047
+ id: string;
1048
+ };
1049
+ } | {
1050
+ method: "keyring_createAccount";
1051
+ id: string | number | null;
1052
+ jsonrpc: "2.0";
1053
+ params: {
1054
+ options: Record<string, import("@metamask/utils").Json>;
1055
+ };
1056
+ } | {
1057
+ method: "keyring_discoverAccounts";
1058
+ id: string | number | null;
1059
+ jsonrpc: "2.0";
1060
+ params: {
1061
+ groupIndex: number;
1062
+ scopes: `${string}:${string}`[];
1063
+ entropySource: string;
1064
+ };
1065
+ } | {
1066
+ method: "keyring_listAccountAssets";
1067
+ id: string | number | null;
1068
+ jsonrpc: "2.0";
1069
+ params: {
1070
+ id: string;
1071
+ };
1072
+ } | {
1073
+ method: "keyring_listAccountTransactions";
1074
+ id: string | number | null;
1075
+ jsonrpc: "2.0";
1076
+ params: {
1077
+ id: string;
1078
+ pagination: {
1079
+ limit: number;
1080
+ next?: string | null;
1081
+ };
1082
+ };
1083
+ } | {
1084
+ method: "keyring_getAccountBalances";
1085
+ id: string | number | null;
1086
+ jsonrpc: "2.0";
1087
+ params: {
1088
+ id: string;
1089
+ assets: `${string}:${string}/${string}:${string}`[];
1090
+ };
1091
+ } | {
1092
+ method: "keyring_resolveAccountAddress";
1093
+ id: string | number | null;
1094
+ jsonrpc: "2.0";
1095
+ params: {
1096
+ request: {
1097
+ method: string;
1098
+ id: string | number | null;
1099
+ jsonrpc: "2.0";
1100
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
1101
+ };
1102
+ scope: `${string}:${string}`;
1103
+ };
1104
+ } | {
1105
+ method: "keyring_filterAccountChains";
1106
+ id: string | number | null;
1107
+ jsonrpc: "2.0";
1108
+ params: {
1109
+ id: string;
1110
+ chains: string[];
1111
+ };
1112
+ } | {
1113
+ method: "keyring_updateAccount";
1114
+ id: string | number | null;
1115
+ jsonrpc: "2.0";
1116
+ params: {
1117
+ account: {
1118
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
1119
+ id: string;
1120
+ options: Record<string, import("@metamask/utils").Json> & {
1121
+ entropy?: {
1122
+ type: "mnemonic";
1123
+ id: string;
1124
+ derivationPath: string;
1125
+ groupIndex: number;
1126
+ } | {
1127
+ type: "private-key";
1128
+ };
1129
+ exportable?: boolean;
1130
+ };
1131
+ address: string;
1132
+ scopes: `${string}:${string}`[];
1133
+ methods: string[];
1134
+ };
1135
+ };
1136
+ } | {
1137
+ method: "keyring_deleteAccount";
1138
+ id: string | number | null;
1139
+ jsonrpc: "2.0";
1140
+ params: {
1141
+ id: string;
1142
+ };
1143
+ } | {
1144
+ method: "keyring_exportAccount";
1145
+ id: string | number | null;
1146
+ jsonrpc: "2.0";
1147
+ params: {
1148
+ id: string;
1149
+ };
1150
+ } | {
1151
+ method: "keyring_listRequests";
1152
+ id: string | number | null;
1153
+ jsonrpc: "2.0";
1154
+ } | {
1155
+ method: "keyring_getRequest";
1156
+ id: string | number | null;
1157
+ jsonrpc: "2.0";
1158
+ params: {
1159
+ id: string;
1160
+ };
1161
+ } | {
1162
+ method: "keyring_submitRequest";
1163
+ id: string | number | null;
1164
+ jsonrpc: "2.0";
1165
+ params: {
1166
+ id: string;
1167
+ origin: string;
1168
+ request: {
1169
+ method: string;
1170
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
1171
+ };
1172
+ scope: string;
1173
+ account: string;
1174
+ };
1175
+ } | {
1176
+ method: "keyring_approveRequest";
1177
+ id: string | number | null;
1178
+ jsonrpc: "2.0";
1179
+ params: {
1180
+ data: Record<string, import("@metamask/utils").Json>;
1181
+ id: string;
1182
+ };
1183
+ } | {
1184
+ method: "keyring_rejectRequest";
1185
+ id: string | number | null;
1186
+ jsonrpc: "2.0";
1187
+ params: {
1188
+ id: string;
1189
+ };
1190
+ }, null>;
1191
+ export type BatchRequestRequest = Infer<typeof BatchRequestRequestStruct>;
1192
+ export declare const BatchRequestResponseStruct: import("@metamask/superstruct").Struct<string[] | Record<string, import("@metamask/utils").Json> | {
1193
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
1194
+ id: string;
1195
+ options: Record<string, import("@metamask/utils").Json> & {
1196
+ entropy?: {
1197
+ type: "mnemonic";
1198
+ id: string;
1199
+ derivationPath: string;
1200
+ groupIndex: number;
1201
+ } | {
1202
+ type: "private-key";
1203
+ };
1204
+ exportable?: boolean;
1205
+ };
1206
+ address: string;
1207
+ scopes: `${string}:${string}`[];
1208
+ methods: string[];
1209
+ } | {
1210
+ id: string;
1211
+ origin: string;
1212
+ request: {
1213
+ method: string;
1214
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
1215
+ };
1216
+ scope: string;
1217
+ account: string;
1218
+ } | {
1219
+ pending: true;
1220
+ redirect?: {
1221
+ message?: string;
1222
+ url?: string;
1223
+ };
1224
+ } | {
1225
+ result: import("@metamask/utils").Json;
1226
+ pending: false;
1227
+ } | {
1228
+ data: {
1229
+ type: "unknown" | "send" | "receive" | "swap" | "bridge:send" | "bridge:receive";
1230
+ id: string;
1231
+ from: {
1232
+ address: string;
1233
+ asset: {
1234
+ unit: string;
1235
+ type: `${string}:${string}/${string}:${string}`;
1236
+ amount: string;
1237
+ fungible: true;
1238
+ } | {
1239
+ id: `${string}:${string}/${string}:${string}/${string}`;
1240
+ fungible: false;
1241
+ } | null;
1242
+ }[];
1243
+ events: {
1244
+ status: "submitted" | "unconfirmed" | "confirmed" | "failed";
1245
+ timestamp: number | null;
1246
+ }[];
1247
+ chain: `${string}:${string}`;
1248
+ status: "submitted" | "unconfirmed" | "confirmed" | "failed";
1249
+ account: string;
1250
+ timestamp: number | null;
1251
+ to: {
1252
+ address: string;
1253
+ asset: {
1254
+ unit: string;
1255
+ type: `${string}:${string}/${string}:${string}`;
1256
+ amount: string;
1257
+ fungible: true;
1258
+ } | {
1259
+ id: `${string}:${string}/${string}:${string}/${string}`;
1260
+ fungible: false;
1261
+ } | null;
1262
+ }[];
1263
+ fees: {
1264
+ type: "base" | "priority";
1265
+ asset: {
1266
+ unit: string;
1267
+ type: `${string}:${string}/${string}:${string}`;
1268
+ amount: string;
1269
+ fungible: true;
1270
+ } | {
1271
+ id: `${string}:${string}/${string}:${string}/${string}`;
1272
+ fungible: false;
1273
+ };
1274
+ }[];
1275
+ }[];
1276
+ next: string | null;
1277
+ } | {
1278
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
1279
+ id: string;
1280
+ options: Record<string, import("@metamask/utils").Json> & {
1281
+ entropy?: {
1282
+ type: "mnemonic";
1283
+ id: string;
1284
+ derivationPath: string;
1285
+ groupIndex: number;
1286
+ } | {
1287
+ type: "private-key";
1288
+ };
1289
+ exportable?: boolean;
1290
+ };
1291
+ address: string;
1292
+ scopes: `${string}:${string}`[];
1293
+ methods: string[];
1294
+ }[] | (`${string}:${string}/${string}:${string}` | `${string}:${string}/${string}:${string}/${string}`)[] | {
1295
+ type: "bip44";
1296
+ derivationPath: `m/${string}`;
1297
+ scopes: `${string}:${string}`[];
1298
+ }[] | Record<`${string}:${string}/${string}:${string}`, {
1299
+ unit: string;
1300
+ amount: string;
1301
+ }> | {
1302
+ id: string;
1303
+ origin: string;
1304
+ request: {
1305
+ method: string;
1306
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
1307
+ };
1308
+ scope: string;
1309
+ account: string;
1310
+ }[] | {
1311
+ address: `${string}:${string}:${string}`;
1312
+ } | null, null>;
1313
+ export type BatchRequestResponse = Infer<typeof BatchRequestResponseStruct>;
1038
1314
  export declare const BatchRequestStruct: import("@metamask/superstruct").Struct<{
1039
1315
  method: "keyring_batch";
1040
1316
  id: string | number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.d.cts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,OAAO,EAAE,wBAAc;AAgBrC;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,gBAAgB,6BAA6B;IAC7C,iBAAiB,8BAA8B;IAC/C,uBAAuB,oCAAoC;IAC3D,kBAAkB,+BAA+B;IACjD,qBAAqB,kCAAkC;IACvD,mBAAmB,gCAAgC;IACnD,aAAa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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAS/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC"}
package/dist/rpc.d.mts CHANGED
@@ -40,7 +40,7 @@ export type KeyringRpc = Keyring & {
40
40
  * @returns A promise that resolves to an array of results or errors for each
41
41
  * keyring RPC requests.
42
42
  */
43
- batch(requests: BatchRequest[]): Promise<BatchResponse>;
43
+ batch(requests: BatchRequestRequest[]): Promise<BatchResponse>;
44
44
  };
45
45
  export declare const ListAccountsRequestStruct: import("@metamask/superstruct").Struct<{
46
46
  method: "keyring_listAccounts";
@@ -1035,6 +1035,282 @@ export declare const RejectRequestRequestStruct: import("@metamask/superstruct")
1035
1035
  export type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;
1036
1036
  export declare const RejectRequestResponseStruct: import("@metamask/superstruct").Struct<null, null>;
1037
1037
  export type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;
1038
+ export declare const BatchRequestRequestStruct: import("@metamask/superstruct").Struct<{
1039
+ method: "keyring_listAccounts";
1040
+ id: string | number | null;
1041
+ jsonrpc: "2.0";
1042
+ } | {
1043
+ method: "keyring_getAccount";
1044
+ id: string | number | null;
1045
+ jsonrpc: "2.0";
1046
+ params: {
1047
+ id: string;
1048
+ };
1049
+ } | {
1050
+ method: "keyring_createAccount";
1051
+ id: string | number | null;
1052
+ jsonrpc: "2.0";
1053
+ params: {
1054
+ options: Record<string, import("@metamask/utils").Json>;
1055
+ };
1056
+ } | {
1057
+ method: "keyring_discoverAccounts";
1058
+ id: string | number | null;
1059
+ jsonrpc: "2.0";
1060
+ params: {
1061
+ groupIndex: number;
1062
+ scopes: `${string}:${string}`[];
1063
+ entropySource: string;
1064
+ };
1065
+ } | {
1066
+ method: "keyring_listAccountAssets";
1067
+ id: string | number | null;
1068
+ jsonrpc: "2.0";
1069
+ params: {
1070
+ id: string;
1071
+ };
1072
+ } | {
1073
+ method: "keyring_listAccountTransactions";
1074
+ id: string | number | null;
1075
+ jsonrpc: "2.0";
1076
+ params: {
1077
+ id: string;
1078
+ pagination: {
1079
+ limit: number;
1080
+ next?: string | null;
1081
+ };
1082
+ };
1083
+ } | {
1084
+ method: "keyring_getAccountBalances";
1085
+ id: string | number | null;
1086
+ jsonrpc: "2.0";
1087
+ params: {
1088
+ id: string;
1089
+ assets: `${string}:${string}/${string}:${string}`[];
1090
+ };
1091
+ } | {
1092
+ method: "keyring_resolveAccountAddress";
1093
+ id: string | number | null;
1094
+ jsonrpc: "2.0";
1095
+ params: {
1096
+ request: {
1097
+ method: string;
1098
+ id: string | number | null;
1099
+ jsonrpc: "2.0";
1100
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
1101
+ };
1102
+ scope: `${string}:${string}`;
1103
+ };
1104
+ } | {
1105
+ method: "keyring_filterAccountChains";
1106
+ id: string | number | null;
1107
+ jsonrpc: "2.0";
1108
+ params: {
1109
+ id: string;
1110
+ chains: string[];
1111
+ };
1112
+ } | {
1113
+ method: "keyring_updateAccount";
1114
+ id: string | number | null;
1115
+ jsonrpc: "2.0";
1116
+ params: {
1117
+ account: {
1118
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
1119
+ id: string;
1120
+ options: Record<string, import("@metamask/utils").Json> & {
1121
+ entropy?: {
1122
+ type: "mnemonic";
1123
+ id: string;
1124
+ derivationPath: string;
1125
+ groupIndex: number;
1126
+ } | {
1127
+ type: "private-key";
1128
+ };
1129
+ exportable?: boolean;
1130
+ };
1131
+ address: string;
1132
+ scopes: `${string}:${string}`[];
1133
+ methods: string[];
1134
+ };
1135
+ };
1136
+ } | {
1137
+ method: "keyring_deleteAccount";
1138
+ id: string | number | null;
1139
+ jsonrpc: "2.0";
1140
+ params: {
1141
+ id: string;
1142
+ };
1143
+ } | {
1144
+ method: "keyring_exportAccount";
1145
+ id: string | number | null;
1146
+ jsonrpc: "2.0";
1147
+ params: {
1148
+ id: string;
1149
+ };
1150
+ } | {
1151
+ method: "keyring_listRequests";
1152
+ id: string | number | null;
1153
+ jsonrpc: "2.0";
1154
+ } | {
1155
+ method: "keyring_getRequest";
1156
+ id: string | number | null;
1157
+ jsonrpc: "2.0";
1158
+ params: {
1159
+ id: string;
1160
+ };
1161
+ } | {
1162
+ method: "keyring_submitRequest";
1163
+ id: string | number | null;
1164
+ jsonrpc: "2.0";
1165
+ params: {
1166
+ id: string;
1167
+ origin: string;
1168
+ request: {
1169
+ method: string;
1170
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
1171
+ };
1172
+ scope: string;
1173
+ account: string;
1174
+ };
1175
+ } | {
1176
+ method: "keyring_approveRequest";
1177
+ id: string | number | null;
1178
+ jsonrpc: "2.0";
1179
+ params: {
1180
+ data: Record<string, import("@metamask/utils").Json>;
1181
+ id: string;
1182
+ };
1183
+ } | {
1184
+ method: "keyring_rejectRequest";
1185
+ id: string | number | null;
1186
+ jsonrpc: "2.0";
1187
+ params: {
1188
+ id: string;
1189
+ };
1190
+ }, null>;
1191
+ export type BatchRequestRequest = Infer<typeof BatchRequestRequestStruct>;
1192
+ export declare const BatchRequestResponseStruct: import("@metamask/superstruct").Struct<string[] | Record<string, import("@metamask/utils").Json> | {
1193
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
1194
+ id: string;
1195
+ options: Record<string, import("@metamask/utils").Json> & {
1196
+ entropy?: {
1197
+ type: "mnemonic";
1198
+ id: string;
1199
+ derivationPath: string;
1200
+ groupIndex: number;
1201
+ } | {
1202
+ type: "private-key";
1203
+ };
1204
+ exportable?: boolean;
1205
+ };
1206
+ address: string;
1207
+ scopes: `${string}:${string}`[];
1208
+ methods: string[];
1209
+ } | {
1210
+ id: string;
1211
+ origin: string;
1212
+ request: {
1213
+ method: string;
1214
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
1215
+ };
1216
+ scope: string;
1217
+ account: string;
1218
+ } | {
1219
+ pending: true;
1220
+ redirect?: {
1221
+ message?: string;
1222
+ url?: string;
1223
+ };
1224
+ } | {
1225
+ result: import("@metamask/utils").Json;
1226
+ pending: false;
1227
+ } | {
1228
+ data: {
1229
+ type: "unknown" | "send" | "receive" | "swap" | "bridge:send" | "bridge:receive";
1230
+ id: string;
1231
+ from: {
1232
+ address: string;
1233
+ asset: {
1234
+ unit: string;
1235
+ type: `${string}:${string}/${string}:${string}`;
1236
+ amount: string;
1237
+ fungible: true;
1238
+ } | {
1239
+ id: `${string}:${string}/${string}:${string}/${string}`;
1240
+ fungible: false;
1241
+ } | null;
1242
+ }[];
1243
+ events: {
1244
+ status: "submitted" | "unconfirmed" | "confirmed" | "failed";
1245
+ timestamp: number | null;
1246
+ }[];
1247
+ chain: `${string}:${string}`;
1248
+ status: "submitted" | "unconfirmed" | "confirmed" | "failed";
1249
+ account: string;
1250
+ timestamp: number | null;
1251
+ to: {
1252
+ address: string;
1253
+ asset: {
1254
+ unit: string;
1255
+ type: `${string}:${string}/${string}:${string}`;
1256
+ amount: string;
1257
+ fungible: true;
1258
+ } | {
1259
+ id: `${string}:${string}/${string}:${string}/${string}`;
1260
+ fungible: false;
1261
+ } | null;
1262
+ }[];
1263
+ fees: {
1264
+ type: "base" | "priority";
1265
+ asset: {
1266
+ unit: string;
1267
+ type: `${string}:${string}/${string}:${string}`;
1268
+ amount: string;
1269
+ fungible: true;
1270
+ } | {
1271
+ id: `${string}:${string}/${string}:${string}/${string}`;
1272
+ fungible: false;
1273
+ };
1274
+ }[];
1275
+ }[];
1276
+ next: string | null;
1277
+ } | {
1278
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
1279
+ id: string;
1280
+ options: Record<string, import("@metamask/utils").Json> & {
1281
+ entropy?: {
1282
+ type: "mnemonic";
1283
+ id: string;
1284
+ derivationPath: string;
1285
+ groupIndex: number;
1286
+ } | {
1287
+ type: "private-key";
1288
+ };
1289
+ exportable?: boolean;
1290
+ };
1291
+ address: string;
1292
+ scopes: `${string}:${string}`[];
1293
+ methods: string[];
1294
+ }[] | (`${string}:${string}/${string}:${string}` | `${string}:${string}/${string}:${string}/${string}`)[] | {
1295
+ type: "bip44";
1296
+ derivationPath: `m/${string}`;
1297
+ scopes: `${string}:${string}`[];
1298
+ }[] | Record<`${string}:${string}/${string}:${string}`, {
1299
+ unit: string;
1300
+ amount: string;
1301
+ }> | {
1302
+ id: string;
1303
+ origin: string;
1304
+ request: {
1305
+ method: string;
1306
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
1307
+ };
1308
+ scope: string;
1309
+ account: string;
1310
+ }[] | {
1311
+ address: `${string}:${string}:${string}`;
1312
+ } | null, null>;
1313
+ export type BatchRequestResponse = Infer<typeof BatchRequestResponseStruct>;
1038
1314
  export declare const BatchRequestStruct: import("@metamask/superstruct").Struct<{
1039
1315
  method: "keyring_batch";
1040
1316
  id: string | number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.d.mts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,KAAK,EAAE,OAAO,EAAE,wBAAc;AAgBrC;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,gBAAgB,6BAA6B;IAC7C,iBAAiB,8BAA8B;IAC/C,uBAAuB,oCAAoC;IAC3D,kBAAkB,+BAA+B;IACjD,qBAAqB,kCAAkC;IACvD,mBAAmB,gCAAgC;IACnD,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,cAAc,2BAA2B;IACzC,aAAa,0BAA0B;IACvC,KAAK,kBAAkB;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG;IACjC;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACzD,CAAC;AAYF,eAAO,MAAM,yBAAyB;;;;;;;;EAGpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE1E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA8B,CAAC;A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AO,mBAAmB,CAAC,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC"}
package/dist/rpc.mjs CHANGED
@@ -213,54 +213,56 @@ export const RejectRequestRequestStruct = object({
213
213
  export const RejectRequestResponseStruct = literal(null);
214
214
  // ----------------------------------------------------------------------------
215
215
  // Batch RPC requests
216
+ export const BatchRequestRequestStruct = union([
217
+ ListAccountsRequestStruct,
218
+ GetAccountRequestStruct,
219
+ CreateAccountRequestStruct,
220
+ DiscoverAccountsRequestStruct,
221
+ ListAccountAssetsRequestStruct,
222
+ ListAccountTransactionsRequestStruct,
223
+ GetAccountBalancesRequestStruct,
224
+ ResolveAccountAddressRequestStruct,
225
+ FilterAccountChainsRequestStruct,
226
+ UpdateAccountRequestStruct,
227
+ DeleteAccountRequestStruct,
228
+ ExportAccountRequestStruct,
229
+ ListRequestsRequestStruct,
230
+ GetRequestRequestStruct,
231
+ SubmitRequestRequestStruct,
232
+ ApproveRequestRequestStruct,
233
+ RejectRequestRequestStruct,
234
+ ]);
235
+ export const BatchRequestResponseStruct = union([
236
+ ListAccountsResponseStruct,
237
+ ListAccountsResponseStruct,
238
+ GetAccountResponseStruct,
239
+ CreateAccountResponseStruct,
240
+ DiscoverAccountsResponseStruct,
241
+ ListAccountAssetsResponseStruct,
242
+ ListAccountTransactionsResponseStruct,
243
+ GetAccountBalancesResponseStruct,
244
+ ResolveAccountAddressResponseStruct,
245
+ FilterAccountChainsResponseStruct,
246
+ UpdateAccountResponseStruct,
247
+ DeleteAccountResponseStruct,
248
+ ExportAccountResponseStruct,
249
+ ListRequestsResponseStruct,
250
+ GetRequestResponseStruct,
251
+ SubmitRequestResponseStruct,
252
+ ApproveRequestResponseStruct,
253
+ RejectRequestResponseStruct,
254
+ ]);
216
255
  export const BatchRequestStruct = object({
217
256
  ...CommonHeader,
218
257
  method: literal('keyring_batch'),
219
258
  params: object({
220
259
  id: UuidStruct,
221
- requests: array(union([
222
- ListAccountsRequestStruct,
223
- GetAccountRequestStruct,
224
- CreateAccountRequestStruct,
225
- DiscoverAccountsRequestStruct,
226
- ListAccountAssetsRequestStruct,
227
- ListAccountTransactionsRequestStruct,
228
- GetAccountBalancesRequestStruct,
229
- ResolveAccountAddressRequestStruct,
230
- FilterAccountChainsRequestStruct,
231
- UpdateAccountRequestStruct,
232
- DeleteAccountRequestStruct,
233
- ExportAccountRequestStruct,
234
- ListRequestsRequestStruct,
235
- GetRequestRequestStruct,
236
- SubmitRequestRequestStruct,
237
- ApproveRequestRequestStruct,
238
- RejectRequestRequestStruct,
239
- ])),
260
+ requests: array(BatchRequestRequestStruct),
240
261
  }),
241
262
  });
242
263
  export const BatchResponseStruct = array(union([
243
264
  object({
244
- response: union([
245
- ListAccountsResponseStruct,
246
- ListAccountsResponseStruct,
247
- GetAccountResponseStruct,
248
- CreateAccountResponseStruct,
249
- DiscoverAccountsResponseStruct,
250
- ListAccountAssetsResponseStruct,
251
- ListAccountTransactionsResponseStruct,
252
- GetAccountBalancesResponseStruct,
253
- ResolveAccountAddressResponseStruct,
254
- FilterAccountChainsResponseStruct,
255
- UpdateAccountResponseStruct,
256
- DeleteAccountResponseStruct,
257
- ExportAccountResponseStruct,
258
- ListRequestsResponseStruct,
259
- GetRequestResponseStruct,
260
- SubmitRequestResponseStruct,
261
- ApproveRequestResponseStruct,
262
- RejectRequestResponseStruct,
263
- ]),
265
+ response: BatchRequestResponseStruct,
264
266
  }),
265
267
  object({
266
268
  error: string(),
package/dist/rpc.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.mjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,gCAAgC;AAE3E,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAC/B,OAAO,EAAE,UAAU,EAAE,wBAAwB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M,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAIzD,+EAA+E;AAC/E,qBAAqB;AAErB,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;IACvC,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE,KAAK,CACb,KAAK,CAAC;YACJ,yBAAyB;YACzB,uBAAuB;YACvB,0BAA0B;YAC1B,6BAA6B;YAC7B,8BAA8B;YAC9B,oCAAoC;YACpC,+BAA+B;YAC/B,kCAAkC;YAClC,gCAAgC;YAChC,0BAA0B;YAC1B,0BAA0B;YAC1B,0BAA0B;YAC1B,yBAAyB;YACzB,uBAAuB;YACvB,0BAA0B;YAC1B,2BAA2B;YAC3B,0BAA0B;SAC3B,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CACtC,KAAK,CAAC;IACJ,MAAM,CAAC;QACL,QAAQ,EAAE,KAAK,CAAC;YACd,0BAA0B;YAC1B,0BAA0B;YAC1B,wBAAwB;YACxB,2BAA2B;YAC3B,8BAA8B;YAC9B,+BAA+B;YAC/B,qCAAqC;YACrC,gCAAgC;YAChC,mCAAmC;YACnC,iCAAiC;YACjC,2BAA2B;YAC3B,2BAA2B;YAC3B,2BAA2B;YAC3B,0BAA0B;YAC1B,wBAAwB;YACxB,2BAA2B;YAC3B,4BAA4B;YAC5B,2BAA2B;SAC5B,CAAC;KACH,CAAC;IACF,MAAM,CAAC;QACL,KAAK,EAAE,MAAM,EAAE;KAChB,CAAC;CACH,CAAC,CACH,CAAC","sourcesContent":["import { UuidStruct, JsonRpcRequestStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n object,\n literal,\n nullable,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport type { Keyring } from './api';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n CaipChainIdStruct,\n BalanceStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n PaginationStruct,\n CaipAccountIdStruct,\n DiscoveredAccountStruct,\n} from './api';\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n DiscoverAccounts = 'keyring_discoverAccounts',\n ListAccountAssets = 'keyring_listAccountAssets',\n ListAccountTransactions = 'keyring_listAccountTransactions',\n GetAccountBalances = 'keyring_getAccountBalances',\n ResolveAccountAddress = 'keyring_resolveAccountAddress',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n Batch = 'keyring_batch',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n/**\n * Keyring RPC interface.\n */\nexport type KeyringRpc = Keyring & {\n /**\n * Batch keyring RPC requests.\n *\n * @returns A promise that resolves to an array of results or errors for each\n * keyring RPC requests.\n */\n batch(requests: BatchRequest[]): Promise<BatchResponse>;\n};\n\n// ----------------------------------------------------------------------------\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// Discover accounts\n\nexport const DiscoverAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_discoverAccounts'),\n params: object({\n scopes: array(CaipChainIdStruct),\n entropySource: string(),\n groupIndex: number(),\n }),\n});\n\nexport type DiscoverAccountsRequest = Infer<\n typeof DiscoverAccountsRequestStruct\n>;\n\nexport const DiscoverAccountsResponseStruct = array(DiscoveredAccountStruct);\n\nexport type DiscoverAccountsResponse = Infer<\n typeof DiscoverAccountsResponseStruct\n>;\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// List account assets\n\nexport const ListAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountAssets'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ListAccountAssetsRequest = Infer<\n typeof ListAccountAssetsRequestStruct\n>;\n\nexport const ListAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type ListAccountAssetsResponse = Infer<\n typeof ListAccountAssetsResponseStruct\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// Resolve account address\n\nexport const ResolveAccountAddressRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_resolveAccountAddress'),\n params: object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n }),\n});\n\nexport type ResolveAccountAddressRequest = Infer<\n typeof ResolveAccountAddressRequestStruct\n>;\n\nexport const ResolveAccountAddressResponseStruct = nullable(\n object({\n address: CaipAccountIdStruct,\n }),\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsRequestStruct = 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 FilterAccountChainsRequestStruct\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\n// ----------------------------------------------------------------------------\n// Batch RPC requests\n\nexport const BatchRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_batch'),\n params: object({\n id: UuidStruct,\n requests: array(\n union([\n ListAccountsRequestStruct,\n GetAccountRequestStruct,\n CreateAccountRequestStruct,\n DiscoverAccountsRequestStruct,\n ListAccountAssetsRequestStruct,\n ListAccountTransactionsRequestStruct,\n GetAccountBalancesRequestStruct,\n ResolveAccountAddressRequestStruct,\n FilterAccountChainsRequestStruct,\n UpdateAccountRequestStruct,\n DeleteAccountRequestStruct,\n ExportAccountRequestStruct,\n ListRequestsRequestStruct,\n GetRequestRequestStruct,\n SubmitRequestRequestStruct,\n ApproveRequestRequestStruct,\n RejectRequestRequestStruct,\n ]),\n ),\n }),\n});\n\nexport type BatchRequest = Infer<typeof BatchRequestStruct>;\n\nexport const BatchResponseStruct = array(\n union([\n object({\n response: union([\n ListAccountsResponseStruct,\n ListAccountsResponseStruct,\n GetAccountResponseStruct,\n CreateAccountResponseStruct,\n DiscoverAccountsResponseStruct,\n ListAccountAssetsResponseStruct,\n ListAccountTransactionsResponseStruct,\n GetAccountBalancesResponseStruct,\n ResolveAccountAddressResponseStruct,\n FilterAccountChainsResponseStruct,\n UpdateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n ListRequestsResponseStruct,\n GetRequestResponseStruct,\n SubmitRequestResponseStruct,\n ApproveRequestResponseStruct,\n RejectRequestResponseStruct,\n ]),\n }),\n object({\n error: string(),\n }),\n ]),\n);\n\nexport type BatchResponse = Infer<typeof BatchResponseStruct>;\n\nexport type BatchResponseOne = BatchResponse[number];\n"]}
1
+ {"version":3,"file":"rpc.mjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,gCAAgC;AAE3E,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAC/B,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAG7C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACxB,wBAAc;AAEf;;GAEG;AACH,MAAM,CAAN,IAAY,gBAmBX;AAnBD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACr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0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,yBAAyB;IACzB,uBAAuB;IACvB,0BAA0B;IAC1B,2BAA2B;IAC3B,0BAA0B;CAC3B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;IAC9C,0BAA0B;IAC1B,0BAA0B;IAC1B,wBAAwB;IACxB,2BAA2B;IAC3B,8BAA8B;IAC9B,+BAA+B;IAC/B,qCAAqC;IACrC,gCAAgC;IAChC,mCAAmC;IACnC,iCAAiC;IACjC,2BAA2B;IAC3B,2BAA2B;IAC3B,2BAA2B;IAC3B,0BAA0B;IAC1B,wBAAwB;IACxB,2BAA2B;IAC3B,4BAA4B;IAC5B,2BAA2B;CAC5B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;IACvC,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE,KAAK,CAAC,yBAAyB,CAAC;KAC3C,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CACtC,KAAK,CAAC;IACJ,MAAM,CAAC;QACL,QAAQ,EAAE,0BAA0B;KACrC,CAAC;IACF,MAAM,CAAC;QACL,KAAK,EAAE,MAAM,EAAE;KAChB,CAAC;CACH,CAAC,CACH,CAAC","sourcesContent":["import { UuidStruct, JsonRpcRequestStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n object,\n literal,\n nullable,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport type { Keyring } from './api';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n CaipChainIdStruct,\n BalanceStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n PaginationStruct,\n CaipAccountIdStruct,\n DiscoveredAccountStruct,\n} from './api';\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n DiscoverAccounts = 'keyring_discoverAccounts',\n ListAccountAssets = 'keyring_listAccountAssets',\n ListAccountTransactions = 'keyring_listAccountTransactions',\n GetAccountBalances = 'keyring_getAccountBalances',\n ResolveAccountAddress = 'keyring_resolveAccountAddress',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n Batch = 'keyring_batch',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n/**\n * Keyring RPC interface.\n */\nexport type KeyringRpc = Keyring & {\n /**\n * Batch keyring RPC requests.\n *\n * @returns A promise that resolves to an array of results or errors for each\n * keyring RPC requests.\n */\n batch(requests: BatchRequestRequest[]): Promise<BatchResponse>;\n};\n\n// ----------------------------------------------------------------------------\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// Discover accounts\n\nexport const DiscoverAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_discoverAccounts'),\n params: object({\n scopes: array(CaipChainIdStruct),\n entropySource: string(),\n groupIndex: number(),\n }),\n});\n\nexport type DiscoverAccountsRequest = Infer<\n typeof DiscoverAccountsRequestStruct\n>;\n\nexport const DiscoverAccountsResponseStruct = array(DiscoveredAccountStruct);\n\nexport type DiscoverAccountsResponse = Infer<\n typeof DiscoverAccountsResponseStruct\n>;\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// List account assets\n\nexport const ListAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountAssets'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ListAccountAssetsRequest = Infer<\n typeof ListAccountAssetsRequestStruct\n>;\n\nexport const ListAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type ListAccountAssetsResponse = Infer<\n typeof ListAccountAssetsResponseStruct\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// Resolve account address\n\nexport const ResolveAccountAddressRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_resolveAccountAddress'),\n params: object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n }),\n});\n\nexport type ResolveAccountAddressRequest = Infer<\n typeof ResolveAccountAddressRequestStruct\n>;\n\nexport const ResolveAccountAddressResponseStruct = nullable(\n object({\n address: CaipAccountIdStruct,\n }),\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsRequestStruct = 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 FilterAccountChainsRequestStruct\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\n// ----------------------------------------------------------------------------\n// Batch RPC requests\n\nexport const BatchRequestRequestStruct = union([\n ListAccountsRequestStruct,\n GetAccountRequestStruct,\n CreateAccountRequestStruct,\n DiscoverAccountsRequestStruct,\n ListAccountAssetsRequestStruct,\n ListAccountTransactionsRequestStruct,\n GetAccountBalancesRequestStruct,\n ResolveAccountAddressRequestStruct,\n FilterAccountChainsRequestStruct,\n UpdateAccountRequestStruct,\n DeleteAccountRequestStruct,\n ExportAccountRequestStruct,\n ListRequestsRequestStruct,\n GetRequestRequestStruct,\n SubmitRequestRequestStruct,\n ApproveRequestRequestStruct,\n RejectRequestRequestStruct,\n]);\n\nexport type BatchRequestRequest = Infer<typeof BatchRequestRequestStruct>;\n\nexport const BatchRequestResponseStruct = union([\n ListAccountsResponseStruct,\n ListAccountsResponseStruct,\n GetAccountResponseStruct,\n CreateAccountResponseStruct,\n DiscoverAccountsResponseStruct,\n ListAccountAssetsResponseStruct,\n ListAccountTransactionsResponseStruct,\n GetAccountBalancesResponseStruct,\n ResolveAccountAddressResponseStruct,\n FilterAccountChainsResponseStruct,\n UpdateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n ListRequestsResponseStruct,\n GetRequestResponseStruct,\n SubmitRequestResponseStruct,\n ApproveRequestResponseStruct,\n RejectRequestResponseStruct,\n]);\n\nexport type BatchRequestResponse = Infer<typeof BatchRequestResponseStruct>;\n\nexport const BatchRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_batch'),\n params: object({\n id: UuidStruct,\n requests: array(BatchRequestRequestStruct),\n }),\n});\n\nexport type BatchRequest = Infer<typeof BatchRequestStruct>;\n\nexport const BatchResponseStruct = array(\n union([\n object({\n response: BatchRequestResponseStruct,\n }),\n object({\n error: string(),\n }),\n ]),\n);\n\nexport type BatchResponse = Infer<typeof BatchResponseStruct>;\n\nexport type BatchResponseOne = BatchResponse[number];\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/keyring-api",
3
- "version": "21.0.0-45ee2b8",
3
+ "version": "21.0.0-855692d",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",