@metamask/snaps-rpc-methods 11.1.1 → 11.3.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 (44) hide show
  1. package/CHANGELOG.md +95 -1
  2. package/dist/permitted/createInterface.d.cts +2 -0
  3. package/dist/permitted/createInterface.d.cts.map +1 -1
  4. package/dist/permitted/createInterface.d.mts +2 -0
  5. package/dist/permitted/createInterface.d.mts.map +1 -1
  6. package/dist/permitted/getCurrencyRate.cjs +63 -0
  7. package/dist/permitted/getCurrencyRate.cjs.map +1 -0
  8. package/dist/permitted/getCurrencyRate.d.cts +20 -0
  9. package/dist/permitted/getCurrencyRate.d.cts.map +1 -0
  10. package/dist/permitted/getCurrencyRate.d.mts +20 -0
  11. package/dist/permitted/getCurrencyRate.d.mts.map +1 -0
  12. package/dist/permitted/getCurrencyRate.mjs +60 -0
  13. package/dist/permitted/getCurrencyRate.mjs.map +1 -0
  14. package/dist/permitted/handlers.cjs +2 -0
  15. package/dist/permitted/handlers.cjs.map +1 -1
  16. package/dist/permitted/handlers.d.cts +2 -1
  17. package/dist/permitted/handlers.d.cts.map +1 -1
  18. package/dist/permitted/handlers.d.mts +2 -1
  19. package/dist/permitted/handlers.d.mts.map +1 -1
  20. package/dist/permitted/handlers.mjs +2 -0
  21. package/dist/permitted/handlers.mjs.map +1 -1
  22. package/dist/permitted/index.cjs.map +1 -1
  23. package/dist/permitted/index.d.cts +2 -1
  24. package/dist/permitted/index.d.cts.map +1 -1
  25. package/dist/permitted/index.d.mts +2 -1
  26. package/dist/permitted/index.d.mts.map +1 -1
  27. package/dist/permitted/index.mjs.map +1 -1
  28. package/dist/permitted/updateInterface.d.cts +2 -0
  29. package/dist/permitted/updateInterface.d.cts.map +1 -1
  30. package/dist/permitted/updateInterface.d.mts +2 -0
  31. package/dist/permitted/updateInterface.d.mts.map +1 -1
  32. package/dist/restricted/dialog.d.cts +4 -0
  33. package/dist/restricted/dialog.d.cts.map +1 -1
  34. package/dist/restricted/dialog.d.mts +4 -0
  35. package/dist/restricted/dialog.d.mts.map +1 -1
  36. package/dist/restricted/notify.cjs +61 -5
  37. package/dist/restricted/notify.cjs.map +1 -1
  38. package/dist/restricted/notify.d.cts +96 -15
  39. package/dist/restricted/notify.d.cts.map +1 -1
  40. package/dist/restricted/notify.d.mts +96 -15
  41. package/dist/restricted/notify.d.mts.map +1 -1
  42. package/dist/restricted/notify.mjs +64 -8
  43. package/dist/restricted/notify.mjs.map +1 -1
  44. package/package.json +30 -15
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.mjs","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,kBAAkB,EAAE,0BAAsB;AACnD,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,cAAc,EAAE,sBAAkB;AAC3C,OAAO,EAAE,wBAAwB,EAAE,gCAA4B;AAC/D,OAAO,EAAE,eAAe,EAAE,uBAAmB;AAC7C,OAAO,EAAE,oBAAoB,EAAE,4BAAwB;AACvD,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,mBAAmB,EAAE,2BAAuB;AACrD,OAAO,EAAE,uBAAuB,EAAE,+BAA2B;AAC7D,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAE3D,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,kBAAkB,EAAE,kBAAkB;IACtC,eAAe,EAAE,eAAe;IAChC,mBAAmB,EAAE,mBAAmB;IACxC,iBAAiB,EAAE,sBAAsB;IACzC,oBAAoB,EAAE,oBAAoB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,YAAY,EAAE,cAAc;IAC5B,oBAAoB,EAAE,sBAAsB;IAC5C,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,qBAAqB,EAAE,uBAAuB;CAC/C,CAAC;AACF,wDAAwD;AAExD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import { createInterfaceHandler } from './createInterface';\nimport { getAllSnapsHandler } from './getAllSnaps';\nimport { getClientStatusHandler } from './getClientStatus';\nimport { getFileHandler } from './getFile';\nimport { getInterfaceStateHandler } from './getInterfaceState';\nimport { getSnapsHandler } from './getSnaps';\nimport { invokeKeyringHandler } from './invokeKeyring';\nimport { invokeSnapSugarHandler } from './invokeSnapSugar';\nimport { requestSnapsHandler } from './requestSnaps';\nimport { resolveInterfaceHandler } from './resolveInterface';\nimport { updateInterfaceHandler } from './updateInterface';\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const methodHandlers = {\n wallet_getAllSnaps: getAllSnapsHandler,\n wallet_getSnaps: getSnapsHandler,\n wallet_requestSnaps: requestSnapsHandler,\n wallet_invokeSnap: invokeSnapSugarHandler,\n wallet_invokeKeyring: invokeKeyringHandler,\n snap_getClientStatus: getClientStatusHandler,\n snap_getFile: getFileHandler,\n snap_createInterface: createInterfaceHandler,\n snap_updateInterface: updateInterfaceHandler,\n snap_getInterfaceState: getInterfaceStateHandler,\n snap_resolveInterface: resolveInterfaceHandler,\n};\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const handlers = Object.values(methodHandlers);\n"]}
1
+ {"version":3,"file":"handlers.mjs","sourceRoot":"","sources":["../../src/permitted/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,kBAAkB,EAAE,0BAAsB;AACnD,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,cAAc,EAAE,sBAAkB;AAC3C,OAAO,EAAE,wBAAwB,EAAE,gCAA4B;AAC/D,OAAO,EAAE,eAAe,EAAE,uBAAmB;AAC7C,OAAO,EAAE,oBAAoB,EAAE,4BAAwB;AACvD,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAC3D,OAAO,EAAE,mBAAmB,EAAE,2BAAuB;AACrD,OAAO,EAAE,uBAAuB,EAAE,+BAA2B;AAC7D,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAE3D,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,kBAAkB,EAAE,kBAAkB;IACtC,eAAe,EAAE,eAAe;IAChC,mBAAmB,EAAE,mBAAmB;IACxC,iBAAiB,EAAE,sBAAsB;IACzC,oBAAoB,EAAE,oBAAoB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,YAAY,EAAE,cAAc;IAC5B,oBAAoB,EAAE,sBAAsB;IAC5C,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,qBAAqB,EAAE,uBAAuB;IAC9C,oBAAoB,EAAE,sBAAsB;CAC7C,CAAC;AACF,wDAAwD;AAExD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import { createInterfaceHandler } from './createInterface';\nimport { getAllSnapsHandler } from './getAllSnaps';\nimport { getClientStatusHandler } from './getClientStatus';\nimport { getCurrencyRateHandler } from './getCurrencyRate';\nimport { getFileHandler } from './getFile';\nimport { getInterfaceStateHandler } from './getInterfaceState';\nimport { getSnapsHandler } from './getSnaps';\nimport { invokeKeyringHandler } from './invokeKeyring';\nimport { invokeSnapSugarHandler } from './invokeSnapSugar';\nimport { requestSnapsHandler } from './requestSnaps';\nimport { resolveInterfaceHandler } from './resolveInterface';\nimport { updateInterfaceHandler } from './updateInterface';\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const methodHandlers = {\n wallet_getAllSnaps: getAllSnapsHandler,\n wallet_getSnaps: getSnapsHandler,\n wallet_requestSnaps: requestSnapsHandler,\n wallet_invokeSnap: invokeSnapSugarHandler,\n wallet_invokeKeyring: invokeKeyringHandler,\n snap_getClientStatus: getClientStatusHandler,\n snap_getFile: getFileHandler,\n snap_createInterface: createInterfaceHandler,\n snap_updateInterface: updateInterfaceHandler,\n snap_getInterfaceState: getInterfaceStateHandler,\n snap_resolveInterface: resolveInterfaceHandler,\n snap_getCurrencyRate: getCurrencyRateHandler,\n};\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport const handlers = Object.values(methodHandlers);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkBA,iDAA2B;AAC3B,mDAA6B","sourcesContent":["import type { CreateInterfaceMethodHooks } from './createInterface';\nimport type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetInterfaceStateMethodHooks } from './getInterfaceState';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { RequestSnapsHooks } from './requestSnaps';\nimport type { ResolveInterfaceMethodHooks } from './resolveInterface';\nimport type { UpdateInterfaceMethodHooks } from './updateInterface';\n\nexport type PermittedRpcMethodHooks = GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n RequestSnapsHooks &\n CreateInterfaceMethodHooks &\n UpdateInterfaceMethodHooks &\n GetInterfaceStateMethodHooks &\n ResolveInterfaceMethodHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,iDAA2B;AAC3B,mDAA6B","sourcesContent":["import type { CreateInterfaceMethodHooks } from './createInterface';\nimport type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetCurrencyRateMethodHooks } from './getCurrencyRate';\nimport type { GetInterfaceStateMethodHooks } from './getInterfaceState';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { RequestSnapsHooks } from './requestSnaps';\nimport type { ResolveInterfaceMethodHooks } from './resolveInterface';\nimport type { UpdateInterfaceMethodHooks } from './updateInterface';\n\nexport type PermittedRpcMethodHooks = GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n RequestSnapsHooks &\n CreateInterfaceMethodHooks &\n UpdateInterfaceMethodHooks &\n GetInterfaceStateMethodHooks &\n ResolveInterfaceMethodHooks &\n GetCurrencyRateMethodHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"]}
@@ -1,12 +1,13 @@
1
1
  import type { CreateInterfaceMethodHooks } from "./createInterface.cjs";
2
2
  import type { GetAllSnapsHooks } from "./getAllSnaps.cjs";
3
3
  import type { GetClientStatusHooks } from "./getClientStatus.cjs";
4
+ import type { GetCurrencyRateMethodHooks } from "./getCurrencyRate.cjs";
4
5
  import type { GetInterfaceStateMethodHooks } from "./getInterfaceState.cjs";
5
6
  import type { GetSnapsHooks } from "./getSnaps.cjs";
6
7
  import type { RequestSnapsHooks } from "./requestSnaps.cjs";
7
8
  import type { ResolveInterfaceMethodHooks } from "./resolveInterface.cjs";
8
9
  import type { UpdateInterfaceMethodHooks } from "./updateInterface.cjs";
9
- export type PermittedRpcMethodHooks = GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks;
10
+ export type PermittedRpcMethodHooks = GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks & GetCurrencyRateMethodHooks;
10
11
  export * from "./handlers.cjs";
11
12
  export * from "./middleware.cjs";
12
13
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAAA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iCAA6B"}
@@ -1,12 +1,13 @@
1
1
  import type { CreateInterfaceMethodHooks } from "./createInterface.mjs";
2
2
  import type { GetAllSnapsHooks } from "./getAllSnaps.mjs";
3
3
  import type { GetClientStatusHooks } from "./getClientStatus.mjs";
4
+ import type { GetCurrencyRateMethodHooks } from "./getCurrencyRate.mjs";
4
5
  import type { GetInterfaceStateMethodHooks } from "./getInterfaceState.mjs";
5
6
  import type { GetSnapsHooks } from "./getSnaps.mjs";
6
7
  import type { RequestSnapsHooks } from "./requestSnaps.mjs";
7
8
  import type { ResolveInterfaceMethodHooks } from "./resolveInterface.mjs";
8
9
  import type { UpdateInterfaceMethodHooks } from "./updateInterface.mjs";
9
- export type PermittedRpcMethodHooks = GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks;
10
+ export type PermittedRpcMethodHooks = GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks & GetCurrencyRateMethodHooks;
10
11
  export * from "./handlers.mjs";
11
12
  export * from "./middleware.mjs";
12
13
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAAsB;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,8BAA0B;AAC9D,OAAO,KAAK,EAAE,4BAA4B,EAAE,gCAA4B;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAmB;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,2BAAuB;AACxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,+BAA2B;AACtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AAEpE,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GACpD,oBAAoB,GACpB,aAAa,GACb,iBAAiB,GACjB,0BAA0B,GAC1B,0BAA0B,GAC1B,4BAA4B,GAC5B,2BAA2B,CAAC;AAE9B,+BAA2B;AAC3B,iCAA6B"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAAsB;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,8BAA0B;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AACpE,OAAO,KAAK,EAAE,4BAA4B,EAAE,gCAA4B;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAmB;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,2BAAuB;AACxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,+BAA2B;AACtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA0B;AAEpE,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GACpD,oBAAoB,GACpB,aAAa,GACb,iBAAiB,GACjB,0BAA0B,GAC1B,0BAA0B,GAC1B,4BAA4B,GAC5B,2BAA2B,GAC3B,0BAA0B,CAAC;AAE7B,+BAA2B;AAC3B,iCAA6B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAkBA,+BAA2B;AAC3B,iCAA6B","sourcesContent":["import type { CreateInterfaceMethodHooks } from './createInterface';\nimport type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetInterfaceStateMethodHooks } from './getInterfaceState';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { RequestSnapsHooks } from './requestSnaps';\nimport type { ResolveInterfaceMethodHooks } from './resolveInterface';\nimport type { UpdateInterfaceMethodHooks } from './updateInterface';\n\nexport type PermittedRpcMethodHooks = GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n RequestSnapsHooks &\n CreateInterfaceMethodHooks &\n UpdateInterfaceMethodHooks &\n GetInterfaceStateMethodHooks &\n ResolveInterfaceMethodHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/permitted/index.ts"],"names":[],"mappings":"AAoBA,+BAA2B;AAC3B,iCAA6B","sourcesContent":["import type { CreateInterfaceMethodHooks } from './createInterface';\nimport type { GetAllSnapsHooks } from './getAllSnaps';\nimport type { GetClientStatusHooks } from './getClientStatus';\nimport type { GetCurrencyRateMethodHooks } from './getCurrencyRate';\nimport type { GetInterfaceStateMethodHooks } from './getInterfaceState';\nimport type { GetSnapsHooks } from './getSnaps';\nimport type { RequestSnapsHooks } from './requestSnaps';\nimport type { ResolveInterfaceMethodHooks } from './resolveInterface';\nimport type { UpdateInterfaceMethodHooks } from './updateInterface';\n\nexport type PermittedRpcMethodHooks = GetAllSnapsHooks &\n GetClientStatusHooks &\n GetSnapsHooks &\n RequestSnapsHooks &\n CreateInterfaceMethodHooks &\n UpdateInterfaceMethodHooks &\n GetInterfaceStateMethodHooks &\n ResolveInterfaceMethodHooks &\n GetCurrencyRateMethodHooks;\n\nexport * from './handlers';\nexport * from './middleware';\n"]}
@@ -91,6 +91,7 @@ declare const UpdateInterfaceParametersStruct: import("@metamask/superstruct").S
91
91
  }, "Radio">>;
