@metamask/keyring-api 23.4.0 → 23.5.0

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 (146) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/api/account-options.cjs +3 -3
  3. package/dist/api/account-options.cjs.map +1 -1
  4. package/dist/api/account-options.d.cts.map +1 -1
  5. package/dist/api/account-options.d.mts.map +1 -1
  6. package/dist/api/account-options.mjs +2 -2
  7. package/dist/api/account-options.mjs.map +1 -1
  8. package/dist/api/account.cjs +1 -1
  9. package/dist/api/account.cjs.map +1 -1
  10. package/dist/api/account.mjs +2 -2
  11. package/dist/api/account.mjs.map +1 -1
  12. package/dist/api/asset.cjs +3 -3
  13. package/dist/api/asset.cjs.map +1 -1
  14. package/dist/api/asset.d.cts.map +1 -1
  15. package/dist/api/asset.d.mts.map +1 -1
  16. package/dist/api/asset.mjs +2 -2
  17. package/dist/api/asset.mjs.map +1 -1
  18. package/dist/api/balance.cjs +1 -1
  19. package/dist/api/balance.cjs.map +1 -1
  20. package/dist/api/balance.mjs +2 -2
  21. package/dist/api/balance.mjs.map +1 -1
  22. package/dist/api/options.cjs +3 -2
  23. package/dist/api/options.cjs.map +1 -1
  24. package/dist/api/options.d.cts +1 -1
  25. package/dist/api/options.d.cts.map +1 -1
  26. package/dist/api/options.d.mts +1 -1
  27. package/dist/api/options.d.mts.map +1 -1
  28. package/dist/api/options.mjs +2 -1
  29. package/dist/api/options.mjs.map +1 -1
  30. package/dist/api/pagination.cjs +2 -3
  31. package/dist/api/pagination.cjs.map +1 -1
  32. package/dist/api/pagination.d.cts +1 -1
  33. package/dist/api/pagination.d.cts.map +1 -1
  34. package/dist/api/pagination.d.mts +1 -1
  35. package/dist/api/pagination.d.mts.map +1 -1
  36. package/dist/api/pagination.mjs +1 -2
  37. package/dist/api/pagination.mjs.map +1 -1
  38. package/dist/api/request.cjs +3 -3
  39. package/dist/api/request.cjs.map +1 -1
  40. package/dist/api/request.d.cts +1 -1
  41. package/dist/api/request.d.cts.map +1 -1
  42. package/dist/api/request.d.mts +1 -1
  43. package/dist/api/request.d.mts.map +1 -1
  44. package/dist/api/request.mjs +2 -2
  45. package/dist/api/request.mjs.map +1 -1
  46. package/dist/api/response.cjs +5 -6
  47. package/dist/api/response.cjs.map +1 -1
  48. package/dist/api/response.d.cts.map +1 -1
  49. package/dist/api/response.d.mts.map +1 -1
  50. package/dist/api/response.mjs +1 -2
  51. package/dist/api/response.mjs.map +1 -1
  52. package/dist/api/transaction.cjs +10 -10
  53. package/dist/api/transaction.cjs.map +1 -1
  54. package/dist/api/transaction.d.cts +11 -11
  55. package/dist/api/transaction.d.cts.map +1 -1
  56. package/dist/api/transaction.d.mts +11 -11
  57. package/dist/api/transaction.d.mts.map +1 -1
  58. package/dist/api/transaction.mjs +2 -2
  59. package/dist/api/transaction.mjs.map +1 -1
  60. package/dist/btc/types.cjs +5 -6
  61. package/dist/btc/types.cjs.map +1 -1
  62. package/dist/btc/types.d.cts.map +1 -1
  63. package/dist/btc/types.d.mts.map +1 -1
  64. package/dist/btc/types.mjs +1 -2
  65. package/dist/btc/types.mjs.map +1 -1
  66. package/dist/eth/erc4337/types.cjs +9 -8
  67. package/dist/eth/erc4337/types.cjs.map +1 -1
  68. package/dist/eth/erc4337/types.d.cts +4 -4
  69. package/dist/eth/erc4337/types.d.cts.map +1 -1
  70. package/dist/eth/erc4337/types.d.mts +4 -4
  71. package/dist/eth/erc4337/types.d.mts.map +1 -1
  72. package/dist/eth/erc4337/types.mjs +2 -1
  73. package/dist/eth/erc4337/types.mjs.map +1 -1
  74. package/dist/eth/rpc/params.cjs +4 -5
  75. package/dist/eth/rpc/params.cjs.map +1 -1
  76. package/dist/eth/rpc/params.d.cts.map +1 -1
  77. package/dist/eth/rpc/params.d.mts.map +1 -1
  78. package/dist/eth/rpc/params.mjs +1 -2
  79. package/dist/eth/rpc/params.mjs.map +1 -1
  80. package/dist/eth/types.cjs +4 -5
  81. package/dist/eth/types.cjs.map +1 -1
  82. package/dist/eth/types.d.cts +1 -1
  83. package/dist/eth/types.d.cts.map +1 -1
  84. package/dist/eth/types.d.mts +1 -1
  85. package/dist/eth/types.d.mts.map +1 -1
  86. package/dist/eth/types.mjs +2 -3
  87. package/dist/eth/types.mjs.map +1 -1
  88. package/dist/events.cjs +20 -20
  89. package/dist/events.cjs.map +1 -1
  90. package/dist/events.d.cts +4 -4
  91. package/dist/events.d.cts.map +1 -1
  92. package/dist/events.d.mts +4 -4
  93. package/dist/events.d.mts.map +1 -1
  94. package/dist/events.mjs +2 -2
  95. package/dist/events.mjs.map +1 -1
  96. package/dist/rpc.cjs +36 -36
  97. package/dist/rpc.cjs.map +1 -1
  98. package/dist/rpc.d.cts +9 -9
  99. package/dist/rpc.d.cts.map +1 -1
  100. package/dist/rpc.d.mts +9 -9
  101. package/dist/rpc.d.mts.map +1 -1
  102. package/dist/rpc.mjs +2 -2
  103. package/dist/rpc.mjs.map +1 -1
  104. package/dist/sol/types.cjs +1 -2
  105. package/dist/sol/types.cjs.map +1 -1
  106. package/dist/sol/types.d.cts.map +1 -1
  107. package/dist/sol/types.d.mts.map +1 -1
  108. package/dist/sol/types.mjs +1 -2
  109. package/dist/sol/types.mjs.map +1 -1
  110. package/dist/trx/types.cjs +1 -2
  111. package/dist/trx/types.cjs.map +1 -1
  112. package/dist/trx/types.d.cts.map +1 -1
  113. package/dist/trx/types.d.mts.map +1 -1
  114. package/dist/trx/types.mjs +1 -2
  115. package/dist/trx/types.mjs.map +1 -1
  116. package/dist/v2/api/keyring-capabilities.cjs +5 -0
  117. package/dist/v2/api/keyring-capabilities.cjs.map +1 -1
  118. package/dist/v2/api/keyring-capabilities.d.cts +7 -0
  119. package/dist/v2/api/keyring-capabilities.d.cts.map +1 -1
  120. package/dist/v2/api/keyring-capabilities.d.mts +7 -0
  121. package/dist/v2/api/keyring-capabilities.d.mts.map +1 -1
  122. package/dist/v2/api/keyring-capabilities.mjs +5 -0
  123. package/dist/v2/api/keyring-capabilities.mjs.map +1 -1
  124. package/dist/v2/api/keyring-rpc.cjs +10 -10
  125. package/dist/v2/api/keyring-rpc.cjs.map +1 -1
  126. package/dist/v2/api/keyring-rpc.d.cts +2 -2
  127. package/dist/v2/api/keyring-rpc.d.cts.map +1 -1
  128. package/dist/v2/api/keyring-rpc.d.mts +2 -2
  129. package/dist/v2/api/keyring-rpc.d.mts.map +1 -1
  130. package/dist/v2/api/keyring-rpc.mjs +2 -2
  131. package/dist/v2/api/keyring-rpc.mjs.map +1 -1
  132. package/dist/v2/api/keyring-snap-rpc.cjs +14 -1
  133. package/dist/v2/api/keyring-snap-rpc.cjs.map +1 -1
  134. package/dist/v2/api/keyring-snap-rpc.d.cts +62 -8
  135. package/dist/v2/api/keyring-snap-rpc.d.cts.map +1 -1
  136. package/dist/v2/api/keyring-snap-rpc.d.mts +62 -8
  137. package/dist/v2/api/keyring-snap-rpc.d.mts.map +1 -1
  138. package/dist/v2/api/keyring-snap-rpc.mjs +16 -3
  139. package/dist/v2/api/keyring-snap-rpc.mjs.map +1 -1
  140. package/dist/xlm/types.cjs +1 -2
  141. package/dist/xlm/types.cjs.map +1 -1
  142. package/dist/xlm/types.d.cts.map +1 -1
  143. package/dist/xlm/types.d.mts.map +1 -1
  144. package/dist/xlm/types.mjs +1 -2
  145. package/dist/xlm/types.mjs.map +1 -1
  146. package/package.json +2 -2
