@metamask-previews/keyring-api 23.3.0-e51c895 → 23.4.0-5951828

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 (154) hide show
  1. package/CHANGELOG.md +20 -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 +78 -42
  99. package/dist/rpc.d.cts.map +1 -1
  100. package/dist/rpc.d.mts +78 -42
  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/index.cjs +1 -0
  117. package/dist/v2/api/index.cjs.map +1 -1
  118. package/dist/v2/api/index.d.cts +1 -0
  119. package/dist/v2/api/index.d.cts.map +1 -1
  120. package/dist/v2/api/index.d.mts +1 -0
  121. package/dist/v2/api/index.d.mts.map +1 -1
  122. package/dist/v2/api/index.mjs +1 -0
  123. package/dist/v2/api/index.mjs.map +1 -1
  124. package/dist/v2/api/keyring-capabilities.cjs +37 -0
  125. package/dist/v2/api/keyring-capabilities.cjs.map +1 -1
  126. package/dist/v2/api/keyring-capabilities.d.cts +57 -0
  127. package/dist/v2/api/keyring-capabilities.d.cts.map +1 -1
  128. package/dist/v2/api/keyring-capabilities.d.mts +57 -0
  129. package/dist/v2/api/keyring-capabilities.d.mts.map +1 -1
  130. package/dist/v2/api/keyring-capabilities.mjs +37 -0
  131. package/dist/v2/api/keyring-capabilities.mjs.map +1 -1
  132. package/dist/v2/api/keyring-rpc.cjs +10 -10
  133. package/dist/v2/api/keyring-rpc.cjs.map +1 -1
  134. package/dist/v2/api/keyring-rpc.d.cts +2 -2
  135. package/dist/v2/api/keyring-rpc.d.cts.map +1 -1
  136. package/dist/v2/api/keyring-rpc.d.mts +2 -2
  137. package/dist/v2/api/keyring-rpc.d.mts.map +1 -1
  138. package/dist/v2/api/keyring-rpc.mjs +2 -2
  139. package/dist/v2/api/keyring-rpc.mjs.map +1 -1
  140. package/dist/v2/api/keyring-snap-rpc.cjs +92 -0
  141. package/dist/v2/api/keyring-snap-rpc.cjs.map +1 -0
  142. package/dist/v2/api/keyring-snap-rpc.d.cts +545 -0
  143. package/dist/v2/api/keyring-snap-rpc.d.cts.map +1 -0
  144. package/dist/v2/api/keyring-snap-rpc.d.mts +545 -0
  145. package/dist/v2/api/keyring-snap-rpc.d.mts.map +1 -0
  146. package/dist/v2/api/keyring-snap-rpc.mjs +88 -0
  147. package/dist/v2/api/keyring-snap-rpc.mjs.map +1 -0
  148. package/dist/xlm/types.cjs +1 -2
  149. package/dist/xlm/types.cjs.map +1 -1
  150. package/dist/xlm/types.d.cts.map +1 -1
  151. package/dist/xlm/types.d.mts.map +1 -1
  152. package/dist/xlm/types.mjs +1 -2
  153. package/dist/xlm/types.mjs.map +1 -1
  154. package/package.json +2 -2
@@ -1,8 +1,7 @@
1
- import { object } from "@metamask/keyring-utils";
2
- import { nonempty, array, enums, literal } from "@metamask/superstruct";
1
+ import { nonempty, array, enums, literal, object } from "@metamask/superstruct";
3
2
  import { definePattern } from "@metamask/utils";
4
- import { EthScope } from "./index.mjs";
5
3
  import { CaipChainIdStruct, EthAccountType, KeyringAccountStruct } from "../api/index.mjs";
4
+ import { EthScope } from "./constants.mjs";
6
5
  const ETH_BYTES_REGEX = /^0x[0-9a-f]*$/iu;
7
6
  export const EthBytesStruct = definePattern('EthBytes', ETH_BYTES_REGEX);
8
7
  // Stricter struct that uses `Hex` as final type.
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AACxE,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAGhD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAC7B,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACrB,yBAAe;AAEhB,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AACzE,iDAAiD;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC/C,gBAAgB,EAChB,eAAe,CAChB,CAAC;AAEF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAC/E,iDAAiD;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CACjD,kBAAkB,EAClB,iBAAiB,CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B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AG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { EthScope } from '.';\nimport {\n CaipChainIdStruct,\n EthAccountType,\n KeyringAccountStruct,\n} from '../api';\n\nconst ETH_BYTES_REGEX = /^0x[0-9a-f]*$/iu;\nexport const EthBytesStruct = definePattern('EthBytes', ETH_BYTES_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthBytesStrictStruct = definePattern<Hex>(\n 'EthBytesStrict',\n ETH_BYTES_REGEX,\n);\n\nconst ETH_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/iu;\nexport const EthAddressStruct = definePattern('EthAddress', ETH_ADDRESS_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthAddressStrictStruct = definePattern<Hex>(\n 'EthAddressStrict',\n ETH_ADDRESS_REGEX,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155:0']).\n */\n scopes: nonempty(array(literal(EthScope.Eoa))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAChF,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAGhD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oB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ACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;KAC/B,CAAC,CACH;CACF,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;IAC5C,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAE1C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal, object } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport {\n CaipChainIdStruct,\n EthAccountType,\n KeyringAccountStruct,\n} from '../api';\nimport { EthScope } from './constants';\n\nconst ETH_BYTES_REGEX = /^0x[0-9a-f]*$/iu;\nexport const EthBytesStruct = definePattern('EthBytes', ETH_BYTES_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthBytesStrictStruct = definePattern<Hex>(\n 'EthBytesStrict',\n ETH_BYTES_REGEX,\n);\n\nconst ETH_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/iu;\nexport const EthAddressStruct = definePattern('EthAddress', ETH_ADDRESS_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthAddressStrictStruct = definePattern<Hex>(\n 'EthAddressStrict',\n ETH_ADDRESS_REGEX,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155:0']).\n */\n scopes: nonempty(array(literal(EthScope.Eoa))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
package/dist/events.cjs CHANGED
@@ -22,9 +22,9 @@ var KeyringEvent;
22
22
  KeyringEvent["AccountAssetListUpdated"] = "notify:accountAssetListUpdated";
23
23
  KeyringEvent["AccountTransactionsUpdated"] = "notify:accountTransactionsUpdated";
24
24
  })(KeyringEvent || (exports.KeyringEvent = KeyringEvent = {}));