92
92
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
93
93
  children: import("@metamask/snaps-sdk/jsx").StringElement;
94
+ size?: "md" | "lg" | undefined;
94
95
  }, "Heading">;
95
96
  }, {
96
97
  id: import("@metamask/superstruct").Struct<string, null>;
@@ -174,6 +175,7 @@ declare const UpdateInterfaceParametersStruct: import("@metamask/superstruct").S
174
175
  }, "Radio">>;
175
176
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
176
177
  children: import("@metamask/snaps-sdk/jsx").StringElement;
178
+ size?: "md" | "lg" | undefined;
177
179
  }, "Heading">, null>;
178
180
  }>;
179
181
  export type UpdateInterfaceParameters = InferMatching<typeof UpdateInterfaceParametersStruct, UpdateInterfaceParams>;
@@ -1 +1 @@
1
- {"version":3,"file":"updateInterface.d.cts","sourceRoot":"","sources":["../../src/permitted/updateInterface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAE9E,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAErB,kBAAkB,EACnB,4BAA4B;AAE7B,OAAO,EAAE,KAAK,aAAa,EAAE,8BAA8B;AAU3D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CACzD,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,CAKtB,CAAC;AAEF,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGnC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,aAAa,CACnD,OAAO,+BAA+B,EACtC,qBAAqB,CACtB,CAAC"}
1
+ {"version":3,"file":"updateInterface.d.cts","sourceRoot":"","sources":["../../src/permitted/updateInterface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAE9E,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAErB,kBAAkB,EACnB,4BAA4B;AAE7B,OAAO,EAAE,KAAK,aAAa,EAAE,8BAA8B;AAU3D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CACzD,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,CAKtB,CAAC;AAEF,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGnC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,aAAa,CACnD,OAAO,+BAA+B,EACtC,qBAAqB,CACtB,CAAC"}
@@ -91,6 +91,7 @@ declare const UpdateInterfaceParametersStruct: import("@metamask/superstruct").S
91
91
  }, "Radio">>;
92
92
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
93
93
  children: import("@metamask/snaps-sdk/jsx").StringElement;
94
+ size?: "md" | "lg" | undefined;
94
95
  }, "Heading">;