@@ -1,7 +1,8 @@
1
- import type { AccountId } from "@metamask/keyring-utils";
1
+ import type { AccountId, JsonRpcRequest } from "@metamask/keyring-utils";
2
2
  import type { Infer } from "@metamask/superstruct";
3
+ import type { ResolvedAccountAddress } from "../../api/address.mjs";
3
4
  import type { Balance } from "../../api/balance.mjs";
4
- import type { CaipAssetType, CaipAssetTypeOrId } from "../../api/caip.mjs";
5
+ import type { CaipAssetType, CaipAssetTypeOrId, CaipChainId } from "../../api/caip.mjs";
5
6
  import type { Pagination } from "../../api/pagination.mjs";
6
7
  import type { TransactionsPage } from "../../api/transaction.mjs";
7
8
  import type { KeyringRpc, KeyringRpcRequests } from "./keyring-rpc.mjs";
@@ -14,6 +15,7 @@ export declare const KeyringSnapRpcMethod: {
14
15
  readonly GetAccountTransactions: "keyring_getAccountTransactions";
15
16
  readonly GetAccountAssets: "keyring_getAccountAssets";
16
17
  readonly GetAccountBalances: "keyring_getAccountBalances";
18
+ readonly ResolveAccountAddress: "keyring_resolveAccountAddress";
17
19
  readonly GetAccounts: "keyring_getAccounts";
18
20
  readonly CreateAccounts: "keyring_createAccounts";
19
21
  readonly GetAccount: "keyring_getAccount";
@@ -78,7 +80,7 @@ export declare const GetAccountTransactionsRequestStruct: import("@metamask/supe
78
80
  next?: string | null;
79
81
  }, {
80
82
  limit: import("@metamask/superstruct").Struct<number, null>;
81
- next: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag | null, null>;
83
+ next: import("@metamask/superstruct").ExactOptionalStruct<string | null, null>;
82
84
  }>;
83
85
  }>;