25
- exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
25
+ exports.AccountCreatedEventStruct = (0, superstruct_1.object)({
26
26
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountCreated}`),
27
- params: (0, keyring_utils_1.object)({
27
+ params: (0, superstruct_1.object)({
28
28
  /**
29
29
  * New account object.
30
30
  */
@@ -36,13 +36,13 @@ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
36
36
  * client to decide whether to use it. The keyring won't be informed if the
37
37
  * client decides to use a different name.
38
38
  */
39
- accountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
39
+ accountNameSuggestion: (0, superstruct_1.exactOptional)((0, superstruct_1.string)()),
40
40
  /**
41
41
  * Instructs MetaMask to display the add account confirmation dialog in the UI.
42
42
  *
43
43
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
44
44
  */
45
- displayConfirmation: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
45
+ displayConfirmation: (0, superstruct_1.exactOptional)((0, superstruct_1.boolean)()),
46
46
  /**
47
47
  * Instructs MetaMask to display the name confirmation dialog in the UI.
48
48
  * Otherwise, the account will be added with the suggested name, if it's not
@@ -51,34 +51,34 @@ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
51
51
  *
52
52
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
53
53
  */
54
- displayAccountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
54
+ displayAccountNameSuggestion: (0, superstruct_1.exactOptional)((0, superstruct_1.boolean)()),
55
55
  /**
56
56
  * Metamask internal options.
57
57
  */
58
58
  ...api_1.MetaMaskOptionsStruct.schema,
59
59
  }),
60
60
  });
61
- exports.AccountUpdatedEventStruct = (0, keyring_utils_1.object)({
61
+ exports.AccountUpdatedEventStruct = (0, superstruct_1.object)({
62
62
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountUpdated}`),
63
- params: (0, keyring_utils_1.object)({
63
+ params: (0, superstruct_1.object)({
64
64
  /**
65
65
  * Updated account object.
66
66
  */
67
67
  account: api_1.KeyringAccountStruct,
68
68
  }),
69
69
  });