95
96
  }, {
96
97
  id: import("@metamask/superstruct").Struct<string, null>;
@@ -174,6 +175,7 @@ declare const UpdateInterfaceParametersStruct: import("@metamask/superstruct").S
174
175
  }, "Radio">>;
175
176
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
176
177
  children: import("@metamask/snaps-sdk/jsx").StringElement;
178
+ size?: "md" | "lg" | undefined;
177
179
  }, "Heading">, null>;
178
180
  }>;
179
181
  export type UpdateInterfaceParameters = InferMatching<typeof UpdateInterfaceParametersStruct, UpdateInterfaceParams>;
@@ -1 +1 @@
1
- {"version":3,"file":"updateInterface.d.mts","sourceRoot":"","sources":["../../src/permitted/updateInterface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAE9E,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAErB,kBAAkB,EACnB,4BAA4B;AAE7B,OAAO,EAAE,KAAK,aAAa,EAAE,8BAA8B;AAU3D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CACzD,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,CAKtB,CAAC;AAEF,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGnC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,aAAa,CACnD,OAAO,+BAA+B,EACtC,qBAAqB,CACtB,CAAC"}
1
+ {"version":3,"file":"updateInterface.d.mts","sourceRoot":"","sources":["../../src/permitted/updateInterface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAwC;AAE9E,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAErB,kBAAkB,EACnB,4BAA4B;AAE7B,OAAO,EAAE,KAAK,aAAa,EAAE,8BAA8B;AAU3D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CACzD,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,CAKtB,CAAC;AAEF,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGnC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,aAAa,CACnD,OAAO,+BAA+B,EACtC,qBAAqB,CACtB,CAAC"}
@@ -169,6 +169,7 @@ declare const DialogParametersStruct: import("@metamask/superstruct").Struct<{
169
169
  }, "Radio">>;
170
170
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
171
171
  children: import("@metamask/snaps-sdk/jsx").StringElement;
172
+ size?: "md" | "lg" | undefined;
172
173
  }, "Heading">;
173
174
  } | {
174
175
  type: "confirmation";
@@ -269,6 +270,7 @@ declare const DialogParametersStruct: import("@metamask/superstruct").Struct<{
269
270
  }, "Radio">>;
270
271
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
271
272
  children: import("@metamask/snaps-sdk/jsx").StringElement;
273
+ size?: "md" | "lg" | undefined;
272
274
  }, "Heading">;
273
275
  } | {
274
276
  type: "prompt";
@@ -370,6 +372,7 @@ declare const DialogParametersStruct: import("@metamask/superstruct").Struct<{
370
372
  }, "Radio">>;
371
373
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
372
374
  children: import("@metamask/snaps-sdk/jsx").StringElement;
375
+ size?: "md" | "lg" | undefined;
373
376
  }, "Heading">;