84
86
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
@@ -388,18 +390,18 @@ export declare const GetAccountTransactionsResponseStruct: import("@metamask/sup
388
390
  }>;
389
391
  timestamp: import("@metamask/superstruct").Struct<number | null, null>;
390
392
  }>>;
391
- details: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
393
+ details: import("@metamask/superstruct").ExactOptionalStruct<{
392
394
  origin?: string;
393
395
  securityAlertResponse?: "Benign" | "Warning" | "Malicious";
394
396
  typeLabel?: string;
395
397
  }, {
396
- origin: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
397
- securityAlertResponse: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | "Benign" | "Warning" | "Malicious", {
398
+ origin: import("@metamask/superstruct").ExactOptionalStruct<string, null>;
399
+ securityAlertResponse: import("@metamask/superstruct").ExactOptionalStruct<"Benign" | "Warning" | "Malicious", {
398
400
  Benign: "Benign";
399
401
  Warning: "Warning";
400
402
  Malicious: "Malicious";
401
403
  }>;
402
- typeLabel: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
404
+ typeLabel: import("@metamask/superstruct").ExactOptionalStruct<string, null>;
403
405
  }>;
404
406
  }>>;
405
407
  next: import("@metamask/superstruct").Struct<string | null, null>;
@@ -451,11 +453,58 @@ export declare const GetAccountBalancesResponseStruct: import("@metamask/superst
451
453
  amount: string;
452
454
  }>, null>;
453
455
  export type GetAccountBalancesResponse = Infer<typeof GetAccountBalancesResponseStruct>;
456
+ export declare const ResolveAccountAddressRequestStruct: import("@metamask/superstruct").Struct<{
457
+ method: "keyring_resolveAccountAddress";
458
+ id: string | number | null;
459
+ jsonrpc: "2.0";
460
+ params: {
461
+ request: {
462
+ method: string;
463
+ id: string | number | null;
464
+ jsonrpc: "2.0";
465
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
466
+ };
467
+ scope: `${string}:${string}`;
468
+ };
469
+ }, {
470
+ method: import("@metamask/superstruct").Struct<"keyring_resolveAccountAddress", "keyring_resolveAccountAddress">;
471
+ params: import("@metamask/superstruct").Struct<{
472
+ request: {
473
+ method: string;
474
+ id: string | number | null;
475
+ jsonrpc: "2.0";
476
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
477
+ };
478
+ scope: `${string}:${string}`;
479
+ }, {
480
+ scope: import("@metamask/superstruct").Struct<`${string}:${string}`, null>;
481
+ request: import("@metamask/superstruct").Struct<{
482
+ method: string;
483
+ id: string | number | null;
484
+ jsonrpc: "2.0";
485
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
486
+ }, {
487
+ jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
488
+ id: import("@metamask/superstruct").Struct<string | number | null, null>;
489
+ method: import("@metamask/superstruct").Struct<string, null>;
490
+ params: import("@metamask/superstruct").ExactOptionalStruct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[], null>;
491
+ }>;
492
+ }>;
493
+ jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
494
+ id: import("@metamask/superstruct").Struct<string | number | null, null>;
495
+ }>;
496
+ export type ResolveAccountAddressRequest = Infer<typeof ResolveAccountAddressRequestStruct>;
497
+ export declare const ResolveAccountAddressResponseStruct: import("@metamask/superstruct").Struct<{
498
+ address: `${string}:${string}:${string}`;
499
+ } | null, {
500
+ address: import("@metamask/superstruct").Struct<`${string}:${string}:${string}`, null>;
501
+ }>;
502
+ export type ResolveAccountAddressResponse = Infer<typeof ResolveAccountAddressResponseStruct>;
454
503
  /**
455
504
  * All keyring RPC requests available to a Snap - includes base
456
505
  * {@link KeyringRpcRequests} plus snap-specific request types.
457
506
  */
