@metamask/snaps-sdk 1.3.0 → 1.3.2
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 +11 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/ui/components/copyable.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/ui/components/copyable.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/ui/components/copyable.d.ts +11 -14
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.3.2]
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fix missing `sensitive` property in `Copyable` type ([#2070](https://github.com/MetaMask/snaps/pull/2070))
|
|
12
|
+
|
|
13
|
+
## [1.3.1]
|
|
14
|
+
### Fixed
|
|
15
|
+
- Export error wrappers ([#2043](https://github.com/MetaMask/snaps/pull/2043))
|
|
16
|
+
|
|
9
17
|
## [1.3.0]
|
|
10
18
|
### Added
|
|
11
19
|
- Add image fetching utility functions ([#1995](https://github.com/MetaMask/snaps/pull/1995))
|
|
@@ -29,7 +37,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
37
|
### Added
|
|
30
38
|
- Initial release of this package.
|
|
31
39
|
|
|
32
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@1.3.
|
|
40
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@1.3.2...HEAD
|
|
41
|
+
[1.3.2]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@1.3.1...@metamask/snaps-sdk@1.3.2
|
|
42
|
+
[1.3.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@1.3.0...@metamask/snaps-sdk@1.3.1
|
|
33
43
|
[1.3.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@1.2.0...@metamask/snaps-sdk@1.3.0
|
|
34
44
|
[1.2.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@1.1.0...@metamask/snaps-sdk@1.2.0
|
|
35
45
|
[1.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-sdk@1.0.0...@metamask/snaps-sdk@1.1.0
|
package/dist/cjs/index.js
CHANGED
|
@@ -41,6 +41,7 @@ _export(exports, {
|
|
|
41
41
|
const _internals = require("./internals");
|
|
42
42
|
const _utils = require("@metamask/utils");
|
|
43
43
|
_export_star(require("./errors"), exports);
|
|
44
|
+
_export_star(require("./error-wrappers"), exports);
|
|
44
45
|
_export_star(require("./images"), exports);
|
|
45
46
|
_export_star(require("./types"), exports);
|
|
46
47
|
_export_star(require("./ui"), exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n"],"names":["getErrorData","getErrorMessage","getErrorStack","SNAP_ERROR_CODE","SNAP_ERROR_MESSAGE","literal","union","enumValue","assert"],"mappings":"AAAA,gFAAgF;;;;;;;;;;;;IAG9EA,YAAY;eAAZA,uBAAY;;IACZC,eAAe;eAAfA,0BAAe;;IACfC,aAAa;eAAbA,wBAAa;;IACbC,eAAe;eAAfA,0BAAe;;IACfC,kBAAkB;eAAlBA,6BAAkB;;IAClBC,OAAO;eAAPA,kBAAO;;IACPC,KAAK;eAALA,gBAAK;;IACLC,SAAS;eAATA,oBAAS;;IAUFC,MAAM;eAANA,aAAM;;;2BATR;uBASgB;qBAET;qBACA;qBACA;qBACA"}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n"],"names":["getErrorData","getErrorMessage","getErrorStack","SNAP_ERROR_CODE","SNAP_ERROR_MESSAGE","literal","union","enumValue","assert"],"mappings":"AAAA,gFAAgF;;;;;;;;;;;;IAG9EA,YAAY;eAAZA,uBAAY;;IACZC,eAAe;eAAfA,0BAAe;;IACfC,aAAa;eAAbA,wBAAa;;IACbC,eAAe;eAAfA,0BAAe;;IACfC,kBAAkB;eAAlBA,6BAAkB;;IAClBC,OAAO;eAAPA,kBAAO;;IACPC,KAAK;eAALA,gBAAK;;IACLC,SAAS;eAATA,oBAAS;;IAUFC,MAAM;eAANA,aAAM;;;2BATR;uBASgB;qBAET;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ui/components/copyable.ts"],"sourcesContent":["import {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/ui/components/copyable.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer<typeof CopyableStruct>;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n"],"names":["CopyableStruct","copyable","assign","LiteralStruct","object","type","literal","NodeType","Copyable","value","string","sensitive","optional","boolean","createBuilder"],"mappings":";;;;;;;;;;;IAaaA,cAAc;eAAdA;;IAoCAC,QAAQ;eAARA;;;6BAzCN;yBAEuB;uBACU;AAEjC,MAAMD,iBAAiBE,IAAAA,mBAAM,EAClCC,oBAAa,EACbC,IAAAA,mBAAM,EAAC;IACLC,MAAMC,IAAAA,oBAAO,EAACC,eAAQ,CAACC,QAAQ;IAC/BC,OAAOC,IAAAA,mBAAM;IACbC,WAAWC,IAAAA,qBAAQ,EAACC,IAAAA,oBAAO;AAC7B;AA8BK,MAAMZ,WAAWa,IAAAA,sBAAa,EAACP,eAAQ,CAACC,QAAQ,EAAER,gBAAgB;IACvE;IACA;CACD"}
|
package/dist/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export { getErrorData, getErrorMessage, getErrorStack, SNAP_ERROR_CODE, SNAP_ERROR_MESSAGE, literal, union, enumValue } from './internals';
|
|
3
3
|
export { assert } from '@metamask/utils';
|
|
4
4
|
export * from './errors';
|
|
5
|
+
export * from './error-wrappers';
|
|
5
6
|
export * from './images';
|
|
6
7
|
export * from './types';
|
|
7
8
|
export * from './ui';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n"],"names":["getErrorData","getErrorMessage","getErrorStack","SNAP_ERROR_CODE","SNAP_ERROR_MESSAGE","literal","union","enumValue","assert"],"mappings":"AAAA,gFAAgF;AAEhF,SACEA,YAAY,EACZC,eAAe,EACfC,aAAa,EACbC,eAAe,EACfC,kBAAkB,EAClBC,OAAO,EACPC,KAAK,EACLC,SAAS,QACJ,cAAc;AASrB,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,OAAO"}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n"],"names":["getErrorData","getErrorMessage","getErrorStack","SNAP_ERROR_CODE","SNAP_ERROR_MESSAGE","literal","union","enumValue","assert"],"mappings":"AAAA,gFAAgF;AAEhF,SACEA,YAAY,EACZC,eAAe,EACfC,aAAa,EACbC,eAAe,EACfC,kBAAkB,EAClBC,OAAO,EACPC,KAAK,EACLC,SAAS,QACJ,cAAc;AASrB,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,cAAc,WAAW;AACzB,cAAc,mBAAmB;AACjC,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ui/components/copyable.ts"],"sourcesContent":["import {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/ui/components/copyable.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer<typeof CopyableStruct>;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n"],"names":["assign","boolean","literal","object","optional","string","createBuilder","LiteralStruct","NodeType","CopyableStruct","type","Copyable","value","sensitive","copyable"],"mappings":"AACA,SACEA,MAAM,EACNC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,MAAM,QACD,cAAc;AAErB,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,aAAa,EAAEC,QAAQ,QAAQ,WAAW;AAEnD,OAAO,MAAMC,iBAAiBT,OAC5BO,eACAJ,OAAO;IACLO,MAAMR,QAAQM,SAASG,QAAQ;IAC/BC,OAAOP;IACPQ,WAAWT,SAASH;AACtB,IACA;AAeF;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMa,WAAWR,cAAcE,SAASG,QAAQ,EAAEF,gBAAgB;IACvE;IACA;CACD,EAAE"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { getErrorData, getErrorMessage, getErrorStack, SNAP_ERROR_CODE, SNAP_ERR
|
|
|
3
3
|
export type { Json, JsonRpcError, JsonRpcRequest, JsonRpcParams, } from '@metamask/utils';
|
|
4
4
|
export { assert } from '@metamask/utils';
|
|
5
5
|
export * from './errors';
|
|
6
|
+
export * from './error-wrappers';
|
|
6
7
|
export * from './images';
|
|
7
8
|
export * from './types';
|
|
8
9
|
export * from './ui';
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import type { Infer } from 'superstruct';
|
|
1
2
|
import { NodeType } from '../nodes';
|
|
2
|
-
|
|
3
|
+
export declare const CopyableStruct: import("superstruct").Struct<{
|
|
4
|
+
value: string;
|
|
5
|
+
type: NodeType.Copyable;
|
|
6
|
+
sensitive?: boolean | undefined;
|
|
7
|
+
}, {
|
|
8
|
+
type: import("superstruct").Struct<NodeType.Copyable, NodeType.Copyable>;
|
|
9
|
+
value: import("superstruct").Struct<string, null>;
|
|
10
|
+
sensitive: import("superstruct").Struct<boolean | undefined, null>;
|
|
11
|
+
}>;
|
|
3
12
|
/**
|
|
4
13
|
* Text that can be copied to the clipboard. It can optionally be marked as
|
|
5
14
|
* sensitive, in which case it will only be displayed to the user after clicking
|
|
@@ -11,19 +20,7 @@ import type { Literal } from '../nodes';
|
|
|
11
20
|
* are only displayed to the user after clicking on the component. Defaults to
|
|
12
21
|
* false.
|
|
13
22
|
*/
|
|
14
|
-
export declare type Copyable =
|
|
15
|
-
type: NodeType.Copyable;
|
|
16
|
-
value: string;
|
|
17
|
-
};
|
|
18
|
-
export declare const CopyableStruct: import("superstruct").Struct<{
|
|
19
|
-
value: string;
|
|
20
|
-
type: NodeType.Copyable;
|
|
21
|
-
sensitive?: boolean | undefined;
|
|
22
|
-
}, {
|
|
23
|
-
type: import("superstruct").Struct<NodeType.Copyable, NodeType.Copyable>;
|
|
24
|
-
value: import("superstruct").Struct<string, null>;
|
|
25
|
-
sensitive: import("superstruct").Struct<boolean | undefined, null>;
|
|
26
|
-
}>;
|
|
23
|
+
export declare type Copyable = Infer<typeof CopyableStruct>;
|
|
27
24
|
/**
|
|
28
25
|
* Create a {@link Copyable} component.
|
|
29
26
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@lavamoat/allow-scripts": "^2.5.1",
|
|
47
|
-
"@metamask/auto-changelog": "^3.4.
|
|
47
|
+
"@metamask/auto-changelog": "^3.4.4",
|
|
48
48
|
"@metamask/eslint-config": "^12.1.0",
|
|
49
49
|
"@metamask/eslint-config-jest": "^12.1.0",
|
|
50
50
|
"@metamask/eslint-config-nodejs": "^12.1.0",
|