374
377
  placeholder?: string | undefined;
375
378
  } | {
@@ -469,6 +472,7 @@ declare const DialogParametersStruct: import("@metamask/superstruct").Struct<{
469
472
  }, "Radio">>;
470
473
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
471
474
  children: import("@metamask/snaps-sdk/jsx").StringElement;
475
+ size?: "md" | "lg" | undefined;
472
476
  }, "Heading">;
473
477
  }, null>;
474
478
  export type DialogParameters = InferMatching<typeof DialogParametersStruct, DialogParams>;
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.cts","sourceRoot":"","sources":["../../src/restricted/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EAExB,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAe,wCAAwC;AAE9E,OAAO,EACL,UAAU,EAIX,4BAA4B;AAC7B,OAAO,KAAK,EACV,YAAY,EAEZ,cAAc,EACd,MAAM,EAEN,kBAAkB,EACnB,4BAA4B;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,8BAA8B;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAEnD,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,wBAAwB;AAG3D,OAAO,EAAE,KAAK,iBAAiB,EAAE,qBAAiB;AAElD,QAAA,MAAM,UAAU,gBAAgB,CAAC;AAEjC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;CAKjC,CAAC;AAEF,QAAA,MAAM,iBAAiB,kEAAkC,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE1D,KAAK,0BAA0B,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QACX,EAAE,EAAE,MAAM,CAAC;Q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iB;8BACP,WAAW,8BAA8B,CAAC;wBAChD,SAAS,cAAc,MAAM,CAAC,CAAC,GAAG,IAAI;;;EA4C7C,CAAC;AAsEZ,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA/G5B;;;;;;;;;;;;;WAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAbH;;;;;;;;;;;;;WAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAbH;;;;;;;;;;;;;WAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAbH;;;;;;;;;;;;;WAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqHD,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAC1C,OAAO,sBAAsB,EAC7B,YAAY,CACb,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,mBAAmB,EACnB,eAAe,EACf,YAAY,GACb,EAAE,iBAAiB,UAEV,wBAAwB,gBAAgB,CAAC,KAC9C,QAAQ,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,CAoD3C"}
@@ -169,6 +169,7 @@ declare const DialogParametersStruct: import("@metamask/superstruct").Struct<{
169
169
  }, "Radio">>;
170
170
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
171
171
  children: import("@metamask/snaps-sdk/jsx").StringElement;
172
+ size?: "md" | "lg" | undefined;
172
173
  }, "Heading">;
173
174
  } | {
174
175
  type: "confirmation";
@@ -269,6 +270,7 @@ declare const DialogParametersStruct: import("@metamask/superstruct").Struct<{
269
270
  }, "Radio">>;
270
271
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
271
272
  children: import("@metamask/snaps-sdk/jsx").StringElement;
273
+ size?: "md" | "lg" | undefined;
272
274
  }, "Heading">;
273
275
  } | {
274
276
  type: "prompt";
@@ -370,6 +372,7 @@ declare const DialogParametersStruct: import("@metamask/superstruct").Struct<{
370
372
  }, "Radio">>;
371
373
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
372
374
  children: import("@metamask/snaps-sdk/jsx").StringElement;
375
+ size?: "md" | "lg" | undefined;
373
376
  }, "Heading">;
374
377
  placeholder?: string | undefined;
375
378
  } | {
@@ -469,6 +472,7 @@ declare const DialogParametersStruct: import("@metamask/superstruct").Struct<{
469
472
  }, "Radio">>;
470
473
  }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
471
474
  children: import("@metamask/snaps-sdk/jsx").StringElement;
475
+ size?: "md" | "lg" | undefined;
472
476
  }, "Heading">;
473
477
  }, null>;
474
478
  export type DialogParameters = InferMatching<typeof DialogParametersStruct, DialogParams>;
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.mts","sourceRoot":"","sources":["../../src/restricted/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EAExB,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAe,wCAAwC;AAE9E,OAAO,EACL,UAAU,EAIX,4BAA4B;AAC7B,OAAO,KAAK,EACV,YAAY,EAEZ,cAAc,EACd,MAAM,EAEN,kBAAkB,EACnB,4BAA4B;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,8BAA8B;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAEnD,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,wBAAwB;AAG3D,OAAO,EAAE,KAAK,iBAAiB,EAAE,qBAAiB;AAElD,QAAA,MAAM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AUG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,mBAAmB,EACnB,eAAe,EACf,YAAY,GACb,EAAE,iBAAiB,UAEV,wBAAwB,gBAAgB,CAAC,KAC9C,QAAQ,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,CAoD3C"}
@@ -4,9 +4,41 @@ exports.getValidatedParams = exports.getImplementation = exports.notifyBuilder =
4
4
  const permission_controller_1 = require("@metamask/permission-controller");
5
5
  const rpc_errors_1 = require("@metamask/rpc-errors");
6
6
  const snaps_sdk_1 = require("@metamask/snaps-sdk");
7
+ const jsx_1 = require("@metamask/snaps-sdk/jsx");
7
8
  const snaps_utils_1 = require("@metamask/snaps-utils");
9
+ const superstruct_1 = require("@metamask/superstruct");
8
10
  const utils_1 = require("@metamask/utils");
9
11
  const methodName = 'snap_notify';