458
- export type KeyringSnapRpcRequests = KeyringRpcRequests | SetSelectedAccountsRequest | GetAccountTransactionsRequest | GetAccountAssetsRequest | GetAccountBalancesRequest;
507
+ export type KeyringSnapRpcRequests = KeyringRpcRequests | SetSelectedAccountsRequest | GetAccountTransactionsRequest | GetAccountAssetsRequest | GetAccountBalancesRequest | ResolveAccountAddressRequest;
459
508
  /**
460
509
  * Extract the proper request type for a given {@link KeyringSnapRpcMethod}.
461
510
  */
@@ -487,5 +536,10 @@ export type KeyringSnapRpc = KeyringRpc & {
487
536
  * Maps to `keyring_getAccountBalances`.
488
537
  */
489
538
  getAccountBalances?: (id: AccountId, assets: CaipAssetType[]) => Promise<Record<CaipAssetType, Balance>>;
539
+ /**
540
+ * Resolve the account address to use for routing a signing request.
541
+ * Maps to `keyring_resolveAccountAddress`.
542
+ */
543
+ resolveAccountAddress?: (scope: CaipChainId, request: JsonRpcRequest) => Promise<ResolvedAccountAddress | null>;
490
544
  };
491
545
  //# sourceMappingURL=keyring-snap-rpc.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-snap-rpc.d.mts","sourceRoot":"","sources":["../../../src/v2/api/keyring-snap-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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AC,EAAE,CACtB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,cAAc,KACpB,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;CAC7C,CAAC"}
@@ -1,7 +1,8 @@
1
- import { UuidStruct } from "@metamask/keyring-utils";
2
- import { array, literal, number, object, record, string, union } from "@metamask/superstruct";
1
+ import { UuidStruct, JsonRpcRequestStruct } from "@metamask/keyring-utils";
2
+ import { array, literal, nullable, number, object, record, string, union } from "@metamask/superstruct";
3
+ import { ResolvedAccountAddressStruct } from "../../api/address.mjs";
3
4
  import { BalanceStruct } from "../../api/balance.mjs";
4
- import { CaipAssetTypeOrIdStruct, CaipAssetTypeStruct } from "../../api/caip.mjs";
5
+ import { CaipAssetTypeOrIdStruct, CaipAssetTypeStruct, CaipChainIdStruct } from "../../api/caip.mjs";
5
6
  import { PaginationStruct } from "../../api/pagination.mjs";
6
7
  import { TransactionsPageStruct } from "../../api/transaction.mjs";
7
8
  import { KeyringRpcMethod } from "./keyring-rpc.mjs";
@@ -15,6 +16,7 @@ export const KeyringSnapRpcMethod = {
15
16
  GetAccountTransactions: 'keyring_getAccountTransactions',
16
17
  GetAccountAssets: 'keyring_getAccountAssets',
17
18
  GetAccountBalances: 'keyring_getAccountBalances',
19
+ ResolveAccountAddress: 'keyring_resolveAccountAddress',
18
20
  };
