@metamask/snaps-sdk 2.0.0 → 3.0.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.
- package/CHANGELOG.md +17 -1
- package/dist/index.js +883 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +810 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/error-wrappers.d.ts +464 -48
- package/dist/types/errors.d.ts +2 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/internals/error-wrappers.d.ts +29 -3
- package/dist/types/internals/index.d.ts +1 -0
- package/dist/types/internals/svg.d.ts +14 -0
- package/package.json +19 -16
- package/dist/cjs/error-wrappers.js +0 -80
- package/dist/cjs/error-wrappers.js.map +0 -1
- package/dist/cjs/errors.js +0 -157
- package/dist/cjs/errors.js.map +0 -1
- package/dist/cjs/images.js +0 -54
- package/dist/cjs/images.js.map +0 -1
- package/dist/cjs/index.js +0 -62
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/internals/error-wrappers.js +0 -25
- package/dist/cjs/internals/error-wrappers.js.map +0 -1
- package/dist/cjs/internals/errors.js +0 -59
- package/dist/cjs/internals/errors.js.map +0 -1
- package/dist/cjs/internals/helpers.js +0 -6
- package/dist/cjs/internals/helpers.js.map +0 -1
- package/dist/cjs/internals/index.js +0 -23
- package/dist/cjs/internals/index.js.map +0 -1
- package/dist/cjs/internals/structs.js +0 -43
- package/dist/cjs/internals/structs.js.map +0 -1
- package/dist/cjs/types/caip.js +0 -10
- package/dist/cjs/types/caip.js.map +0 -1
- package/dist/cjs/types/global.js +0 -6
- package/dist/cjs/types/global.js.map +0 -1
- package/dist/cjs/types/handlers/cronjob.js +0 -6
- package/dist/cjs/types/handlers/cronjob.js.map +0 -1
- package/dist/cjs/types/handlers/home-page.js +0 -6
- package/dist/cjs/types/handlers/home-page.js.map +0 -1
- package/dist/cjs/types/handlers/index.js +0 -28
- package/dist/cjs/types/handlers/index.js.map +0 -1
- package/dist/cjs/types/handlers/keyring.js +0 -6
- package/dist/cjs/types/handlers/keyring.js.map +0 -1
- package/dist/cjs/types/handlers/lifecycle.js +0 -6
- package/dist/cjs/types/handlers/lifecycle.js.map +0 -1
- package/dist/cjs/types/handlers/name-lookup.js +0 -6
- package/dist/cjs/types/handlers/name-lookup.js.map +0 -1
- package/dist/cjs/types/handlers/rpc-request.js +0 -6
- package/dist/cjs/types/handlers/rpc-request.js.map +0 -1
- package/dist/cjs/types/handlers/signature.js +0 -6
- package/dist/cjs/types/handlers/signature.js.map +0 -1
- package/dist/cjs/types/handlers/transaction.js +0 -16
- package/dist/cjs/types/handlers/transaction.js.map +0 -1
- package/dist/cjs/types/handlers/user-input.js +0 -51
- package/dist/cjs/types/handlers/user-input.js.map +0 -1
- package/dist/cjs/types/index.js +0 -29
- package/dist/cjs/types/index.js.map +0 -1
- package/dist/cjs/types/interface.js +0 -26
- package/dist/cjs/types/interface.js.map +0 -1
- package/dist/cjs/types/methods/create-interface.js +0 -6
- package/dist/cjs/types/methods/create-interface.js.map +0 -1
- package/dist/cjs/types/methods/dialog.js +0 -18
- package/dist/cjs/types/methods/dialog.js.map +0 -1
- package/dist/cjs/types/methods/get-bip32-entropy.js +0 -6
- package/dist/cjs/types/methods/get-bip32-entropy.js.map +0 -1
- package/dist/cjs/types/methods/get-bip32-public-key.js +0 -6
- package/dist/cjs/types/methods/get-bip32-public-key.js.map +0 -1
- package/dist/cjs/types/methods/get-bip44-entropy.js +0 -6
- package/dist/cjs/types/methods/get-bip44-entropy.js.map +0 -1
- package/dist/cjs/types/methods/get-client-status.js +0 -10
- package/dist/cjs/types/methods/get-client-status.js.map +0 -1
- package/dist/cjs/types/methods/get-entropy.js +0 -6
- package/dist/cjs/types/methods/get-entropy.js.map +0 -1
- package/dist/cjs/types/methods/get-file.js +0 -18
- package/dist/cjs/types/methods/get-file.js.map +0 -1
- package/dist/cjs/types/methods/get-interface-state.js +0 -6
- package/dist/cjs/types/methods/get-interface-state.js.map +0 -1
- package/dist/cjs/types/methods/get-locale.js +0 -10
- package/dist/cjs/types/methods/get-locale.js.map +0 -1
- package/dist/cjs/types/methods/get-snaps.js +0 -6
- package/dist/cjs/types/methods/get-snaps.js.map +0 -1
- package/dist/cjs/types/methods/index.js +0 -38
- package/dist/cjs/types/methods/index.js.map +0 -1
- package/dist/cjs/types/methods/invoke-keyring.js +0 -6
- package/dist/cjs/types/methods/invoke-keyring.js.map +0 -1
- package/dist/cjs/types/methods/invoke-snap.js +0 -6
- package/dist/cjs/types/methods/invoke-snap.js.map +0 -1
- package/dist/cjs/types/methods/manage-accounts.js +0 -6
- package/dist/cjs/types/methods/manage-accounts.js.map +0 -1
- package/dist/cjs/types/methods/manage-state.js +0 -18
- package/dist/cjs/types/methods/manage-state.js.map +0 -1
- package/dist/cjs/types/methods/methods.js +0 -6
- package/dist/cjs/types/methods/methods.js.map +0 -1
- package/dist/cjs/types/methods/notify.js +0 -17
- package/dist/cjs/types/methods/notify.js.map +0 -1
- package/dist/cjs/types/methods/request-snaps.js +0 -6
- package/dist/cjs/types/methods/request-snaps.js.map +0 -1
- package/dist/cjs/types/methods/update-interface.js +0 -6
- package/dist/cjs/types/methods/update-interface.js.map +0 -1
- package/dist/cjs/types/permissions.js +0 -6
- package/dist/cjs/types/permissions.js.map +0 -1
- package/dist/cjs/types/provider.js +0 -6
- package/dist/cjs/types/provider.js.map +0 -1
- package/dist/cjs/types/snap.js +0 -6
- package/dist/cjs/types/snap.js.map +0 -1
- package/dist/cjs/ui/builder.js +0 -44
- package/dist/cjs/ui/builder.js.map +0 -1
- package/dist/cjs/ui/component.js +0 -29
- package/dist/cjs/ui/component.js.map +0 -1
- package/dist/cjs/ui/components/address.js +0 -30
- package/dist/cjs/ui/components/address.js.map +0 -1
- package/dist/cjs/ui/components/button.js +0 -59
- package/dist/cjs/ui/components/button.js.map +0 -1
- package/dist/cjs/ui/components/copyable.js +0 -32
- package/dist/cjs/ui/components/copyable.js.map +0 -1
- package/dist/cjs/ui/components/divider.js +0 -27
- package/dist/cjs/ui/components/divider.js.map +0 -1
- package/dist/cjs/ui/components/form.js +0 -41
- package/dist/cjs/ui/components/form.js.map +0 -1
- package/dist/cjs/ui/components/heading.js +0 -30
- package/dist/cjs/ui/components/heading.js.map +0 -1
- package/dist/cjs/ui/components/image.js +0 -47
- package/dist/cjs/ui/components/image.js.map +0 -1
- package/dist/cjs/ui/components/index.js +0 -54
- package/dist/cjs/ui/components/index.js.map +0 -1
- package/dist/cjs/ui/components/input.js +0 -52
- package/dist/cjs/ui/components/input.js.map +0 -1
- package/dist/cjs/ui/components/panel.js +0 -65
- package/dist/cjs/ui/components/panel.js.map +0 -1
- package/dist/cjs/ui/components/row.js +0 -57
- package/dist/cjs/ui/components/row.js.map +0 -1
- package/dist/cjs/ui/components/spinner.js +0 -27
- package/dist/cjs/ui/components/spinner.js.map +0 -1
- package/dist/cjs/ui/components/text.js +0 -32
- package/dist/cjs/ui/components/text.js.map +0 -1
- package/dist/cjs/ui/index.js +0 -28
- package/dist/cjs/ui/index.js.map +0 -1
- package/dist/cjs/ui/nodes.js +0 -46
- package/dist/cjs/ui/nodes.js.map +0 -1
- package/dist/esm/error-wrappers.js +0 -128
- package/dist/esm/error-wrappers.js.map +0 -1
- package/dist/esm/errors.js +0 -150
- package/dist/esm/errors.js.map +0 -1
- package/dist/esm/images.js +0 -84
- package/dist/esm/images.js.map +0 -1
- package/dist/esm/index.js +0 -10
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/internals/error-wrappers.js +0 -25
- package/dist/esm/internals/error-wrappers.js.map +0 -1
- package/dist/esm/internals/errors.js +0 -58
- package/dist/esm/internals/errors.js.map +0 -1
- package/dist/esm/internals/helpers.js +0 -3
- package/dist/esm/internals/helpers.js.map +0 -1
- package/dist/esm/internals/index.js +0 -6
- package/dist/esm/internals/index.js.map +0 -1
- package/dist/esm/internals/structs.js +0 -59
- package/dist/esm/internals/structs.js.map +0 -1
- package/dist/esm/types/caip.js +0 -7
- package/dist/esm/types/caip.js.map +0 -1
- package/dist/esm/types/global.js +0 -3
- package/dist/esm/types/global.js.map +0 -1
- package/dist/esm/types/handlers/cronjob.js +0 -3
- package/dist/esm/types/handlers/cronjob.js.map +0 -1
- package/dist/esm/types/handlers/home-page.js +0 -3
- package/dist/esm/types/handlers/home-page.js.map +0 -1
- package/dist/esm/types/handlers/index.js +0 -11
- package/dist/esm/types/handlers/index.js.map +0 -1
- package/dist/esm/types/handlers/keyring.js +0 -3
- package/dist/esm/types/handlers/keyring.js.map +0 -1
- package/dist/esm/types/handlers/lifecycle.js +0 -3
- package/dist/esm/types/handlers/lifecycle.js.map +0 -1
- package/dist/esm/types/handlers/name-lookup.js +0 -3
- package/dist/esm/types/handlers/name-lookup.js.map +0 -1
- package/dist/esm/types/handlers/rpc-request.js +0 -3
- package/dist/esm/types/handlers/rpc-request.js.map +0 -1
- package/dist/esm/types/handlers/signature.js +0 -3
- package/dist/esm/types/handlers/signature.js.map +0 -1
- package/dist/esm/types/handlers/transaction.js +0 -6
- package/dist/esm/types/handlers/transaction.js.map +0 -1
- package/dist/esm/types/handlers/user-input.js +0 -24
- package/dist/esm/types/handlers/user-input.js.map +0 -1
- package/dist/esm/types/index.js +0 -12
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/interface.js +0 -12
- package/dist/esm/types/interface.js.map +0 -1
- package/dist/esm/types/methods/create-interface.js +0 -3
- package/dist/esm/types/methods/create-interface.js.map +0 -1
- package/dist/esm/types/methods/dialog.js +0 -8
- package/dist/esm/types/methods/dialog.js.map +0 -1
- package/dist/esm/types/methods/get-bip32-entropy.js +0 -3
- package/dist/esm/types/methods/get-bip32-entropy.js.map +0 -1
- package/dist/esm/types/methods/get-bip32-public-key.js +0 -3
- package/dist/esm/types/methods/get-bip32-public-key.js.map +0 -1
- package/dist/esm/types/methods/get-bip44-entropy.js +0 -3
- package/dist/esm/types/methods/get-bip44-entropy.js.map +0 -1
- package/dist/esm/types/methods/get-client-status.js +0 -7
- package/dist/esm/types/methods/get-client-status.js.map +0 -1
- package/dist/esm/types/methods/get-entropy.js +0 -3
- package/dist/esm/types/methods/get-entropy.js.map +0 -1
- package/dist/esm/types/methods/get-file.js +0 -8
- package/dist/esm/types/methods/get-file.js.map +0 -1
- package/dist/esm/types/methods/get-interface-state.js +0 -3
- package/dist/esm/types/methods/get-interface-state.js.map +0 -1
- package/dist/esm/types/methods/get-locale.js +0 -7
- package/dist/esm/types/methods/get-locale.js.map +0 -1
- package/dist/esm/types/methods/get-snaps.js +0 -3
- package/dist/esm/types/methods/get-snaps.js.map +0 -1
- package/dist/esm/types/methods/index.js +0 -21
- package/dist/esm/types/methods/index.js.map +0 -1
- package/dist/esm/types/methods/invoke-keyring.js +0 -3
- package/dist/esm/types/methods/invoke-keyring.js.map +0 -1
- package/dist/esm/types/methods/invoke-snap.js +0 -3
- package/dist/esm/types/methods/invoke-snap.js.map +0 -1
- package/dist/esm/types/methods/manage-accounts.js +0 -3
- package/dist/esm/types/methods/manage-accounts.js.map +0 -1
- package/dist/esm/types/methods/manage-state.js +0 -8
- package/dist/esm/types/methods/manage-state.js.map +0 -1
- package/dist/esm/types/methods/methods.js +0 -3
- package/dist/esm/types/methods/methods.js.map +0 -1
- package/dist/esm/types/methods/notify.js +0 -7
- package/dist/esm/types/methods/notify.js.map +0 -1
- package/dist/esm/types/methods/request-snaps.js +0 -3
- package/dist/esm/types/methods/request-snaps.js.map +0 -1
- package/dist/esm/types/methods/update-interface.js +0 -3
- package/dist/esm/types/methods/update-interface.js.map +0 -1
- package/dist/esm/types/permissions.js +0 -3
- package/dist/esm/types/permissions.js.map +0 -1
- package/dist/esm/types/provider.js +0 -3
- package/dist/esm/types/provider.js.map +0 -1
- package/dist/esm/types/snap.js +0 -3
- package/dist/esm/types/snap.js.map +0 -1
- package/dist/esm/ui/builder.js +0 -50
- package/dist/esm/ui/builder.js.map +0 -1
- package/dist/esm/ui/component.js +0 -23
- package/dist/esm/ui/component.js.map +0 -1
- package/dist/esm/ui/components/address.js +0 -22
- package/dist/esm/ui/components/address.js.map +0 -1
- package/dist/esm/ui/components/button.js +0 -50
- package/dist/esm/ui/components/button.js.map +0 -1
- package/dist/esm/ui/components/copyable.js +0 -27
- package/dist/esm/ui/components/copyable.js.map +0 -1
- package/dist/esm/ui/components/divider.js +0 -15
- package/dist/esm/ui/components/divider.js.map +0 -1
- package/dist/esm/ui/components/form.js +0 -39
- package/dist/esm/ui/components/form.js.map +0 -1
- package/dist/esm/ui/components/heading.js +0 -22
- package/dist/esm/ui/components/heading.js.map +0 -1
- package/dist/esm/ui/components/image.js +0 -37
- package/dist/esm/ui/components/image.js.map +0 -1
- package/dist/esm/ui/components/index.js +0 -14
- package/dist/esm/ui/components/index.js.map +0 -1
- package/dist/esm/ui/components/input.js +0 -47
- package/dist/esm/ui/components/input.js.map +0 -1
- package/dist/esm/ui/components/panel.js +0 -66
- package/dist/esm/ui/components/panel.js.map +0 -1
- package/dist/esm/ui/components/row.js +0 -50
- package/dist/esm/ui/components/row.js.map +0 -1
- package/dist/esm/ui/components/spinner.js +0 -15
- package/dist/esm/ui/components/spinner.js.map +0 -1
- package/dist/esm/ui/components/text.js +0 -29
- package/dist/esm/ui/components/text.js.map +0 -1
- package/dist/esm/ui/index.js +0 -5
- package/dist/esm/ui/index.js.map +0 -1
- package/dist/esm/ui/nodes.js +0 -29
- package/dist/esm/ui/nodes.js.map +0 -1
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
SNAP_ERROR_CODE: function() {
|
|
13
|
-
return SNAP_ERROR_CODE;
|
|
14
|
-
},
|
|
15
|
-
SNAP_ERROR_MESSAGE: function() {
|
|
16
|
-
return SNAP_ERROR_MESSAGE;
|
|
17
|
-
},
|
|
18
|
-
getErrorMessage: function() {
|
|
19
|
-
return getErrorMessage;
|
|
20
|
-
},
|
|
21
|
-
getErrorStack: function() {
|
|
22
|
-
return getErrorStack;
|
|
23
|
-
},
|
|
24
|
-
getErrorCode: function() {
|
|
25
|
-
return getErrorCode;
|
|
26
|
-
},
|
|
27
|
-
getErrorData: function() {
|
|
28
|
-
return getErrorData;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const _utils = require("@metamask/utils");
|
|
32
|
-
const SNAP_ERROR_CODE = -31002;
|
|
33
|
-
const SNAP_ERROR_MESSAGE = 'Snap Error';
|
|
34
|
-
function getErrorMessage(error) {
|
|
35
|
-
if ((0, _utils.isObject)(error) && (0, _utils.hasProperty)(error, 'message') && typeof error.message === 'string') {
|
|
36
|
-
return error.message;
|
|
37
|
-
}
|
|
38
|
-
return String(error);
|
|
39
|
-
}
|
|
40
|
-
function getErrorStack(error) {
|
|
41
|
-
if ((0, _utils.isObject)(error) && (0, _utils.hasProperty)(error, 'stack') && typeof error.stack === 'string') {
|
|
42
|
-
return error.stack;
|
|
43
|
-
}
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
function getErrorCode(error) {
|
|
47
|
-
if ((0, _utils.isObject)(error) && (0, _utils.hasProperty)(error, 'code') && typeof error.code === 'number' && Number.isInteger(error.code)) {
|
|
48
|
-
return error.code;
|
|
49
|
-
}
|
|
50
|
-
return -32603;
|
|
51
|
-
}
|
|
52
|
-
function getErrorData(error) {
|
|
53
|
-
if ((0, _utils.isObject)(error) && (0, _utils.hasProperty)(error, 'data') && typeof error.data === 'object' && error.data !== null && (0, _utils.isValidJson)(error.data) && !Array.isArray(error.data)) {
|
|
54
|
-
return error.data;
|
|
55
|
-
}
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/internals/errors.ts"],"sourcesContent":["import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n"],"names":["SNAP_ERROR_CODE","SNAP_ERROR_MESSAGE","getErrorMessage","getErrorStack","getErrorCode","getErrorData","error","isObject","hasProperty","message","String","stack","undefined","code","Number","isInteger","data","isValidJson","Array","isArray"],"mappings":";;;;;;;;;;;IAEaA,eAAe;eAAfA;;IACAC,kBAAkB;eAAlBA;;IAYGC,eAAe;eAAfA;;IAoBAC,aAAa;eAAbA;;IAmBAC,YAAY;eAAZA;;IAqBAC,YAAY;eAAZA;;;uBA3EmC;AAE5C,MAAML,kBAAkB,CAAC;AACzB,MAAMC,qBAAqB;AAY3B,SAASC,gBAAgBI,KAAc;IAC5C,IACEC,IAAAA,eAAQ,EAACD,UACTE,IAAAA,kBAAW,EAACF,OAAO,cACnB,OAAOA,MAAMG,OAAO,KAAK,UACzB;QACA,OAAOH,MAAMG,OAAO;IACtB;IAEA,OAAOC,OAAOJ;AAChB;AAUO,SAASH,cAAcG,KAAc;IAC1C,IACEC,IAAAA,eAAQ,EAACD,UACTE,IAAAA,kBAAW,EAACF,OAAO,YACnB,OAAOA,MAAMK,KAAK,KAAK,UACvB;QACA,OAAOL,MAAMK,KAAK;IACpB;IAEA,OAAOC;AACT;AASO,SAASR,aAAaE,KAAc;IACzC,IACEC,IAAAA,eAAQ,EAACD,UACTE,IAAAA,kBAAW,EAACF,OAAO,WACnB,OAAOA,MAAMO,IAAI,KAAK,YACtBC,OAAOC,SAAS,CAACT,MAAMO,IAAI,GAC3B;QACA,OAAOP,MAAMO,IAAI;IACnB;IAEA,OAAO,CAAC;AACV;AAUO,SAASR,aAAaC,KAAc;IACzC,IACEC,IAAAA,eAAQ,EAACD,UACTE,IAAAA,kBAAW,EAACF,OAAO,WACnB,OAAOA,MAAMU,IAAI,KAAK,YACtBV,MAAMU,IAAI,KAAK,QACfC,IAAAA,kBAAW,EAACX,MAAMU,IAAI,KACtB,CAACE,MAAMC,OAAO,CAACb,MAAMU,IAAI,GACzB;QACA,OAAOV,MAAMU,IAAI;IACnB;IAEA,OAAO,CAAC;AACV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/internals/helpers.ts"],"names":[],"mappings":""}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./error-wrappers"), exports);
|
|
6
|
-
_export_star(require("./errors"), exports);
|
|
7
|
-
_export_star(require("./helpers"), exports);
|
|
8
|
-
_export_star(require("./structs"), exports);
|
|
9
|
-
function _export_star(from, to) {
|
|
10
|
-
Object.keys(from).forEach(function(k) {
|
|
11
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
12
|
-
Object.defineProperty(to, k, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function() {
|
|
15
|
-
return from[k];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
return from;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/internals/index.ts"],"sourcesContent":["export * from './error-wrappers';\nexport * from './errors';\nexport * from './helpers';\nexport * from './structs';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
literal: function() {
|
|
13
|
-
return literal;
|
|
14
|
-
},
|
|
15
|
-
union: function() {
|
|
16
|
-
return union;
|
|
17
|
-
},
|
|
18
|
-
enumValue: function() {
|
|
19
|
-
return enumValue;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _superstruct = require("superstruct");
|
|
23
|
-
function literal(value) {
|
|
24
|
-
return (0, _superstruct.define)(JSON.stringify(value), (0, _superstruct.literal)(value).validator);
|
|
25
|
-
}
|
|
26
|
-
function union([head, ...tail]) {
|
|
27
|
-
const struct = (0, _superstruct.union)([
|
|
28
|
-
head,
|
|
29
|
-
...tail
|
|
30
|
-
]);
|
|
31
|
-
return new _superstruct.Struct({
|
|
32
|
-
...struct,
|
|
33
|
-
schema: [
|
|
34
|
-
head,
|
|
35
|
-
...tail
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function enumValue(constant) {
|
|
40
|
-
return literal(constant);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=structs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/internals/structs.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal<Type extends string | number | boolean>(value: Type) {\n return define<Type>(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union<Head extends AnyStruct, Tail extends AnyStruct[]>([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer<Head> | InferStructTuple<Tail>[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue<Type extends string>(\n constant: Type,\n): Struct<EnumToUnion<Type>, null> {\n return literal(constant as EnumToUnion<Type>);\n}\n"],"names":["literal","union","enumValue","value","define","JSON","stringify","superstructLiteral","validator","head","tail","struct","superstructUnion","Struct","schema","constant"],"mappings":";;;;;;;;;;;IAgCgBA,OAAO;eAAPA;;IAmBAC,KAAK;eAALA;;IAsBAC,SAAS;eAATA;;;6BAnET;AA0BA,SAASF,QAAgDG,KAAW;IACzE,OAAOC,IAAAA,mBAAM,EACXC,KAAKC,SAAS,CAACH,QACfI,IAAAA,oBAAkB,EAACJ,OAAOK,SAAS;AAEvC;AAcO,SAASP,MAAwD,CACtEQ,MACA,GAAGC,KACyB;IAI5B,MAAMC,SAASC,IAAAA,kBAAgB,EAAC;QAACH;WAASC;KAAK;IAE/C,OAAO,IAAIG,mBAAM,CAAC;QAChB,GAAGF,MAAM;QACTG,QAAQ;YAACL;eAASC;SAAK;IACzB;AACF;AASO,SAASR,UACda,QAAc;IAEd,OAAOf,QAAQe;AACjB"}
|
package/dist/cjs/types/caip.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/caip.ts"],"sourcesContent":["/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n *\n * @see https://chainagnostic.org/CAIPs/caip-2\n */\nexport type ChainId = `${string}:${string}`;\n\n/**\n * A CAIP-10 account ID, i.e., a chain ID and an account address.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n */\nexport type AccountId = `${ChainId}:${string}`;\n"],"names":[],"mappings":"AAAA;;;;CAIC"}
|
package/dist/cjs/types/global.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/global.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/cronjob.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/home-page.ts"],"names":[],"mappings":""}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./cronjob"), exports);
|
|
6
|
-
_export_star(require("./home-page"), exports);
|
|
7
|
-
_export_star(require("./keyring"), exports);
|
|
8
|
-
_export_star(require("./lifecycle"), exports);
|
|
9
|
-
_export_star(require("./name-lookup"), exports);
|
|
10
|
-
_export_star(require("./rpc-request"), exports);
|
|
11
|
-
_export_star(require("./transaction"), exports);
|
|
12
|
-
_export_star(require("./signature"), exports);
|
|
13
|
-
_export_star(require("./user-input"), exports);
|
|
14
|
-
function _export_star(from, to) {
|
|
15
|
-
Object.keys(from).forEach(function(k) {
|
|
16
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
17
|
-
Object.defineProperty(to, k, {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return from[k];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return from;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/index.ts"],"sourcesContent":["export * from './cronjob';\nexport * from './home-page';\nexport * from './keyring';\nexport * from './lifecycle';\nexport * from './name-lookup';\nexport * from './rpc-request';\nexport * from './transaction';\nexport * from './signature';\nexport * from './user-input';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/keyring.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/name-lookup.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/rpc-request.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/signature.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "SeverityLevel", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return SeverityLevel;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var SeverityLevel;
|
|
12
|
-
(function(SeverityLevel) {
|
|
13
|
-
SeverityLevel["Critical"] = 'critical';
|
|
14
|
-
})(SeverityLevel || (SeverityLevel = {}));
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=transaction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/transaction.ts"],"sourcesContent":["import type { EnumToUnion } from '../../internals';\nimport type { Component } from '../../ui';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise<OnTransactionResponse | null>;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: Component;\n severity?: EnumToUnion<SeverityLevel>;\n }\n | {\n id: string;\n severity?: EnumToUnion<SeverityLevel>;\n };\n"],"names":["SeverityLevel","Critical"],"mappings":";;;;;;;;;;IAWO;UAAKA,aAAa;IAAbA,cACVC,cAAW;GADDD,kBAAAA"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
UserInputEventType: function() {
|
|
13
|
-
return UserInputEventType;
|
|
14
|
-
},
|
|
15
|
-
GenericEventStruct: function() {
|
|
16
|
-
return GenericEventStruct;
|
|
17
|
-
},
|
|
18
|
-
ButtonClickEventStruct: function() {
|
|
19
|
-
return ButtonClickEventStruct;
|
|
20
|
-
},
|
|
21
|
-
FormSubmitEventStruct: function() {
|
|
22
|
-
return FormSubmitEventStruct;
|
|
23
|
-
},
|
|
24
|
-
UserInputEventStruct: function() {
|
|
25
|
-
return UserInputEventStruct;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const _superstruct = require("superstruct");
|
|
29
|
-
var UserInputEventType;
|
|
30
|
-
(function(UserInputEventType) {
|
|
31
|
-
UserInputEventType["ButtonClickEvent"] = "ButtonClickEvent";
|
|
32
|
-
UserInputEventType["FormSubmitEvent"] = "FormSubmitEvent";
|
|
33
|
-
})(UserInputEventType || (UserInputEventType = {}));
|
|
34
|
-
const GenericEventStruct = (0, _superstruct.object)({
|
|
35
|
-
type: (0, _superstruct.string)(),
|
|
36
|
-
name: (0, _superstruct.optional)((0, _superstruct.string)())
|
|
37
|
-
});
|
|
38
|
-
const ButtonClickEventStruct = (0, _superstruct.assign)(GenericEventStruct, (0, _superstruct.object)({
|
|
39
|
-
type: (0, _superstruct.literal)(UserInputEventType.ButtonClickEvent)
|
|
40
|
-
}));
|
|
41
|
-
const FormSubmitEventStruct = (0, _superstruct.assign)(GenericEventStruct, (0, _superstruct.object)({
|
|
42
|
-
type: (0, _superstruct.literal)(UserInputEventType.FormSubmitEvent),
|
|
43
|
-
value: (0, _superstruct.record)((0, _superstruct.string)(), (0, _superstruct.string)()),
|
|
44
|
-
name: (0, _superstruct.string)()
|
|
45
|
-
}));
|
|
46
|
-
const UserInputEventStruct = (0, _superstruct.union)([
|
|
47
|
-
ButtonClickEventStruct,
|
|
48
|
-
FormSubmitEventStruct
|
|
49
|
-
]);
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=user-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/handlers/user-input.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only two events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), string()),\n name: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\ntype UserInputEvent = Infer<typeof UserInputEventStruct>;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise<void>;\n"],"names":["GenericEventStruct","ButtonClickEventStruct","FormSubmitEventStruct","UserInputEventStruct","UserInputEventType","ButtonClickEvent","FormSubmitEvent","object","type","string","name","optional","assign","literal","value","record","union"],"mappings":";;;;;;;;;;;;;;IAuBaA,kBAAkB;eAAlBA;;IAKAC,sBAAsB;eAAtBA;;IAOAC,qBAAqB;eAArBA;;IASAC,oBAAoB;eAApBA;;;6BAnCN;IASA;UAAKC,kBAAkB;IAAlBA,mBACVC,sBAAAA;IADUD,mBAEVE,qBAAAA;GAFUF,uBAAAA;AAKL,MAAMJ,qBAAqBO,IAAAA,mBAAM,EAAC;IACvCC,MAAMC,IAAAA,mBAAM;IACZC,MAAMC,IAAAA,qBAAQ,EAACF,IAAAA,mBAAM;AACvB;AAEO,MAAMR,yBAAyBW,IAAAA,mBAAM,EAC1CZ,oBACAO,IAAAA,mBAAM,EAAC;IACLC,MAAMK,IAAAA,oBAAO,EAACT,mBAAmBC,gBAAgB;AACnD;AAGK,MAAMH,wBAAwBU,IAAAA,mBAAM,EACzCZ,oBACAO,IAAAA,mBAAM,EAAC;IACLC,MAAMK,IAAAA,oBAAO,EAACT,mBAAmBE,eAAe;IAChDQ,OAAOC,IAAAA,mBAAM,EAACN,IAAAA,mBAAM,KAAIA,IAAAA,mBAAM;IAC9BC,MAAMD,IAAAA,mBAAM;AACd;AAGK,MAAMN,uBAAuBa,IAAAA,kBAAK,EAAC;IACxCf;IACAC;CACD"}
|
package/dist/cjs/types/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// This is intentionally imported, rather than re-exported.
|
|
2
|
-
// eslint-disable-next-line import/no-unassigned-import
|
|
3
|
-
"use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
require("./global");
|
|
8
|
-
_export_star(require("./caip"), exports);
|
|
9
|
-
_export_star(require("./handlers"), exports);
|
|
10
|
-
_export_star(require("./methods"), exports);
|
|
11
|
-
_export_star(require("./permissions"), exports);
|
|
12
|
-
_export_star(require("./provider"), exports);
|
|
13
|
-
_export_star(require("./snap"), exports);
|
|
14
|
-
_export_star(require("./interface"), exports);
|
|
15
|
-
function _export_star(from, to) {
|
|
16
|
-
Object.keys(from).forEach(function(k) {
|
|
17
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
18
|
-
Object.defineProperty(to, k, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function() {
|
|
21
|
-
return from[k];
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return from;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/index.ts"],"sourcesContent":["// This is intentionally imported, rather than re-exported.\n// eslint-disable-next-line import/no-unassigned-import\nimport './global';\n\nexport * from './caip';\nexport * from './handlers';\nexport * from './methods';\nexport * from './permissions';\nexport * from './provider';\nexport * from './snap';\nexport * from './interface';\n"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,uDAAuD;;;;;QAChD;qBAEO;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
FormStateStruct: function() {
|
|
13
|
-
return FormStateStruct;
|
|
14
|
-
},
|
|
15
|
-
InterfaceStateStruct: function() {
|
|
16
|
-
return InterfaceStateStruct;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _superstruct = require("superstruct");
|
|
20
|
-
const FormStateStruct = (0, _superstruct.record)((0, _superstruct.string)(), (0, _superstruct.nullable)((0, _superstruct.string)()));
|
|
21
|
-
const InterfaceStateStruct = (0, _superstruct.record)((0, _superstruct.string)(), (0, _superstruct.union)([
|
|
22
|
-
FormStateStruct,
|
|
23
|
-
(0, _superstruct.nullable)((0, _superstruct.string)())
|
|
24
|
-
]));
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=interface.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/types/interface.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer<typeof FormStateStruct>;\nexport type InterfaceState = Infer<typeof InterfaceStateStruct>;\n"],"names":["FormStateStruct","InterfaceStateStruct","record","string","nullable","union"],"mappings":";;;;;;;;;;;IASaA,eAAe;eAAfA;;IAEAC,oBAAoB;eAApBA;;;6BAVmC;AAQzC,MAAMD,kBAAkBE,IAAAA,mBAAM,EAACC,IAAAA,mBAAM,KAAIC,IAAAA,qBAAQ,EAACD,IAAAA,mBAAM;AAExD,MAAMF,uBAAuBC,IAAAA,mBAAM,EACxCC,IAAAA,mBAAM,KACNE,IAAAA,kBAAK,EAAC;IAACL;IAAiBI,IAAAA,qBAAQ,EAACD,IAAAA,mBAAM;CAAI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/create-interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "DialogType", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return DialogType;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var DialogType;
|
|
12
|
-
(function(DialogType) {
|
|
13
|
-
DialogType["Alert"] = 'alert';
|
|
14
|
-
DialogType["Confirmation"] = 'confirmation';
|
|
15
|
-
DialogType["Prompt"] = 'prompt';
|
|
16
|
-
})(DialogType || (DialogType = {}));
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=dialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/dialog.ts"],"sourcesContent":["import type { EnumToUnion } from '../../internals';\nimport type { Component } from '../../ui';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion<DialogType.Alert>;\n content: Component;\n }\n | {\n type: EnumToUnion<DialogType.Alert>;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion<DialogType.Confirmation>;\n content: Component;\n }\n | {\n type: EnumToUnion<DialogType.Confirmation>;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion<DialogType.Prompt>;\n content: Component;\n placeholder?: string;\n }\n | {\n type: EnumToUnion<DialogType.Prompt>;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n"],"names":["DialogType","Alert","Confirmation","Prompt"],"mappings":";;;;;;;;;;IAWO;UAAKA,UAAU;IAAVA,WACVC,WAAQ;IADED,WAEVE,kBAAe;IAFLF,WAGVG,YAAS;GAHCH,eAAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-bip32-entropy.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-bip32-public-key.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-bip44-entropy.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-client-status.ts"],"sourcesContent":["/**\n * The request parameters for the `snap_getClientStatus` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetClientStatusParams = never;\n\n/**\n * The result returned by the `snap_getClientStatus` method.\n *\n * It returns an object containing useful information about the client.\n */\nexport type GetClientStatusResult = { locked: boolean };\n"],"names":[],"mappings":"AAAA;;;;CAIC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-entropy.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "AuxiliaryFileEncoding", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return AuxiliaryFileEncoding;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var AuxiliaryFileEncoding;
|
|
12
|
-
(function(AuxiliaryFileEncoding) {
|
|
13
|
-
AuxiliaryFileEncoding["Base64"] = 'base64';
|
|
14
|
-
AuxiliaryFileEncoding["Hex"] = 'hex';
|
|
15
|
-
AuxiliaryFileEncoding["Utf8"] = 'utf8';
|
|
16
|
-
})(AuxiliaryFileEncoding || (AuxiliaryFileEncoding = {}));
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=get-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-file.ts"],"sourcesContent":["import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion<AuxiliaryFileEncoding>;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n"],"names":["AuxiliaryFileEncoding","Base64","Hex","Utf8"],"mappings":";;;;;;;;;;IAKO;UAAKA,qBAAqB;IAArBA,sBACVC,YAAS;IADCD,sBAEVE,SAAM;IAFIF,sBAGVG,UAAO;GAHGH,0BAAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-interface-state.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-locale.ts"],"sourcesContent":["/**\n * The request parameters for the `snap_getLocale` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetLocaleParams = never;\n\n/**\n * The result returned by the `snap_getLocale` method.\n *\n * It is the locale of the user's MetaMask extension.\n */\nexport type GetLocaleResult = string;\n"],"names":[],"mappings":"AAAA;;;;CAIC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/types/methods/get-snaps.ts"],"names":[],"mappings":""}
|