12
+ const NativeNotificationStruct = (0, superstruct_1.object)({
13
+ type: (0, snaps_sdk_1.enumValue)(snaps_sdk_1.NotificationType.Native),
14
+ message: (0, superstruct_1.string)(),
15
+ });
16
+ const InAppNotificationStruct = (0, superstruct_1.object)({
17
+ type: (0, snaps_sdk_1.enumValue)(snaps_sdk_1.NotificationType.InApp),
18
+ message: (0, superstruct_1.string)(),
19
+ });
20
+ const InAppNotificationWithDetailsStruct = (0, superstruct_1.object)({
21
+ type: (0, snaps_sdk_1.enumValue)(snaps_sdk_1.NotificationType.InApp),
22
+ message: (0, superstruct_1.string)(),
23
+ content: jsx_1.NotificationComponentsStruct,
24
+ title: (0, superstruct_1.string)(),
25
+ });
26
+ const InAppNotificationWithDetailsAndFooterStruct = (0, superstruct_1.object)({
27
+ type: (0, snaps_sdk_1.enumValue)(snaps_sdk_1.NotificationType.InApp),
28
+ message: (0, superstruct_1.string)(),
29
+ content: jsx_1.NotificationComponentsStruct,
30
+ title: (0, superstruct_1.string)(),
31
+ footerLink: (0, superstruct_1.object)({
32
+ href: (0, superstruct_1.string)(),
33
+ text: (0, superstruct_1.string)(),
34
+ }),
35
+ });
36
+ const NotificationParametersStruct = (0, snaps_sdk_1.union)([
37
+ InAppNotificationStruct,
38
+ InAppNotificationWithDetailsStruct,
39
+ InAppNotificationWithDetailsAndFooterStruct,
40
+ NativeNotificationStruct,
41
+ ]);
10
42
  /**
11
43
  * The specification builder for the `snap_notify` permission.
12
44
  * `snap_notify` allows snaps to send multiple types of notifications to its users.
@@ -31,6 +63,8 @@ const methodHooks = {
31
63
  showInAppNotification: true,
32
64
  isOnPhishingList: true,
33
65
  maybeUpdatePhishingList: true,
66
+ createInterface: true,
67
+ getSnap: true,
34
68
  };
35
69
  exports.notifyBuilder = Object.freeze({
36
70
  targetName: methodName,
@@ -45,15 +79,21 @@ exports.notifyBuilder = Object.freeze({
45
79
  * @param hooks.showInAppNotification - A function that shows a notification in the MetaMask UI.
46
80
  * @param hooks.isOnPhishingList - A function that checks for links against the phishing list.
47
81
  * @param hooks.maybeUpdatePhishingList - A function that updates the phishing list if needed.
82
+ * @param hooks.createInterface - A function that creates the interface in SnapInterfaceController.
83
+ * @param hooks.getSnap - A function that checks if a snap is installed.
48
84
  * @returns The method implementation which returns `null` on success.
49
85
  * @throws If the params are invalid.
50
86
  */