19
21
  /**
20
22
  * Check if a method is a Snap keyring RPC method (v2).
@@ -72,4 +74,15 @@ export const GetAccountBalancesRequestStruct = object({
72
74
  }),
73
75
  });
74
76
  export const GetAccountBalancesResponseStruct = record(CaipAssetTypeStruct, BalanceStruct);
77
+ // ----------------------------------------------------------------------------
78
+ // Resolve account address
79
+ export const ResolveAccountAddressRequestStruct = object({
80
+ ...CommonHeader,
81
+ method: literal(`${KeyringSnapRpcMethod.ResolveAccountAddress}`),
82
+ params: object({
83
+ scope: CaipChainIdStruct,
84
+ request: JsonRpcRequestStruct,
85
+ }),
86
+ });
87
+ export const ResolveAccountAddressResponseStruct = nullable(ResolvedAccountAddressStruct);
75
88
  //# sourceMappingURL=keyring-snap-rpc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-snap-rpc.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-snap-rpc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,gCAAgC;AAErD,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAE/B,OAAO,EAAE,aAAa,EAAE,8BAA0B;AAElD,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,2BAAuB;AAE9E,OAAO,EAAE,gBAAgB,EAAE,iCAA6B;AAExD,OAAO,EAAE,sBAAsB,EAAE,kCAA8B;AAE/D,OAAO,EAAE,gBAAgB,EAAE,0BAAsB;AAGjD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,GAAG,gBAAgB;IACnB,mBAAmB,EAAE,6BAA6B;IAClD,sBAAsB,EAAE,gCAAgC;IACxD,gBAAgB,EAAE,0BAA0B;IAC5C,kBAAkB,EAAE,4BAA4B;CACxC,CAAC;AAQX;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAc;IAEd,OAAO,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CACjD,MAA8B,CAC/B,CAAC;AACJ,CAAC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IACvB,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,wBAAwB;AAExB,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC;IACrD,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,GAAG,oBAAoB,CAAC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","sourcesContent":["import type { AccountId } from '@metamask/keyring-utils';\nimport { UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n object,\n record,\n string,\n union,\n} from '@metamask/superstruct';\n\nimport { BalanceStruct } from '../../api/balance';\nimport type { Balance } from '../../api/balance';\nimport { CaipAssetTypeOrIdStruct, CaipAssetTypeStruct } from '../../api/caip';\nimport type { CaipAssetType, CaipAssetTypeOrId } from '../../api/caip';\nimport { PaginationStruct } from '../../api/pagination';\nimport type { Pagination } from '../../api/pagination';\nimport { TransactionsPageStruct } from '../../api/transaction';\nimport type { TransactionsPage } from '../../api/transaction';\nimport { KeyringRpcMethod } from './keyring-rpc';\nimport type { KeyringRpc, KeyringRpcRequests } from './keyring-rpc';\n\n/**\n * All keyring RPC methods available to a Snap - includes the base\n * {@link KeyringRpcMethod} set plus snap-specific extensions.\n */\nexport const KeyringSnapRpcMethod = {\n ...KeyringRpcMethod,\n SetSelectedAccounts: 'keyring_setSelectedAccounts',\n GetAccountTransactions: 'keyring_getAccountTransactions',\n GetAccountAssets: 'keyring_getAccountAssets',\n GetAccountBalances: 'keyring_getAccountBalances',\n} as const;\n\n/**\n * All keyring RPC methods available to a Snap.\n */\nexport type KeyringSnapRpcMethod =\n (typeof KeyringSnapRpcMethod)[keyof typeof KeyringSnapRpcMethod];\n\n/**\n * Check if a method is a Snap keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a Snap keyring RPC method (v2).\n */\nexport function isKeyringSnapRpcMethod(\n method: string,\n): method is KeyringSnapRpcMethod {\n return Object.values(KeyringSnapRpcMethod).includes(\n method as KeyringSnapRpcMethod,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Set selected accounts\n\nexport const SetSelectedAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.SetSelectedAccounts}`),\n params: object({\n accounts: array(string()),\n }),\n});\n\nexport type SetSelectedAccountsRequest = Infer<\n typeof SetSelectedAccountsRequestStruct\n>;\n\nexport const SetSelectedAccountsResponseStruct = literal(null);\n\nexport type SetSelectedAccountsResponse = Infer<\n typeof SetSelectedAccountsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account transactions\n\nexport const GetAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountTransactions}`),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type GetAccountTransactionsRequest = Infer<\n typeof GetAccountTransactionsRequestStruct\n>;\n\nexport const GetAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type GetAccountTransactionsResponse = Infer<\n typeof GetAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account assets\n\nexport const GetAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountAssets}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountAssetsRequest = Infer<\n typeof GetAccountAssetsRequestStruct\n>;\n\nexport const GetAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type GetAccountAssetsResponse = Infer<\n typeof GetAccountAssetsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.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\n/**\n * All keyring RPC requests available to a Snap - includes base\n * {@link KeyringRpcRequests} plus snap-specific request types.\n */\nexport type KeyringSnapRpcRequests =\n | KeyringRpcRequests\n | SetSelectedAccountsRequest\n | GetAccountTransactionsRequest\n | GetAccountAssetsRequest\n | GetAccountBalancesRequest;\n\n/**\n * Extract the proper request type for a given {@link KeyringSnapRpcMethod}.\n */\nexport type KeyringSnapRpcRequest<RpcMethod extends KeyringSnapRpcMethod> =\n Extract<KeyringSnapRpcRequests, { method: `${RpcMethod}` }>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Snap keyring RPC interface - extends the base {@link KeyringRpc} with\n * optional snap-specific methods that a Snap may expose.\n */\nexport type KeyringSnapRpc = KeyringRpc & {\n /**\n * Notify the Snap of the currently selected accounts.\n * Maps to `keyring_setSelectedAccounts`.\n */\n setSelectedAccounts?: (accounts: AccountId[]) => Promise<void>;\n\n /**\n * Get transactions for an account with pagination.\n * Maps to `keyring_getAccountTransactions`.\n */\n getAccountTransactions?: (\n id: AccountId,\n pagination: Pagination,\n ) => Promise<TransactionsPage>;\n\n /**\n * Get the asset types supported by an account.\n * Maps to `keyring_getAccountAssets`.\n */\n getAccountAssets?: (id: AccountId) => Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Get balances for an account for the requested asset types.\n * Maps to `keyring_getAccountBalances`.\n */\n getAccountBalances?: (\n id: AccountId,\n assets: CaipAssetType[],\n ) => Promise<Record<CaipAssetType, Balance>>;\n};\n"]}