70
- exports.AccountDeletedEventStruct = (0, keyring_utils_1.object)({
70
+ exports.AccountDeletedEventStruct = (0, superstruct_1.object)({
71
71
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountDeleted}`),
72
- params: (0, keyring_utils_1.object)({
72
+ params: (0, superstruct_1.object)({
73
73
  /**
74
74
  * Deleted account ID.
75
75
  */
76
76
  id: keyring_utils_1.UuidStruct,
77
77
  }),
78
78
  });
79
- exports.RequestApprovedEventStruct = (0, keyring_utils_1.object)({
79
+ exports.RequestApprovedEventStruct = (0, superstruct_1.object)({
80
80
  method: (0, superstruct_1.literal)(`${KeyringEvent.RequestApproved}`),
81
- params: (0, keyring_utils_1.object)({
81
+ params: (0, superstruct_1.object)({
82
82
  /**
83
83
  * Request ID.
84
84
  */
@@ -89,9 +89,9 @@ exports.RequestApprovedEventStruct = (0, keyring_utils_1.object)({
89
89
  result: utils_1.JsonStruct,
90
90
  }),
91
91
  });
92
- exports.RequestRejectedEventStruct = (0, keyring_utils_1.object)({
92
+ exports.RequestRejectedEventStruct = (0, superstruct_1.object)({
93
93
  method: (0, superstruct_1.literal)(`${KeyringEvent.RequestRejected}`),
94
- params: (0, keyring_utils_1.object)({
94
+ params: (0, superstruct_1.object)({
95
95
  /**
96
96
  * Request ID.
97
97
  */
@@ -107,9 +107,9 @@ exports.RequestRejectedEventStruct = (0, keyring_utils_1.object)({
107
107
  *
108
108
  * The Snap can choose to emit this event for multiple accounts at once.
109
109
  */
110
- exports.AccountBalancesUpdatedEventStruct = (0, keyring_utils_1.object)({
110
+ exports.AccountBalancesUpdatedEventStruct = (0, superstruct_1.object)({
111
111
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountBalancesUpdated}`),
112
- params: (0, keyring_utils_1.object)({
112
+ params: (0, superstruct_1.object)({
113
113
  /**
114
114
  * Balances updates of accounts owned by the Snap.
115
115
  */
@@ -140,9 +140,9 @@ exports.AccountBalancesUpdatedEventStruct = (0, keyring_utils_1.object)({
140
140
  *
141
141
  * The Snap can choose to emit this event for multiple accounts at once.
142
142
  */
143
- exports.AccountTransactionsUpdatedEventStruct = (0, keyring_utils_1.object)({
143
+ exports.AccountTransactionsUpdatedEventStruct = (0, superstruct_1.object)({
144
144
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountTransactionsUpdated}`),
145
- params: (0, keyring_utils_1.object)({
145
+ params: (0, superstruct_1.object)({
146
146
  /**
147
147
  * Transactions updates of accounts owned by the Snap.
148
148
  */
@@ -164,9 +164,9 @@ exports.AccountTransactionsUpdatedEventStruct = (0, keyring_utils_1.object)({
164
164
  *
165
165
  * The Snap can choose to emit this event for multiple accounts at once.
166
166
  */
167
- exports.AccountAssetListUpdatedEventStruct = (0, keyring_utils_1.object)({
167
+ exports.AccountAssetListUpdatedEventStruct = (0, superstruct_1.object)({
168
168
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountAssetListUpdated}`),
169
- params: (0, keyring_utils_1.object)({
169
+ params: (0, superstruct_1.object)({
170
170
  /**
171
171
  * Asset list update of accounts owned by the Snap.
172
172
  */
@@ -178,7 +178,7 @@ exports.AccountAssetListUpdatedEventStruct = (0, keyring_utils_1.object)({
178
178
  /**
179
179
  * Asset list changes for that account.
180
180
  */
181
- (0, keyring_utils_1.object)({
181
+ (0, superstruct_1.object)({
182
182
  /**
183
183
  * New assets detected.
184
184
  */
@@ -1 +1 @@
1
- {"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AAEjC,uDAAgF;AAChF,2CAIyB;AAEzB,yCAKe;AAEf;;GAEG;AACH,IAAY,YAcX;AAdD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;IAE1C,wBAAwB;IACxB,wEAAwD,CAAA;IACxD,0EAA0D,CAAA;IAC1D,gFAAgE,CAAA;AAClE,CAAC,EAdW,YAAY,4BAAZ,YAAY,QAcvB;AAEY,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAE9C;;;;WAIG;QACH,mBAAmB,EAAE,IAAA,6BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QAE7C;;;;;;;WAOG;QACH,4BAA4B,EAAE,IAAA,6BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QAEtD;;WAEG;QACH,GAAG,2BAAqB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H,+BAAe;QAEf;;WAEG;QACH,IAAA,oBAAM;QACJ;;WAEG;QACH,2BAAmB;QAEnB;;WAEG;QACH,+BAAyB,CAC1B,CACF;KACF,CAAC;CACH,CAAC,CAAC;AAOH;;;;;;;GAOG;AACU,QAAA,qCAAqC,GAAG,IAAA,sBAAM,EAAC;IAC1D,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,0BAA0B,EAAE,CAAC;IAC7D,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,YAAY,EAAE,IAAA,oBAAM;QAClB;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,mBAAK,EAAC,uBAAiB,CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAOH;;;;;;GAMG;AACU,QAAA,kCAAkC,GAAG,IAAA,sBAAM,EAAC;IACvD,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,MAAM,EAAE,IAAA,oBAAM;QACZ;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,sBAAM,EAAC;YACL;;eAEG;YACH,KAAK,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n MetaMaskOptionsStruct,\n} from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n\n // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n\n /**\n * Metamask internal options.\n */\n ...MetaMaskOptionsStruct.schema,\n }),\n});\nexport type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;\nexport type AccountCreatedEventPayload = AccountCreatedEvent['params'];\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\nexport type AccountUpdatedEvent = Infer<typeof AccountUpdatedEventStruct>;\nexport type AccountUpdatedEventPayload = AccountUpdatedEvent['params'];\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\nexport type AccountDeletedEvent = Infer<typeof AccountDeletedEventStruct>;\nexport type AccountDeletedEventPayload = AccountDeletedEvent['params'];\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\nexport type RequestApprovedEvent = Infer<typeof RequestApprovedEventStruct>;\nexport type RequestApprovedEventPayload = RequestApprovedEvent['params'];\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\nexport type RequestRejectedEvent = Infer<typeof RequestRejectedEventStruct>;\nexport type RequestRejectedEventPayload = RequestRejectedEvent['params'];\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n\n/**\n * Keyring events.\n */\n// For some reason, eslint sometimes infer one of those members as `any`...\ntype KeyringEvents =\n | AccountCreatedEvent\n | AccountUpdatedEvent\n | AccountDeletedEvent\n | AccountAssetListUpdatedEvent\n | AccountBalancesUpdatedEvent\n | AccountTransactionsUpdatedEvent\n | RequestApprovedEvent\n | RequestRejectedEvent;\n\n/**\n * Extract the payload for a given `KeyringEvent` event.\n */\nexport type KeyringEventPayload<Event extends KeyringEvent> = Extract<\n KeyringEvents,\n // We need to use a literal string here, since that is what `KeyringEvents`\n // is using (probably because of `superstruct`.\n { method: `${Event}` }\n>['params'];\n"]}
1
+ {"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAAsE;AAEtE,uDAQ+B;AAC/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CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAOH;;;;;;GAMG;AACU,QAAA,kCAAkC,GAAG,IAAA,oBAAM,EAAC;IACvD,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,MAAM,EAAE,IAAA,oBAAM;QACZ;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,oBAAM,EAAC;YACL;;eAEG;YACH,KAAK,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { UuidStruct, AccountIdStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n literal,\n record,\n string,\n object,\n exactOptional,\n} from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n MetaMaskOptionsStruct,\n} from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n\n // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n\n /**\n * Metamask internal options.\n */\n ...MetaMaskOptionsStruct.schema,\n }),\n});\nexport type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;\nexport type AccountCreatedEventPayload = AccountCreatedEvent['params'];\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\nexport type AccountUpdatedEvent = Infer<typeof AccountUpdatedEventStruct>;\nexport type AccountUpdatedEventPayload = AccountUpdatedEvent['params'];\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\nexport type AccountDeletedEvent = Infer<typeof AccountDeletedEventStruct>;\nexport type AccountDeletedEventPayload = AccountDeletedEvent['params'];\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\nexport type RequestApprovedEvent = Infer<typeof RequestApprovedEventStruct>;\nexport type RequestApprovedEventPayload = RequestApprovedEvent['params'];\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\nexport type RequestRejectedEvent = Infer<typeof RequestRejectedEventStruct>;\nexport type RequestRejectedEventPayload = RequestRejectedEvent['params'];\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n\n/**\n * Keyring events.\n */\n// For some reason, eslint sometimes infer one of those members as `any`...\ntype KeyringEvents =\n | AccountCreatedEvent\n | AccountUpdatedEvent\n | AccountDeletedEvent\n | AccountAssetListUpdatedEvent\n | AccountBalancesUpdatedEvent\n | AccountTransactionsUpdatedEvent\n | RequestApprovedEvent\n | RequestRejectedEvent;\n\n/**\n * Extract the payload for a given `KeyringEvent` event.\n */\nexport type KeyringEventPayload<Event extends KeyringEvent> = Extract<\n KeyringEvents,\n // We need to use a literal string here, since that is what `KeyringEvents`\n // is using (probably because of `superstruct`.\n { method: `${Event}` }\n>['params'];\n"]}
package/dist/events.d.cts CHANGED
@@ -72,7 +72,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
72
72
  displayConfirmation?: boolean;
73
73
  displayAccountNameSuggestion?: boolean;
74
74
  }, {
75
- metamask: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
75
+ metamask: import("@metamask/superstruct").ExactOptionalStruct<{
76
76
  correlationId: string;
77
77
  }, {
78
78
  correlationId: import("@metamask/superstruct").Struct<string, null>;
@@ -137,13 +137,13 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
137
137
  * client to decide whether to use it. The keyring won't be informed if the
138
138
  * client decides to use a different name.
139
139
  */
140
- accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
140
+ accountNameSuggestion: import("@metamask/superstruct").ExactOptionalStruct<string, null>;
141
141
  /**
142
142
  * Instructs MetaMask to display the add account confirmation dialog in the UI.
143
143
  *
144
144
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
145
145
  */
146
- displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
146
+ displayConfirmation: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
147
147
  /**
148
148
  * Instructs MetaMask to display the name confirmation dialog in the UI.
149
149
  * Otherwise, the account will be added with the suggested name, if it's not
@@ -152,7 +152,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
152
152
  *
153
153
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
154
154
  */
155
- displayAccountNameSuggestion: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
155
+ displayAccountNameSuggestion: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
156
156
  }>;
157
157
  }>;
158
158
  export type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;IAG1C,sBAAsB,kCAAkC;IACxD,uBAAuB,mCAAmC;IAC1D,0BAA0B,sCAAsC;CACjE;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;;WAIG;;QAGH;;;;;;;WAOG;;;EAQL,CAAC;A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GAC/B,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,YAAY,IAAI,OAAO,CACnE,aAAa,EAGb;IAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;CAAE,CACvB,CAAC,QAAQ,CAAC,CAAC"}
package/dist/events.d.mts CHANGED
@@ -72,7 +72,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
72
72
  displayConfirmation?: boolean;
73
73
  displayAccountNameSuggestion?: boolean;
74
74
  }, {
75
- metamask: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
75
+ metamask: import("@metamask/superstruct").ExactOptionalStruct<{
76
76
  correlationId: string;
77
77
  }, {
78
78
  correlationId: import("@metamask/superstruct").Struct<string, null>;
@@ -137,13 +137,13 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
137
137
  * client to decide whether to use it. The keyring won't be informed if the
138
138
  * client decides to use a different name.
139
139
  */
140
- accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
140
+ accountNameSuggestion: import("@metamask/superstruct").ExactOptionalStruct<string, null>;
141
141
  /**
142
142
  * Instructs MetaMask to display the add account confirmation dialog in the UI.
143
143
  *
144
144
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
145
145
  */
146
- displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
146
+ displayConfirmation: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
147
147
  /**
148
148
  * Instructs MetaMask to display the name confirmation dialog in the UI.
149
149
  * Otherwise, the account will be added with the suggested name, if it's not
@@ -152,7 +152,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
152
152
  *
153
153
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
154
154
  */
155
- displayAccountNameSuggestion: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
155
+ displayAccountNameSuggestion: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
156
156
  }>;
157
157
  }>;
158
158
  export type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;IAG1C,sBAAsB,kCAAkC;IACxD,uBAAuB,mCAAmC;IAC1D,0BAA0B,sCAAsC;CACjE;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;;WAIG;;QAGH;;;;;;;WAOG;;;EAQL,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;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,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAG9C;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaL,CAAC;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AACF,MAAM,MAAM,sCAAsC,GAChD,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;QAG3C;;WAEG;;;;;;EAuBL,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC;AAEzC;;GAEG;AAEH,KAAK,aAAa,GACd,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,4BAA4B,GAC5B,2BAA2B,GAC3B,+BAA+B,GAC/B,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,YAAY,IAAI,OAAO,CACnE,aAAa,EAGb;IAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;CAAE,CACvB,CAAC,QAAQ,CAAC,CAAC"}
package/dist/events.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { exactOptional, object, UuidStruct, AccountIdStruct } from "@metamask/keyring-utils";
2
- import { array, boolean, literal, record, string } from "@metamask/superstruct";
1
+ import { UuidStruct, AccountIdStruct } from "@metamask/keyring-utils";
2
+ import { array, boolean, literal, record, string, object, exactOptional } from "@metamask/superstruct";
3
3
  import { CaipAssetTypeStruct, CaipAssetTypeOrIdStruct, JsonStruct } from "@metamask/utils";
4
4
  import { FungibleAssetAmountStruct, KeyringAccountStruct, TransactionStruct, MetaMaskOptionsStruct } from "./api/index.mjs";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,MAAM,EACN,UAAU,EACV,eAAe,EAChB,gCAAgC;AAEjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAChF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACX,wBAAwB;AAEzB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACtB,wBAAc;AAEf;;GAEG;AACH,MAAM,CAAN,IAAY,YAcX;AAdD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;IAE1C,wBAAwB;IACxB,wEAAwD,CAAA;IACxD,0EAA0D,CAAA;IAC1D,gFAAgE,CAAA;AAClE,CAAC,EAdW,YAAY,KAAZ,YAAY,QAcvB;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;QAE9C;;;;WAIG;QACH,mBAAmB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAE7C;;;;;;;WAOG;QACH,4BAA4B,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAEtD;;WAEG;QACH,GAAG,qBAAqB,CAAC,MAAM;KAChC,CAA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yB,CAC1B,CACF;KACF,CAAC;CACH,CAAC,CAAC;AAOH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,MAAM,CAAC;IAC1D,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,0BAA0B,EAAE,CAAC;IAC7D,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,YAAY,EAAE,MAAM;QAClB;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,KAAK,CAAC,iBAAiB,CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAOH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,MAAM,EAAE,MAAM;QACZ;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,MAAM,CAAC;YACL;;eAEG;YACH,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,KAAK,CAAC,uBAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n MetaMaskOptionsStruct,\n} from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n\n // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n\n /**\n * Metamask internal options.\n */\n ...MetaMaskOptionsStruct.schema,\n }),\n});\nexport type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;\nexport type AccountCreatedEventPayload = AccountCreatedEvent['params'];\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\nexport type AccountUpdatedEvent = Infer<typeof AccountUpdatedEventStruct>;\nexport type AccountUpdatedEventPayload = AccountUpdatedEvent['params'];\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\nexport type AccountDeletedEvent = Infer<typeof AccountDeletedEventStruct>;\nexport type AccountDeletedEventPayload = AccountDeletedEvent['params'];\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\nexport type RequestApprovedEvent = Infer<typeof RequestApprovedEventStruct>;\nexport type RequestApprovedEventPayload = RequestApprovedEvent['params'];\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\nexport type RequestRejectedEvent = Infer<typeof RequestRejectedEventStruct>;\nexport type RequestRejectedEventPayload = RequestRejectedEvent['params'];\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n\n/**\n * Keyring events.\n */\n// For some reason, eslint sometimes infer one of those members as `any`...\ntype KeyringEvents =\n | AccountCreatedEvent\n | AccountUpdatedEvent\n | AccountDeletedEvent\n | AccountAssetListUpdatedEvent\n | AccountBalancesUpdatedEvent\n | AccountTransactionsUpdatedEvent\n | RequestApprovedEvent\n | RequestRejectedEvent;\n\n/**\n * Extract the payload for a given `KeyringEvent` event.\n */\nexport type KeyringEventPayload<Event extends KeyringEvent> = Extract<\n KeyringEvents,\n // We need to use a literal string here, since that is what `KeyringEvents`\n // is using (probably because of `superstruct`.\n { method: `${Event}` }\n>['params'];\n"]}
1
+ {"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gCAAgC;AAEtE,OAAO,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,aAAa,EACd,8BAA8B;AAC/B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,E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G;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,MAAM,EAAE,MAAM;QACZ;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,MAAM,CAAC;YACL;;eAEG;YACH,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,KAAK,CAAC,uBAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { UuidStruct, AccountIdStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n literal,\n record,\n string,\n object,\n exactOptional,\n} from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n MetaMaskOptionsStruct,\n} from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n\n // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n\n /**\n * Metamask internal options.\n */\n ...MetaMaskOptionsStruct.schema,\n }),\n});\nexport type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;\nexport type AccountCreatedEventPayload = AccountCreatedEvent['params'];\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\nexport type AccountUpdatedEvent = Infer<typeof AccountUpdatedEventStruct>;\nexport type AccountUpdatedEventPayload = AccountUpdatedEvent['params'];\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\nexport type AccountDeletedEvent = Infer<typeof AccountDeletedEventStruct>;\nexport type AccountDeletedEventPayload = AccountDeletedEvent['params'];\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\nexport type RequestApprovedEvent = Infer<typeof RequestApprovedEventStruct>;\nexport type RequestApprovedEventPayload = RequestApprovedEvent['params'];\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\nexport type RequestRejectedEvent = Infer<typeof RequestRejectedEventStruct>;\nexport type RequestRejectedEventPayload = RequestRejectedEvent['params'];\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n\n/**\n * Keyring events.\n */\n// For some reason, eslint sometimes infer one of those members as `any`...\ntype KeyringEvents =\n | AccountCreatedEvent\n | AccountUpdatedEvent\n | AccountDeletedEvent\n | AccountAssetListUpdatedEvent\n | AccountBalancesUpdatedEvent\n | AccountTransactionsUpdatedEvent\n | RequestApprovedEvent\n | RequestRejectedEvent;\n\n/**\n * Extract the payload for a given `KeyringEvent` event.\n */\nexport type KeyringEventPayload<Event extends KeyringEvent> = Extract<\n KeyringEvents,\n // We need to use a literal string here, since that is what `KeyringEvents`\n // is using (probably because of `superstruct`.\n { method: `${Event}` }\n>['params'];\n"]}
package/dist/rpc.cjs CHANGED
@@ -52,57 +52,57 @@ const CommonHeader = {
52
52
  };
53
53
  // ----------------------------------------------------------------------------
54
54
  // List accounts
55
- exports.ListAccountsRequestStruct = (0, keyring_utils_1.object)({
55
+ exports.ListAccountsRequestStruct = (0, superstruct_1.object)({
56
56
  ...CommonHeader,
57
57
  method: (0, superstruct_1.literal)('keyring_listAccounts'),
58
58
  });
59
59
  exports.ListAccountsResponseStruct = (0, superstruct_1.array)(api_1.KeyringAccountStruct);
60
60
  // ----------------------------------------------------------------------------
61
61
  // Get account
62
- exports.GetAccountRequestStruct = (0, keyring_utils_1.object)({
62
+ exports.GetAccountRequestStruct = (0, superstruct_1.object)({
63
63
  ...CommonHeader,
64
64
  method: (0, superstruct_1.literal)('keyring_getAccount'),
65
- params: (0, keyring_utils_1.object)({
65
+ params: (0, superstruct_1.object)({
66
66
  id: keyring_utils_1.UuidStruct,
67
67
  }),
68
68
  });
69
69
  exports.GetAccountResponseStruct = api_1.KeyringAccountStruct;
70
70
  // ----------------------------------------------------------------------------
71
71
  // Create account
72
- exports.CreateAccountRequestStruct = (0, keyring_utils_1.object)({
72
+ exports.CreateAccountRequestStruct = (0, superstruct_1.object)({
73
73
  ...CommonHeader,
74
74
  method: (0, superstruct_1.literal)('keyring_createAccount'),
75
- params: (0, keyring_utils_1.object)({
75
+ params: (0, superstruct_1.object)({
76
76
  options: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
77
77
  }),
78
78
  });
79
79
  exports.CreateAccountResponseStruct = api_1.KeyringAccountStruct;
80
80
  // ----------------------------------------------------------------------------
81
81
  // Create accounts
82
- exports.CreateAccountsRequestStruct = (0, keyring_utils_1.object)({
82
+ exports.CreateAccountsRequestStruct = (0, superstruct_1.object)({
83
83
  ...CommonHeader,
84
84
  method: (0, superstruct_1.literal)('keyring_createAccounts'),
85
- params: (0, keyring_utils_1.object)({
85
+ params: (0, superstruct_1.object)({
86
86
  options: create_account_1.CreateAccountOptionsStruct,
87
87
  }),
88
88
  });
89
89
  exports.CreateAccountsResponseStruct = (0, superstruct_1.array)(api_1.KeyringAccountStruct);
90
90
  // ----------------------------------------------------------------------------
91
91
  // Set selected accounts
92
- exports.SetSelectedAccountsRequestStruct = (0, keyring_utils_1.object)({
92
+ exports.SetSelectedAccountsRequestStruct = (0, superstruct_1.object)({
93
93
  ...CommonHeader,
94
94
  method: (0, superstruct_1.literal)('keyring_setSelectedAccounts'),
95
- params: (0, keyring_utils_1.object)({
95
+ params: (0, superstruct_1.object)({
96
96
  accounts: (0, superstruct_1.array)((0, superstruct_1.string)()),
97
97
  }),
98
98
  });
99
99
  exports.SetSelectedAccountsResponseStruct = (0, superstruct_1.literal)(null);
100
100
  // ----------------------------------------------------------------------------
101
101
  // Discover accounts
102
- exports.DiscoverAccountsRequestStruct = (0, keyring_utils_1.object)({
102
+ exports.DiscoverAccountsRequestStruct = (0, superstruct_1.object)({
103
103
  ...CommonHeader,
104
104
  method: (0, superstruct_1.literal)('keyring_discoverAccounts'),
105
- params: (0, keyring_utils_1.object)({
105
+ params: (0, superstruct_1.object)({
106
106
  scopes: (0, superstruct_1.array)(api_1.CaipChainIdStruct),
107
107
  entropySource: (0, superstruct_1.string)(),
108
108
  groupIndex: (0, superstruct_1.number)(),
@@ -111,10 +111,10 @@ exports.DiscoverAccountsRequestStruct = (0, keyring_utils_1.object)({
111
111
  exports.DiscoverAccountsResponseStruct = (0, superstruct_1.array)(api_1.DiscoveredAccountStruct);
112
112
  // ----------------------------------------------------------------------------
113
113
  // List account transactions
114
- exports.ListAccountTransactionsRequestStruct = (0, keyring_utils_1.object)({
114
+ exports.ListAccountTransactionsRequestStruct = (0, superstruct_1.object)({
115
115
  ...CommonHeader,
116
116
  method: (0, superstruct_1.literal)('keyring_listAccountTransactions'),
117
- params: (0, keyring_utils_1.object)({
117
+ params: (0, superstruct_1.object)({
118
118
  id: keyring_utils_1.UuidStruct,
119
119
  pagination: api_1.PaginationStruct,
120
120
  }),
@@ -122,20 +122,20 @@ exports.ListAccountTransactionsRequestStruct = (0, keyring_utils_1.object)({
122
122
  exports.ListAccountTransactionsResponseStruct = api_1.TransactionsPageStruct;
123
123
  // ----------------------------------------------------------------------------
124
124
  // List account assets
125
- exports.ListAccountAssetsRequestStruct = (0, keyring_utils_1.object)({
125
+ exports.ListAccountAssetsRequestStruct = (0, superstruct_1.object)({
126
126
  ...CommonHeader,
127
127
  method: (0, superstruct_1.literal)('keyring_listAccountAssets'),
128
- params: (0, keyring_utils_1.object)({
128
+ params: (0, superstruct_1.object)({
129
129
  id: keyring_utils_1.UuidStruct,
130
130
  }),
131
131
  });
132
132
  exports.ListAccountAssetsResponseStruct = (0, superstruct_1.array)(api_1.CaipAssetTypeOrIdStruct);
133
133
  // ----------------------------------------------------------------------------
134
134
  // Get account balances
135
- exports.GetAccountBalancesRequestStruct = (0, keyring_utils_1.object)({
135
+ exports.GetAccountBalancesRequestStruct = (0, superstruct_1.object)({
136
136
  ...CommonHeader,
137
137
  method: (0, superstruct_1.literal)(`${KeyringRpcMethod.GetAccountBalances}`),
138
- params: (0, keyring_utils_1.object)({
138
+ params: (0, superstruct_1.object)({
139
139
  id: keyring_utils_1.UuidStruct,
140
140
  assets: (0, superstruct_1.array)(api_1.CaipAssetTypeStruct),
141
141
  }),
@@ -143,23 +143,23 @@ exports.GetAccountBalancesRequestStruct = (0, keyring_utils_1.object)({
143
143
  exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(api_1.CaipAssetTypeStruct, api_1.BalanceStruct);
144
144
  // ----------------------------------------------------------------------------
145
145
  // Resolve account address
146
- exports.ResolveAccountAddressRequestStruct = (0, keyring_utils_1.object)({
146
+ exports.ResolveAccountAddressRequestStruct = (0, superstruct_1.object)({
147
147
  ...CommonHeader,
148
148
  method: (0, superstruct_1.literal)('keyring_resolveAccountAddress'),
149
- params: (0, keyring_utils_1.object)({
149
+ params: (0, superstruct_1.object)({
150
150
  scope: api_1.CaipChainIdStruct,
151
151
  request: keyring_utils_1.JsonRpcRequestStruct,
152
152
  }),
153
153
  });
154
- exports.ResolveAccountAddressResponseStruct = (0, superstruct_1.nullable)((0, keyring_utils_1.object)({
154
+ exports.ResolveAccountAddressResponseStruct = (0, superstruct_1.nullable)((0, superstruct_1.object)({
155
155
  address: api_1.CaipAccountIdStruct,
156
156
  }));
157
157
  // ----------------------------------------------------------------------------
158
158
  // Filter account chains
159
- exports.FilterAccountChainsStruct = (0, keyring_utils_1.object)({
159
+ exports.FilterAccountChainsStruct = (0, superstruct_1.object)({
160
160
  ...CommonHeader,
161
161
  method: (0, superstruct_1.literal)('keyring_filterAccountChains'),
162
- params: (0, keyring_utils_1.object)({
162
+ params: (0, superstruct_1.object)({
163
163
  id: keyring_utils_1.UuidStruct,
164
164
  chains: (0, superstruct_1.array)((0, superstruct_1.string)()),
165
165
  }),
@@ -167,54 +167,54 @@ exports.FilterAccountChainsStruct = (0, keyring_utils_1.object)({
167
167
  exports.FilterAccountChainsResponseStruct = (0, superstruct_1.array)((0, superstruct_1.string)());
168
168
  // ----------------------------------------------------------------------------
169
169
  // Update account
170
- exports.UpdateAccountRequestStruct = (0, keyring_utils_1.object)({
170
+ exports.UpdateAccountRequestStruct = (0, superstruct_1.object)({
171
171
  ...CommonHeader,
172
172
  method: (0, superstruct_1.literal)('keyring_updateAccount'),
173
- params: (0, keyring_utils_1.object)({
173
+ params: (0, superstruct_1.object)({
174
174
  account: api_1.KeyringAccountStruct,
175
175
  }),
176
176
  });
177
177
  exports.UpdateAccountResponseStruct = (0, superstruct_1.literal)(null);
178
178
  // ----------------------------------------------------------------------------
179
179
  // Delete account
180
- exports.DeleteAccountRequestStruct = (0, keyring_utils_1.object)({
180
+ exports.DeleteAccountRequestStruct = (0, superstruct_1.object)({
181
181
  ...CommonHeader,
182
182
  method: (0, superstruct_1.literal)('keyring_deleteAccount'),
183
- params: (0, keyring_utils_1.object)({
183
+ params: (0, superstruct_1.object)({
184
184
  id: keyring_utils_1.UuidStruct,
185
185
  }),
186
186
  });
187
187
  exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
188
188
  // ----------------------------------------------------------------------------
189
189
  // Export account
190
- exports.ExportAccountRequestStruct = (0, keyring_utils_1.object)({
190
+ exports.ExportAccountRequestStruct = (0, superstruct_1.object)({
191
191
  ...CommonHeader,
192
192
  method: (0, superstruct_1.literal)('keyring_exportAccount'),
193
- params: (0, keyring_utils_1.object)({
193
+ params: (0, superstruct_1.object)({
194
194
  id: keyring_utils_1.UuidStruct,
195
195
  }),
196
196
  });
197
197
  exports.ExportAccountResponseStruct = api_1.KeyringAccountDataStruct;
198
198
  // ----------------------------------------------------------------------------
199
199
  // List requests
200
- exports.ListRequestsRequestStruct = (0, keyring_utils_1.object)({
200
+ exports.ListRequestsRequestStruct = (0, superstruct_1.object)({
201
201
  ...CommonHeader,
202
202
  method: (0, superstruct_1.literal)('keyring_listRequests'),
203
203
  });
204
204
  exports.ListRequestsResponseStruct = (0, superstruct_1.array)(api_1.KeyringRequestStruct);
205
205
  // ----------------------------------------------------------------------------
206
206
  // Get request
207
- exports.GetRequestRequestStruct = (0, keyring_utils_1.object)({
207
+ exports.GetRequestRequestStruct = (0, superstruct_1.object)({
208
208
  ...CommonHeader,
209
209
  method: (0, superstruct_1.literal)('keyring_getRequest'),
210
- params: (0, keyring_utils_1.object)({
210
+ params: (0, superstruct_1.object)({
211
211
  id: keyring_utils_1.UuidStruct,
212
212
  }),
213
213
  });
214
214
  exports.GetRequestResponseStruct = api_1.KeyringRequestStruct;
215
215
  // ----------------------------------------------------------------------------
216
216
  // Submit request
217
- exports.SubmitRequestRequestStruct = (0, keyring_utils_1.object)({
217
+ exports.SubmitRequestRequestStruct = (0, superstruct_1.object)({
218
218
  ...CommonHeader,
219
219
  method: (0, superstruct_1.literal)('keyring_submitRequest'),
220
220
  params: api_1.KeyringRequestStruct,
@@ -222,10 +222,10 @@ exports.SubmitRequestRequestStruct = (0, keyring_utils_1.object)({
222
222
  exports.SubmitRequestResponseStruct = api_1.KeyringResponseStruct;
223
223
  // ----------------------------------------------------------------------------
224
224
  // Approve request
225
- exports.ApproveRequestRequestStruct = (0, keyring_utils_1.object)({
225
+ exports.ApproveRequestRequestStruct = (0, superstruct_1.object)({
226
226
  ...CommonHeader,
227
227
  method: (0, superstruct_1.literal)('keyring_approveRequest'),
228
- params: (0, keyring_utils_1.object)({
228
+ params: (0, superstruct_1.object)({
229
229
  id: keyring_utils_1.UuidStruct,
230
230
  data: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
231
231
  }),
@@ -233,10 +233,10 @@ exports.ApproveRequestRequestStruct = (0, keyring_utils_1.object)({
233
233
  exports.ApproveRequestResponseStruct = (0, superstruct_1.literal)(null);
234
234
  // ----------------------------------------------------------------------------
235
235
  // Reject request
236
- exports.RejectRequestRequestStruct = (0, keyring_utils_1.object)({
236
+ exports.RejectRequestRequestStruct = (0, superstruct_1.object)({
237
237
  ...CommonHeader,
238
238
  method: (0, superstruct_1.literal)('keyring_rejectRequest'),
239
- params: (0, keyring_utils_1.object)({
239
+ params: (0, superstruct_1.object)({
240
240
  id: keyring_utils_1.UuidStruct,
241
241
  }),
242
242
  });