51
- function getImplementation({ showNativeNotification, showInAppNotification, isOnPhishingList, maybeUpdatePhishingList, }) {
87
+ function getImplementation({ showNativeNotification, showInAppNotification, isOnPhishingList, maybeUpdatePhishingList, createInterface, getSnap, }) {
52
88
  return async function implementation(args) {
53
89
  const { params, context: { origin }, } = args;
54
- const validatedParams = getValidatedParams(params);
55
90
  await maybeUpdatePhishingList();
56
- (0, snaps_utils_1.validateTextLinks)(validatedParams.message, isOnPhishingList);
91
+ const validatedParams = getValidatedParams(params, isOnPhishingList, getSnap);
92
+ let id;
93
+ if ((0, utils_1.hasProperty)(validatedParams, 'content')) {
94
+ id = await createInterface(origin, validatedParams.content);
95
+ validatedParams.content = id;
96
+ }
57
97
  switch (validatedParams.type) {
58
98
  case snaps_sdk_1.NotificationType.Native:
59
99
  return await showNativeNotification(origin, validatedParams);
@@ -72,9 +112,12 @@ exports.getImplementation = getImplementation;
72
112
  * type. Throws if validation fails.
73
113
  *
74
114
  * @param params - The unvalidated params object from the method request.
115
+ * @param isOnPhishingList - The function that checks for links against the phishing list.
116
+ * @param getSnap - A function that checks if a snap is installed.
75
117
  * @returns The validated method parameter object.
118
+ * @throws If the params are invalid.
76
119
  */
77
- function getValidatedParams(params) {
120
+ function getValidatedParams(params, isOnPhishingList, getSnap) {
78
121
  if (!(0, utils_1.isObject)(params)) {
79
122
  throw rpc_errors_1.rpcErrors.invalidParams({
80
123
  message: 'Expected params to be a single object.',
@@ -102,7 +145,20 @@ function getValidatedParams(params) {
102
145
  message: 'Must specify a non-empty string "message" less than 500 characters long.',
103
146
  });
104
147
  }
105
- return params;
148
+ try {
149
+ const validatedParams = (0, snaps_utils_1.createUnion)(params, NotificationParametersStruct, 'type');
150
+ (0, snaps_utils_1.validateTextLinks)(validatedParams.message, isOnPhishingList, getSnap);
151
+ if ((0, utils_1.hasProperty)(validatedParams, 'footerLink')) {
152
+ (0, snaps_utils_1.validateTextLinks)(validatedParams.footerLink.text, isOnPhishingList, getSnap);
153
+ (0, snaps_utils_1.validateLink)(validatedParams.footerLink.href, isOnPhishingList, getSnap);
154
+ }
155
+ return validatedParams;
156
+ }
157
+ catch (error) {
158
+ throw rpc_errors_1.rpcErrors.invalidParams({
159
+ message: `Invalid params: ${error.message}`,
160
+ });
161
+ }
106
162
  }
107
163
  exports.getValidatedParams = getValidatedParams;
108
164
  //# sourceMappingURL=notify.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notify.cjs","sourceRoot":"","sources":["../../src/restricted/notify.ts"],"names":[],"mappings":";;;AAKA,2EAA8E;AAC9E,qDAAiD;AACjD,mDAAuD;AAMvD,uDAA0D;AAE1D,2CAA2C;AAI3C,MAAM,UAAU,GAAG,aAAa,CAAC;AAkDjC;;;;;;;;GAQG;AACI,MAAM,oBAAoB,GAI7B,CAAC,EAAE,cAAc,GAAG,IAAI,EA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pecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { NotificationType } from '@metamask/snaps-sdk';\nimport type {\n NotifyParams,\n NotifyResult,\n EnumToUnion,\n} from '@metamask/snaps-sdk';\nimport { validateTextLinks } from '@metamask/snaps-utils';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { isObject } from '@metamask/utils';\n\nimport { type MethodHooksObject } from '../utils';\n\nconst methodName = 'snap_notify';\n\nexport type NotificationArgs = {\n /**\n * Enum type to determine notification type.\n */\n type: EnumToUnion<NotificationType>;\n\n /**\n * A message to show on the notification.\n */\n message: string;\n};\n\nexport type NotifyMethodHooks = {\n /**\n * @param snapId - The ID of the Snap that created the notification.\n * @param args - The notification arguments.\n */\n showNativeNotification: (\n snapId: string,\n args: NotificationArgs,\n ) => Promise<null>;\n\n /**\n * @param snapId - The ID of the Snap that created the notification.\n * @param args - The notification arguments.\n */\n showInAppNotification: (\n snapId: string,\n args: NotificationArgs,\n ) => Promise<null>;\n\n isOnPhishingList: (url: string) => boolean;\n\n maybeUpdatePhishingList: () => Promise<void>;\n};\n\ntype SpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: NotifyMethodHooks;\n};\n\ntype Specification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof methodName;\n methodImplementation: ReturnType<typeof getImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\n/**\n * The specification builder for the `snap_notify` permission.\n * `snap_notify` allows snaps to send multiple types of notifications to its users.\n *\n * @param options - The specification builder options.\n * @param options.allowedCaveats - The optional allowed caveats for the permission.\n * @param options.methodHooks - The RPC method hooks needed by the method implementation.\n * @returns The specification for the `snap_notify` permission.\n */\nexport const specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n SpecificationBuilderOptions,\n Specification\n> = ({ allowedCaveats = null, methodHooks }: SpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName: methodName,\n allowedCaveats,\n methodImplementation: getImplementation(methodHooks),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<NotifyMethodHooks> = {\n showNativeNotification: true,\n showInAppNotification: true,\n isOnPhishingList: true,\n maybeUpdatePhishingList: true,\n};\n\nexport const notifyBuilder = Object.freeze({\n targetName: methodName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_notify`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.showNativeNotification - A function that shows a native browser notification.\n * @param hooks.showInAppNotification - A function that shows a notification in the MetaMask UI.\n * @param hooks.isOnPhishingList - A function that checks for links against the phishing list.\n * @param hooks.maybeUpdatePhishingList - A function that updates the phishing list if needed.\n * @returns The method implementation which returns `null` on success.\n * @throws If the params are invalid.\n */\nexport function getImplementation({\n showNativeNotification,\n showInAppNotification,\n isOnPhishingList,\n maybeUpdatePhishingList,\n}: NotifyMethodHooks) {\n return async function implementation(\n args: RestrictedMethodOptions<NotifyParams>,\n ): Promise<NotifyResult> {\n const {\n params,\n context: { origin },\n } = args;\n\n const validatedParams = getValidatedParams(params);\n\n await maybeUpdatePhishingList();\n\n validateTextLinks(validatedParams.message, isOnPhishingList);\n\n switch (validatedParams.type) {\n case NotificationType.Native:\n return await showNativeNotification(origin, validatedParams);\n case NotificationType.InApp:\n return await showInAppNotification(origin, validatedParams);\n default:\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid notification \"type\".',\n });\n }\n };\n}\n\n/**\n * Validates the notify method `params` and returns them cast to the correct\n * type. Throws if validation fails.\n *\n * @param params - The unvalidated params object from the method request.\n * @returns The validated method parameter object.\n */\nexport function getValidatedParams(params: unknown): NotifyParams {\n if (!isObject(params)) {\n throw rpcErrors.invalidParams({\n message: 'Expected params to be a single object.',\n });\n }\n\n const { type, message } = params;\n\n if (\n !type ||\n typeof type !== 'string' ||\n !Object.values(NotificationType).includes(type as NotificationType)\n ) {\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid notification \"type\".',\n });\n }\n\n const isNotString = !message || typeof message !== 'string';\n // Set to the max message length on a Mac notification for now.\n if (\n type === NotificationType.Native &&\n (isNotString || message.length >= 50)\n ) {\n throw rpcErrors.invalidParams({\n message:\n 'Must specify a non-empty string \"message\" less than 50 characters long.',\n });\n }\n\n if (\n type === NotificationType.InApp &&\n (isNotString || message.length >= 500)\n ) {\n throw rpcErrors.invalidParams({\n message:\n 'Must specify a non-empty string \"message\" less than 500 characters long.',\n });\n }\n\n return params as NotificationArgs;\n}\n"]}
1
+ {"version":3,"file":"notify.cjs","sourceRoot":"","sources":["../../src/restricted/notify.ts"],"names":[],"mappings":";;;AAKA,2EAA8E;AAC9E,qDAAiD;AACjD,mDAAyE;AAMzE,iDAAuE;AACvE,uDAK+B;AAE/B,uDAAuD;AAEvD,2CAAwD;AAIxD,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC,MAAM,wBAAwB,GAAG,IAAA,oBAAM,EAAC;IACtC,IAAI,EAAE,IAAA,qBAAS,EAAC,4BAAgB,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,IAAA,oBAAM,GAAE;CAClB,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IACrC,IAAI,EAAE,IAAA,qBAAS,EAAC,4BAAgB,CAAC,KAAK,CAAC;IACvC,OAAO,EAAE,IAAA,oBAAM,GAAE;CAClB,CAAC,CAAC;AAEH,MAAM,kCAAkC,GAAG,IAAA,oBAAM,EAAC;IAChD,IAAI,EAAE,IAAA,qBAAS,EAAC,4BAAgB,CAAC,KAAK,CAAC;IACvC,OAAO,EAAE,IAAA,oBAAM,GAAE;IACjB,OAAO,EAAE,kCAA4B;IACrC,KAAK,EAAE,IAAA,oBAAM,GAAE;CAChB,CAAC,CAAC;AAEH,MAAM,2CAA2C,GAAG,IAAA,oBAAM,EAAC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AAO,EAAE,mBAAmB,KAAK,CAAC,OAAO,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AArED,gDAqEC","sourcesContent":["import type {\n PermissionSpecificationBuilder,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { enumValue, NotificationType, union } from '@metamask/snaps-sdk';\nimport type {\n NotifyParams,\n NotifyResult,\n NotificationComponent,\n} from '@metamask/snaps-sdk';\nimport { NotificationComponentsStruct } from '@metamask/snaps-sdk/jsx';\nimport {\n createUnion,\n validateLink,\n validateTextLinks,\n type Snap,\n} from '@metamask/snaps-utils';\nimport type { InferMatching } from '@metamask/snaps-utils';\nimport { object, string } from '@metamask/superstruct';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { hasProperty, isObject } from '@metamask/utils';\n\nimport { type MethodHooksObject } from '../utils';\n\nconst methodName = 'snap_notify';\n\nconst NativeNotificationStruct = object({\n type: enumValue(NotificationType.Native),\n message: string(),\n});\n\nconst InAppNotificationStruct = object({\n type: enumValue(NotificationType.InApp),\n message: string(),\n});\n\nconst InAppNotificationWithDetailsStruct = object({\n type: enumValue(NotificationType.InApp),\n message: string(),\n content: NotificationComponentsStruct,\n title: string(),\n});\n\nconst InAppNotificationWithDetailsAndFooterStruct = object({\n type: enumValue(NotificationType.InApp),\n message: string(),\n content: NotificationComponentsStruct,\n title: string(),\n footerLink: object({\n href: string(),\n text: string(),\n }),\n});\n\nconst NotificationParametersStruct = union([\n InAppNotificationStruct,\n InAppNotificationWithDetailsStruct,\n InAppNotificationWithDetailsAndFooterStruct,\n NativeNotificationStruct,\n]);\n\nexport type NotificationParameters = InferMatching<\n typeof NotificationParametersStruct,\n NotifyParams\n>;\n\nexport type NotifyMethodHooks = {\n /**\n * @param snapId - The ID of the Snap that created the notification.\n * @param args - The notification arguments.\n */\n showNativeNotification: (\n snapId: string,\n args: NotificationParameters,\n ) => Promise<null>;\n\n /**\n * @param snapId - The ID of the Snap that created the notification.\n * @param args - The notification arguments.\n */\n showInAppNotification: (\n snapId: string,\n args: NotificationParameters,\n ) => Promise<null>;\n\n isOnPhishingList: (url: string) => boolean;\n\n maybeUpdatePhishingList: () => Promise<void>;\n\n createInterface: (\n origin: string,\n content: NotificationComponent,\n ) => Promise<string>;\n getSnap: (snapId: string) => Snap | undefined;\n};\n\ntype SpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: NotifyMethodHooks;\n};\n\ntype Specification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof methodName;\n methodImplementation: ReturnType<typeof getImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\n/**\n * The specification builder for the `snap_notify` permission.\n * `snap_notify` allows snaps to send multiple types of notifications to its users.\n *\n * @param options - The specification builder options.\n * @param options.allowedCaveats - The optional allowed caveats for the permission.\n * @param options.methodHooks - The RPC method hooks needed by the method implementation.\n * @returns The specification for the `snap_notify` permission.\n */\nexport const specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n SpecificationBuilderOptions,\n Specification\n> = ({ allowedCaveats = null, methodHooks }: SpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName: methodName,\n allowedCaveats,\n methodImplementation: getImplementation(methodHooks),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<NotifyMethodHooks> = {\n showNativeNotification: true,\n showInAppNotification: true,\n isOnPhishingList: true,\n maybeUpdatePhishingList: true,\n createInterface: true,\n getSnap: true,\n};\n\nexport const notifyBuilder = Object.freeze({\n targetName: methodName,\n specificationBuilder,\n methodHooks,\n} as const);\n\n/**\n * Builds the method implementation for `snap_notify`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.showNativeNotification - A function that shows a native browser notification.\n * @param hooks.showInAppNotification - A function that shows a notification in the MetaMask UI.\n * @param hooks.isOnPhishingList - A function that checks for links against the phishing list.\n * @param hooks.maybeUpdatePhishingList - A function that updates the phishing list if needed.\n * @param hooks.createInterface - A function that creates the interface in SnapInterfaceController.\n * @param hooks.getSnap - A function that checks if a snap is installed.\n * @returns The method implementation which returns `null` on success.\n * @throws If the params are invalid.\n */\nexport function getImplementation({\n showNativeNotification,\n showInAppNotification,\n isOnPhishingList,\n maybeUpdatePhishingList,\n createInterface,\n getSnap,\n}: NotifyMethodHooks) {\n return async function implementation(\n args: RestrictedMethodOptions<NotifyParams>,\n ): Promise<NotifyResult> {\n const {\n params,\n context: { origin },\n } = args;\n\n await maybeUpdatePhishingList();\n\n const validatedParams = getValidatedParams(\n params,\n isOnPhishingList,\n getSnap,\n );\n\n let id;\n if (hasProperty(validatedParams, 'content')) {\n id = await createInterface(\n origin,\n validatedParams.content as NotificationComponent,\n );\n validatedParams.content = id;\n }\n\n switch (validatedParams.type) {\n case NotificationType.Native:\n return await showNativeNotification(origin, validatedParams);\n case NotificationType.InApp:\n return await showInAppNotification(origin, validatedParams);\n default:\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid notification \"type\".',\n });\n }\n };\n}\n\n/**\n * Validates the notify method `params` and returns them cast to the correct\n * type. Throws if validation fails.\n *\n * @param params - The unvalidated params object from the method request.\n * @param isOnPhishingList - The function that checks for links against the phishing list.\n * @param getSnap - A function that checks if a snap is installed.\n * @returns The validated method parameter object.\n * @throws If the params are invalid.\n */\nexport function getValidatedParams(\n params: unknown,\n isOnPhishingList: NotifyMethodHooks['isOnPhishingList'],\n getSnap: NotifyMethodHooks['getSnap'],\n): NotifyParams {\n if (!isObject(params)) {\n throw rpcErrors.invalidParams({\n message: 'Expected params to be a single object.',\n });\n }\n\n const { type, message } = params;\n\n if (\n !type ||\n typeof type !== 'string' ||\n !Object.values(NotificationType).includes(type as NotificationType)\n ) {\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid notification \"type\".',\n });\n }\n\n const isNotString = !message || typeof message !== 'string';\n // Set to the max message length on a Mac notification for now.\n if (\n type === NotificationType.Native &&\n (isNotString || message.length >= 50)\n ) {\n throw rpcErrors.invalidParams({\n message:\n 'Must specify a non-empty string \"message\" less than 50 characters long.',\n });\n }\n\n if (\n type === NotificationType.InApp &&\n (isNotString || message.length >= 500)\n ) {\n throw rpcErrors.invalidParams({\n message:\n 'Must specify a non-empty string \"message\" less than 500 characters long.',\n });\n }\n\n try {\n const validatedParams = createUnion(\n params,\n NotificationParametersStruct,\n 'type',\n );\n\n validateTextLinks(validatedParams.message, isOnPhishingList, getSnap);\n\n if (hasProperty(validatedParams, 'footerLink')) {\n validateTextLinks(\n validatedParams.footerLink.text,\n isOnPhishingList,\n getSnap,\n );\n validateLink(validatedParams.footerLink.href, isOnPhishingList, getSnap);\n }\n\n return validatedParams;\n } catch (error) {\n throw rpcErrors.invalidParams({\n message: `Invalid params: ${error.message}`,\n });\n }\n}\n"]}
@@ -1,33 +1,109 @@
1
1
  import type { PermissionSpecificationBuilder, RestrictedMethodOptions, ValidPermissionSpecification } from "@metamask/permission-controller";
2
2
  import { PermissionType } from "@metamask/permission-controller";
3
- import { NotificationType } from "@metamask/snaps-sdk";
4
- import type { NotifyParams, NotifyResult, EnumToUnion } from "@metamask/snaps-sdk";
3
+ import type { NotifyParams, NotifyResult, NotificationComponent } from "@metamask/snaps-sdk";
4
+ import { type Snap } from "@metamask/snaps-utils";
5
+ import type { InferMatching } from "@metamask/snaps-utils";
5
6
  import type { NonEmptyArray } from "@metamask/utils";
6
7
  import { type MethodHooksObject } from "../utils.cjs";
7
8
  declare const methodName = "snap_notify";
8
- export type NotificationArgs = {
9
- /**
10
- * Enum type to determine notification type.
11
- */
12
- type: EnumToUnion<NotificationType>;
13
- /**
14
- * A message to show on the notification.
15
- */
9
+ declare const NotificationParametersStruct: import("@metamask/superstruct").Struct<{
10
+ type: "native";
16
11
  message: string;
17
- };
12
+ } | {
13
+ type: "inApp";
14
+ message: string;
15
+ } | {
16
+ type: "inApp";
17
+ message: string;
18
+ content: import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
19
+ src: string;
20
+ alt?: string | undefined;
21
+ }, "Image">;
22
+ title: string;
23
+ } | {
24
+ type: "inApp";
25
+ message: string;
26
+ content: import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
27
+ src: string;
28
+ alt?: string | undefined;
29
+ }, "Image">;
30
+ title: string;
31
+ footerLink: {
32
+ text: string;
33
+ href: string;
34
+ };
35
+ }, [head: import("@metamask/superstruct").Struct<{
36
+ type: "inApp";
37
+ message: string;
38
+ }, {
39
+ type: import("@metamask/superstruct").Struct<"inApp", null>;
40
+ message: import("@metamask/superstruct").Struct<string, null>;
41
+ }>, import("@metamask/superstruct").Struct<{
42
+ type: "inApp";
43
+ message: string;
44
+ content: import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
45
+ src: string;
46
+ alt?: string | undefined;
47
+ }, "Image">;
48
+ title: string;
49
+ }, {
50
+ type: import("@metamask/superstruct").Struct<"inApp", null>;
51
+ message: import("@metamask/superstruct").Struct<string, null>;
52
+ content: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
53
+ src: string;
54
+ alt?: string | undefined;
55
+ }, "Image">, null>;
56
+ title: import("@metamask/superstruct").Struct<string, null>;
57
+ }>, import("@metamask/superstruct").Struct<{
58
+ type: "inApp";
59
+ message: string;
60
+ content: import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
61
+ src: string;
62
+ alt?: string | undefined;
63
+ }, "Image">;
64
+ title: string;
65
+ footerLink: {
66
+ text: string;
67
+ href: string;
68
+ };
69
+ }, {
70
+ type: import("@metamask/superstruct").Struct<"inApp", null>;
71
+ message: import("@metamask/superstruct").Struct<string, null>;
72
+ content: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
73
+ src: string;
74
+ alt?: string | undefined;
75
+ }, "Image">, null>;
76
+ title: import("@metamask/superstruct").Struct<string, null>;
77
+ footerLink: import("@metamask/superstruct").Struct<{
78
+ text: string;
79
+ href: string;
80
+ }, {
81
+ href: import("@metamask/superstruct").Struct<string, null>;
82
+ text: import("@metamask/superstruct").Struct<string, null>;
83
+ }>;
84
+ }>, import("@metamask/superstruct").Struct<{
85
+ type: "native";
86
+ message: string;
87
+ }, {
88
+ type: import("@metamask/superstruct").Struct<"native", null>;
89
+ message: import("@metamask/superstruct").Struct<string, null>;
90
+ }>]>;
91
+ export type NotificationParameters = InferMatching<typeof NotificationParametersStruct, NotifyParams>;
18
92
  export type NotifyMethodHooks = {
19
93
  /**
20
94
  * @param snapId - The ID of the Snap that created the notification.
21
95
  * @param args - The notification arguments.
22
96
  */
23
- showNativeNotification: (snapId: string, args: NotificationArgs) => Promise<null>;
97
+ showNativeNotification: (snapId: string, args: NotificationParameters) => Promise<null>;
24
98
  /**
25
99
  * @param snapId - The ID of the Snap that created the notification.
26
100
  * @param args - The notification arguments.
27
101
  */
28
- showInAppNotification: (snapId: string, args: NotificationArgs) => Promise<null>;
102
+ showInAppNotification: (snapId: string, args: NotificationParameters) => Promise<null>;
29
103
  isOnPhishingList: (url: string) => boolean;
30
104
  maybeUpdatePhishingList: () => Promise<void>;
105
+ createInterface: (origin: string, content: NotificationComponent) => Promise<string>;
106
+ getSnap: (snapId: string) => Snap | undefined;
31
107
  };