1
+ {"version":3,"file":"keyring-snap-rpc.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-snap-rpc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,gCAAgC;AAE3E,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAE/B,OAAO,EAAE,4BAA4B,EAAE,8BAA0B;AAEjE,OAAO,EAAE,aAAa,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H,MAAM,CAAC,MAAM,mCAAmC,GAAG,QAAQ,CACzD,4BAA4B,CAC7B,CAAC","sourcesContent":["import type { AccountId, JsonRpcRequest } from '@metamask/keyring-utils';\nimport { UuidStruct, JsonRpcRequestStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n nullable,\n number,\n object,\n record,\n string,\n union,\n} from '@metamask/superstruct';\n\nimport { ResolvedAccountAddressStruct } from '../../api/address';\nimport type { ResolvedAccountAddress } from '../../api/address';\nimport { BalanceStruct } from '../../api/balance';\nimport type { Balance } from '../../api/balance';\nimport {\n CaipAssetTypeOrIdStruct,\n CaipAssetTypeStruct,\n CaipChainIdStruct,\n} from '../../api/caip';\nimport type {\n CaipAssetType,\n CaipAssetTypeOrId,\n CaipChainId,\n} from '../../api/caip';\nimport { PaginationStruct } from '../../api/pagination';\nimport type { Pagination } from '../../api/pagination';\nimport { TransactionsPageStruct } from '../../api/transaction';\nimport type { TransactionsPage } from '../../api/transaction';\nimport { KeyringRpcMethod } from './keyring-rpc';\nimport type { KeyringRpc, KeyringRpcRequests } from './keyring-rpc';\n\n/**\n * All keyring RPC methods available to a Snap - includes the base\n * {@link KeyringRpcMethod} set plus snap-specific extensions.\n */\nexport const KeyringSnapRpcMethod = {\n ...KeyringRpcMethod,\n SetSelectedAccounts: 'keyring_setSelectedAccounts',\n GetAccountTransactions: 'keyring_getAccountTransactions',\n GetAccountAssets: 'keyring_getAccountAssets',\n GetAccountBalances: 'keyring_getAccountBalances',\n ResolveAccountAddress: 'keyring_resolveAccountAddress',\n} as const;\n\n/**\n * All keyring RPC methods available to a Snap.\n */\nexport type KeyringSnapRpcMethod =\n (typeof KeyringSnapRpcMethod)[keyof typeof KeyringSnapRpcMethod];\n\n/**\n * Check if a method is a Snap keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a Snap keyring RPC method (v2).\n */\nexport function isKeyringSnapRpcMethod(\n method: string,\n): method is KeyringSnapRpcMethod {\n return Object.values(KeyringSnapRpcMethod).includes(\n method as KeyringSnapRpcMethod,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Set selected accounts\n\nexport const SetSelectedAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.SetSelectedAccounts}`),\n params: object({\n accounts: array(string()),\n }),\n});\n\nexport type SetSelectedAccountsRequest = Infer<\n typeof SetSelectedAccountsRequestStruct\n>;\n\nexport const SetSelectedAccountsResponseStruct = literal(null);\n\nexport type SetSelectedAccountsResponse = Infer<\n typeof SetSelectedAccountsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account transactions\n\nexport const GetAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountTransactions}`),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type GetAccountTransactionsRequest = Infer<\n typeof GetAccountTransactionsRequestStruct\n>;\n\nexport const GetAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type GetAccountTransactionsResponse = Infer<\n typeof GetAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account assets\n\nexport const GetAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountAssets}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountAssetsRequest = Infer<\n typeof GetAccountAssetsRequestStruct\n>;\n\nexport const GetAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type GetAccountAssetsResponse = Infer<\n typeof GetAccountAssetsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.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(`${KeyringSnapRpcMethod.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 ResolvedAccountAddressStruct,\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * All keyring RPC requests available to a Snap - includes base\n * {@link KeyringRpcRequests} plus snap-specific request types.\n */\nexport type KeyringSnapRpcRequests =\n | KeyringRpcRequests\n | SetSelectedAccountsRequest\n | GetAccountTransactionsRequest\n | GetAccountAssetsRequest\n | GetAccountBalancesRequest\n | ResolveAccountAddressRequest;\n\n/**\n * Extract the proper request type for a given {@link KeyringSnapRpcMethod}.\n */\nexport type KeyringSnapRpcRequest<RpcMethod extends KeyringSnapRpcMethod> =\n Extract<KeyringSnapRpcRequests, { method: `${RpcMethod}` }>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Snap keyring RPC interface - extends the base {@link KeyringRpc} with\n * optional snap-specific methods that a Snap may expose.\n */\nexport type KeyringSnapRpc = KeyringRpc & {\n /**\n * Notify the Snap of the currently selected accounts.\n * Maps to `keyring_setSelectedAccounts`.\n */\n setSelectedAccounts?: (accounts: AccountId[]) => Promise<void>;\n\n /**\n * Get transactions for an account with pagination.\n * Maps to `keyring_getAccountTransactions`.\n */\n getAccountTransactions?: (\n id: AccountId,\n pagination: Pagination,\n ) => Promise<TransactionsPage>;\n\n /**\n * Get the asset types supported by an account.\n * Maps to `keyring_getAccountAssets`.\n */\n getAccountAssets?: (id: AccountId) => Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Get balances for an account for the requested asset types.\n * Maps to `keyring_getAccountBalances`.\n */\n getAccountBalances?: (\n id: AccountId,\n assets: CaipAssetType[],\n ) => Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolve the account address to use for routing a signing request.\n * Maps to `keyring_resolveAccountAddress`.\n */\n resolveAccountAddress?: (\n scope: CaipChainId,\n request: JsonRpcRequest,\n ) => Promise<ResolvedAccountAddress | null>;\n};\n"]}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.XlmAccountStruct = exports.XlmMethod = exports.XlmAddressStruct = void 0;
4
- const keyring_utils_1 = require("@metamask/keyring-utils");
5
4
  const superstruct_1 = require("@metamask/superstruct");
6
5
  const utils_1 = require("@metamask/utils");
7
6
  const api_1 = require("../api/index.cjs");
@@ -21,7 +20,7 @@ var XlmMethod;
21
20
  XlmMethod["SignTransaction"] = "signTransaction";
22
21
  XlmMethod["SignAuthEntry"] = "signAuthEntry";
23
22
  })(XlmMethod || (exports.XlmMethod = XlmMethod = {}));
24
- exports.XlmAccountStruct = (0, keyring_utils_1.object)({
23
+ exports.XlmAccountStruct = (0, superstruct_1.object)({
25
24
  ...api_1.KeyringAccountStruct.schema,
26
25
  /**
27
26
  * Account address.
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/xlm/types.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAEjD,uDAAwE;AACxE,2CAAgD;AAEhD,0CAIgB;AAEhB;;;;;GAKG;AACU,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAEhF;;GAEG;AACH,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,4CAA+B,CAAA;AACjC,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAEY,QAAA,gBAAgB,GAAG,IAAA,sBAAM,EAAC;IACrC,GAAG,0BAAoB,CAAC,MAAM;IAC9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IACzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,OAAO,EAAE,CAAC;IAC1C;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,uBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CAChD,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal, nonempty } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\nimport {\n CaipChainIdStruct,\n KeyringAccountStruct,\n XlmAccountType,\n} from '../api';\n\n/**\n * Stellar account addresses use strkey encoding: non-muxed accounts start with `G`\n * and are 56 characters long.\n *\n * TODO: Add checksum validation.\n */\nexport const XlmAddressStruct = definePattern('XlmAddress', /^G[A-Z2-7]{55}$/u);\n\n/**\n * Supported Stellar methods.\n */\nexport enum XlmMethod {\n SignMessage = 'signMessage',\n SignTransaction = 'signTransaction',\n SignAuthEntry = 'signAuthEntry',\n}\n\nexport const XlmAccountStruct = object({\n ...KeyringAccountStruct.schema,\n /**\n * Account address.\n */\n address: XlmAddressStruct,\n /**\n * Account type.\n */\n type: literal(`${XlmAccountType.Account}`),\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * Account supported methods.\n */\n methods: array(enums(Object.values(XlmMethod))),\n});\n\nexport type XlmAccount = Infer<typeof XlmAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/xlm/types.ts"],"names":[],"mappings":";;;AACA,uDAAgF;AAChF,2CAAgD;AAEhD,0CAIgB;AAEhB;;;;;GAKG;AACU,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAEhF;;GAEG;AACH,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,4CAA+B,CAAA;AACjC,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAEY,QAAA,gBAAgB,GAAG,IAAA,oBAAM,EAAC;IACrC,GAAG,0BAAoB,CAAC,MAAM;IAC9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IACzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,OAAO,EAAE,CAAC;IAC1C;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,uBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CAChD,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal, nonempty, object } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\nimport {\n CaipChainIdStruct,\n KeyringAccountStruct,\n XlmAccountType,\n} from '../api';\n\n/**\n * Stellar account addresses use strkey encoding: non-muxed accounts start with `G`\n * and are 56 characters long.\n *\n * TODO: Add checksum validation.\n */\nexport const XlmAddressStruct = definePattern('XlmAddress', /^G[A-Z2-7]{55}$/u);\n\n/**\n * Supported Stellar methods.\n */\nexport enum XlmMethod {\n SignMessage = 'signMessage',\n SignTransaction = 'signTransaction',\n SignAuthEntry = 'signAuthEntry',\n}\n\nexport const XlmAccountStruct = object({\n ...KeyringAccountStruct.schema,\n /**\n * Account address.\n */\n address: XlmAddressStruct,\n /**\n * Account type.\n */\n type: literal(`${XlmAccountType.Account}`),\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * Account supported methods.\n */\n methods: array(enums(Object.values(XlmMethod))),\n});\n\nexport type XlmAccount = Infer<typeof XlmAccountStruct>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/xlm/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAUnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,sDAAkD,CAAC;AAEhF;;GAEG;AACH,oBAAY,SAAS;IACnB,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;IAE3B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/xlm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAUnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,sDAAkD,CAAC;AAEhF;;GAEG;AACH,oBAAY,SAAS;IACnB,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;IAE3B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/xlm/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAUnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,sDAAkD,CAAC;AAEhF;;GAEG;AACH,oBAAY,SAAS;IACnB,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;IAE3B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/xlm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAUnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,sDAAkD,CAAC;AAEhF;;GAEG;AACH,oBAAY,SAAS;IACnB,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;CAChC;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;IAE3B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
- import { object } from "@metamask/keyring-utils";
2
- import { array, enums, literal, nonempty } from "@metamask/superstruct";
1
+ import { array, enums, literal, nonempty, object } from "@metamask/superstruct";
3
2
  import { definePattern } from "@metamask/utils";
4
3
  import { CaipChainIdStruct, KeyringAccountStruct, XlmAccountType } from "../api/index.mjs";
5
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/xlm/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AACxE,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAEhD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACf,yBAAe;AAEhB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,4CAA+B,CAAA;AACjC,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;IACrC,GAAG,oBAAoB,CAAC,MAAM;IAC9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IACzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAC1C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CAChD,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal, nonempty } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\nimport {\n CaipChainIdStruct,\n KeyringAccountStruct,\n XlmAccountType,\n} from '../api';\n\n/**\n * Stellar account addresses use strkey encoding: non-muxed accounts start with `G`\n * and are 56 characters long.\n *\n * TODO: Add checksum validation.\n */\nexport const XlmAddressStruct = definePattern('XlmAddress', /^G[A-Z2-7]{55}$/u);\n\n/**\n * Supported Stellar methods.\n */\nexport enum XlmMethod {\n SignMessage = 'signMessage',\n SignTransaction = 'signTransaction',\n SignAuthEntry = 'signAuthEntry',\n}\n\nexport const XlmAccountStruct = object({\n ...KeyringAccountStruct.schema,\n /**\n * Account address.\n */\n address: XlmAddressStruct,\n /**\n * Account type.\n */\n type: literal(`${XlmAccountType.Account}`),\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * Account supported methods.\n */\n methods: array(enums(Object.values(XlmMethod))),\n});\n\nexport type XlmAccount = Infer<typeof XlmAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/xlm/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,8BAA8B;AAChF,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAEhD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACf,yBAAe;AAEhB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,4CAA+B,CAAA;AACjC,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;IACrC,GAAG,oBAAoB,CAAC,MAAM;IAC9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IACzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAC1C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CAChD,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal, nonempty, object } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\nimport {\n CaipChainIdStruct,\n KeyringAccountStruct,\n XlmAccountType,\n} from '../api';\n\n/**\n * Stellar account addresses use strkey encoding: non-muxed accounts start with `G`\n * and are 56 characters long.\n *\n * TODO: Add checksum validation.\n */\nexport const XlmAddressStruct = definePattern('XlmAddress', /^G[A-Z2-7]{55}$/u);\n\n/**\n * Supported Stellar methods.\n */\nexport enum XlmMethod {\n SignMessage = 'signMessage',\n SignTransaction = 'signTransaction',\n SignAuthEntry = 'signAuthEntry',\n}\n\nexport const XlmAccountStruct = object({\n ...KeyringAccountStruct.schema,\n /**\n * Account address.\n */\n address: XlmAddressStruct,\n /**\n * Account type.\n */\n type: literal(`${XlmAccountType.Account}`),\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * Account supported methods.\n */\n methods: array(enums(Object.values(XlmMethod))),\n});\n\nexport type XlmAccount = Infer<typeof XlmAccountStruct>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/keyring-api",
3
- "version": "23.4.0",
3
+ "version": "23.5.0",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "keyring",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@metamask/keyring-utils": "^3.3.1",
71
- "@metamask/superstruct": "^3.1.0",
71
+ "@metamask/superstruct": "^3.3.0",
72
72
  "@metamask/utils": "^11.11.0",
73
73
  "bitcoin-address-validation": "^2.2.3"
74
74
  },