32
108
  type SpecificationBuilderOptions = {
33
109
  allowedCaveats?: Readonly<NonEmptyArray<string>> | null;
@@ -67,17 +143,22 @@ export declare const notifyBuilder: Readonly<{
67
143
  * @param hooks.showInAppNotification - A function that shows a notification in the MetaMask UI.
68
144
  * @param hooks.isOnPhishingList - A function that checks for links against the phishing list.
69
145
  * @param hooks.maybeUpdatePhishingList - A function that updates the phishing list if needed.
146
+ * @param hooks.createInterface - A function that creates the interface in SnapInterfaceController.
147
+ * @param hooks.getSnap - A function that checks if a snap is installed.
70
148
  * @returns The method implementation which returns `null` on success.
71
149
  * @throws If the params are invalid.
72
150
  */
73
- export declare function getImplementation({ showNativeNotification, showInAppNotification, isOnPhishingList, maybeUpdatePhishingList, }: NotifyMethodHooks): (args: RestrictedMethodOptions<NotifyParams>) => Promise<NotifyResult>;
151
+ export declare function getImplementation({ showNativeNotification, showInAppNotification, isOnPhishingList, maybeUpdatePhishingList, createInterface, getSnap, }: NotifyMethodHooks): (args: RestrictedMethodOptions<NotifyParams>) => Promise<NotifyResult>;
74
152
  /**
75
153
  * Validates the notify method `params` and returns them cast to the correct
76
154
  * type. Throws if validation fails.
77
155
  *
78
156
  * @param params - The unvalidated params object from the method request.
157
+ * @param isOnPhishingList - The function that checks for links against the phishing list.
158
+ * @param getSnap - A function that checks if a snap is installed.
79
159
  * @returns The validated method parameter object.
160
+ * @throws If the params are invalid.
80
161
  */
81
- export declare function getValidatedParams(params: unknown): NotifyParams;
162
+ export declare function getValidatedParams(params: unknown, isOnPhishingList: NotifyMethodHooks['isOnPhishingList'], getSnap: NotifyMethodHooks['getSnap']): NotifyParams;
82
163
  export {};
83
164
  //# sourceMappingURL=notify.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notify.d.cts","sourceRoot":"","sources":["../../src/restricted/notify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC7B,wCAAwC;AACzC,OAAO,EAAE,cAAc,EAAe,wCAAwC;AAE9E,OAAO,EAAE,gBAAgB,EAAE,4BAA4B;AACvD,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACZ,4BAA4B;AAE7B,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAGrD,OAAO,EAAE,KAAK,iBAAiB,EAAE,qBAAiB;AAElD,QAAA,MAAM,UAAU,gBAAgB,CAAC;AAEjC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAEpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,sBAAsB,EAAE,CACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,KACnB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;;OAGG;IACH,qBAAqB,EAAE,CACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,KACnB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAE3C,uBAAuB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,cAAc,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IACxD,WAAW,EAAE,iBAAiB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