@metamask-previews/multichain-account-service 0.3.0-preview-5e0fb2b → 0.3.0-preview-8755e953
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 +1 -6
- package/dist/MultichainAccountGroup.cjs.map +1 -1
- package/dist/MultichainAccountGroup.d.cts +3 -3
- package/dist/MultichainAccountGroup.d.cts.map +1 -1
- package/dist/MultichainAccountGroup.d.mts +3 -3
- package/dist/MultichainAccountGroup.d.mts.map +1 -1
- package/dist/MultichainAccountGroup.mjs.map +1 -1
- package/dist/MultichainAccountService.cjs +1 -16
- package/dist/MultichainAccountService.cjs.map +1 -1
- package/dist/MultichainAccountService.d.cts +8 -21
- package/dist/MultichainAccountService.d.cts.map +1 -1
- package/dist/MultichainAccountService.d.mts +8 -21
- package/dist/MultichainAccountService.d.mts.map +1 -1
- package/dist/MultichainAccountService.mjs +1 -16
- package/dist/MultichainAccountService.mjs.map +1 -1
- package/dist/MultichainAccountWallet.cjs +13 -115
- package/dist/MultichainAccountWallet.cjs.map +1 -1
- package/dist/MultichainAccountWallet.d.cts +1 -22
- package/dist/MultichainAccountWallet.d.cts.map +1 -1
- package/dist/MultichainAccountWallet.d.mts +1 -22
- package/dist/MultichainAccountWallet.d.mts.map +1 -1
- package/dist/MultichainAccountWallet.mjs +13 -115
- package/dist/MultichainAccountWallet.mjs.map +1 -1
- package/dist/index.cjs +1 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/dist/providers/BaseAccountProvider.cjs +1 -30
- package/dist/providers/BaseAccountProvider.cjs.map +1 -1
- package/dist/providers/BaseAccountProvider.d.cts +5 -32
- package/dist/providers/BaseAccountProvider.d.cts.map +1 -1
- package/dist/providers/BaseAccountProvider.d.mts +5 -32
- package/dist/providers/BaseAccountProvider.d.mts.map +1 -1
- package/dist/providers/BaseAccountProvider.mjs +0 -27
- package/dist/providers/BaseAccountProvider.mjs.map +1 -1
- package/dist/providers/EvmAccountProvider.cjs +0 -35
- package/dist/providers/EvmAccountProvider.cjs.map +1 -1
- package/dist/providers/EvmAccountProvider.d.cts +0 -66
- package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
- package/dist/providers/EvmAccountProvider.d.mts +0 -66
- package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
- package/dist/providers/EvmAccountProvider.mjs +1 -36
- package/dist/providers/EvmAccountProvider.mjs.map +1 -1
- package/dist/providers/SolAccountProvider.cjs +1 -31
- package/dist/providers/SolAccountProvider.cjs.map +1 -1
- package/dist/providers/SolAccountProvider.d.cts +3 -14
- package/dist/providers/SolAccountProvider.d.cts.map +1 -1
- package/dist/providers/SolAccountProvider.d.mts +3 -14
- package/dist/providers/SolAccountProvider.d.mts.map +1 -1
- package/dist/providers/SolAccountProvider.mjs +3 -33
- package/dist/providers/SolAccountProvider.mjs.map +1 -1
- package/dist/tests/accounts.cjs +0 -9
- package/dist/tests/accounts.cjs.map +1 -1
- package/dist/tests/accounts.d.cts +55 -27
- package/dist/tests/accounts.d.cts.map +1 -1
- package/dist/tests/accounts.d.mts +55 -27
- package/dist/tests/accounts.d.mts.map +1 -1
- package/dist/tests/accounts.mjs +0 -9
- package/dist/tests/accounts.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -5
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +1 -5
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +4 -6
- package/dist/providers/SnapAccountProvider.cjs +0 -29
- package/dist/providers/SnapAccountProvider.cjs.map +0 -1
- package/dist/providers/SnapAccountProvider.d.cts +0 -22
- package/dist/providers/SnapAccountProvider.d.cts.map +0 -1
- package/dist/providers/SnapAccountProvider.d.mts +0 -22
- package/dist/providers/SnapAccountProvider.d.mts.map +0 -1
- package/dist/providers/SnapAccountProvider.mjs +0 -25
- package/dist/providers/SnapAccountProvider.mjs.map +0 -1
- package/dist/providers/index.cjs +0 -22
- package/dist/providers/index.cjs.map +0 -1
- package/dist/providers/index.d.cts +0 -5
- package/dist/providers/index.d.cts.map +0 -1
- package/dist/providers/index.d.mts +0 -5
- package/dist/providers/index.d.mts.map +0 -1
- package/dist/providers/index.mjs +0 -6
- package/dist/providers/index.mjs.map +0 -1
package/dist/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { RestrictedMessenger } from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from '@metamask/snaps-controllers';\n\nimport type {\n MultichainAccountService,\n serviceName,\n} from './MultichainAccountService';\n\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `${typeof serviceName}:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `${typeof serviceName}:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `${typeof serviceName}:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `${typeof serviceName}:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { RestrictedMessenger } from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from '@metamask/snaps-controllers';\n\nimport type {\n MultichainAccountService,\n serviceName,\n} from './MultichainAccountService';\n\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `${typeof serviceName}:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `${typeof serviceName}:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `${typeof serviceName}:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `${typeof serviceName}:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions =\n | MultichainAccountServiceGetMultichainAccountGroupAction\n | MultichainAccountServiceGetMultichainAccountGroupsAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction;\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents = never;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\nexport type AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerGetStateAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\nexport type AllowedEvents =\n | KeyringControllerStateChangeEvent\n | AccountsControllerAccountAddedEvent\n | AccountsControllerAccountRemovedEvent;\n\n/**\n * The messenger restricted to actions and events that\n * {@link MultichainAccountService} needs to access.\n */\nexport type MultichainAccountServiceMessenger = RestrictedMessenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
package/dist/types.d.cts
CHANGED
|
@@ -19,15 +19,11 @@ export type MultichainAccountServiceGetMultichainAccountWalletsAction = {
|
|
|
19
19
|
type: `${typeof serviceName}:getMultichainAccountWallets`;
|
|
20
20
|
handler: MultichainAccountService['getMultichainAccountWallets'];
|
|
21
21
|
};
|
|
22
|
-
export type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {
|
|
23
|
-
type: `${typeof serviceName}:createNextMultichainAccountGroup`;
|
|
24
|
-
handler: MultichainAccountService['createNextMultichainAccountGroup'];
|
|
25
|
-
};
|
|
26
22
|
/**
|
|
27
23
|
* All actions that {@link MultichainAccountService} registers so that other
|
|
28
24
|
* modules can call them.
|
|
29
25
|
*/
|
|
30
|
-
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction
|
|
26
|
+
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction;
|
|
31
27
|
/**
|
|
32
28
|
* All events that {@link MultichainAccountService} publishes so that other modules
|
|
33
29
|
* can subscribe to them.
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EACnC,qCAAqC,EACrC,kCAAkC,EAClC,2CAA2C,EAC3C,8CAA8C,EAC/C,sCAAsC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAkC;AACrE,OAAO,KAAK,EACV,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EACnC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,IAAI,qCAAqC,EAAE,oCAAoC;AAE9G,OAAO,KAAK,EACV,wBAAwB,EACxB,WAAW,EACZ,uCAAmC;AAEpC,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,GAAG,OAAO,WAAW,4BAA4B,CAAC;IACxD,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,GAAG,OAAO,WAAW,6BAA6B,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,GAAG,OAAO,WAAW,6BAA6B,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,GAAG,OAAO,WAAW,8BAA8B,CAAC;IAC1D,OAAO,EAAE,wBAAwB,CAAC,6BAA6B,CAAC,CAAC;CAClE,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAA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AC;AAEpC;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB,iCAAiC,GACjC,mCAAmC,GACnC,qCAAqC,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,mBAAmB,CACjE,0BAA0B,EAC1B,+BAA+B,GAAG,cAAc,EAChD,8BAA8B,GAAG,aAAa,EAC9C,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC"}
|
package/dist/types.d.mts
CHANGED
|
@@ -19,15 +19,11 @@ export type MultichainAccountServiceGetMultichainAccountWalletsAction = {
|
|
|
19
19
|
type: `${typeof serviceName}:getMultichainAccountWallets`;
|
|
20
20
|
handler: MultichainAccountService['getMultichainAccountWallets'];
|
|
21
21
|
};
|
|
22
|
-
export type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {
|
|
23
|
-
type: `${typeof serviceName}:createNextMultichainAccountGroup`;
|
|
24
|
-
handler: MultichainAccountService['createNextMultichainAccountGroup'];
|
|
25
|
-
};
|
|
26
22
|
/**
|
|
27
23
|
* All actions that {@link MultichainAccountService} registers so that other
|
|
28
24
|
* modules can call them.
|
|
29
25
|
*/
|
|
30
|
-
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction
|
|
26
|
+
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction;
|
|
31
27
|
/**
|
|
32
28
|
* All events that {@link MultichainAccountService} publishes so that other modules
|
|
33
29
|
* can subscribe to them.
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings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AAG,aAAa,EAC9C,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC"}
|
package/dist/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { RestrictedMessenger } from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from '@metamask/snaps-controllers';\n\nimport type {\n MultichainAccountService,\n serviceName,\n} from './MultichainAccountService';\n\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `${typeof serviceName}:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `${typeof serviceName}:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `${typeof serviceName}:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `${typeof serviceName}:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { RestrictedMessenger } from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from '@metamask/snaps-controllers';\n\nimport type {\n MultichainAccountService,\n serviceName,\n} from './MultichainAccountService';\n\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `${typeof serviceName}:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `${typeof serviceName}:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `${typeof serviceName}:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `${typeof serviceName}:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions =\n | MultichainAccountServiceGetMultichainAccountGroupAction\n | MultichainAccountServiceGetMultichainAccountGroupsAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction;\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents = never;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\nexport type AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerGetStateAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\nexport type AllowedEvents =\n | KeyringControllerStateChangeEvent\n | AccountsControllerAccountAddedEvent\n | AccountsControllerAccountRemovedEvent;\n\n/**\n * The messenger restricted to actions and events that\n * {@link MultichainAccountService} needs to access.\n */\nexport type MultichainAccountServiceMessenger = RestrictedMessenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/multichain-account-service",
|
|
3
|
-
"version": "0.3.0-preview-
|
|
3
|
+
"version": "0.3.0-preview-8755e953",
|
|
4
4
|
"description": "Service to manage multichain accounts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@metamask/base-controller": "^8.0.1",
|
|
51
|
-
"@metamask/eth-snap-keyring": "^14.0.0",
|
|
52
51
|
"@metamask/keyring-api": "^19.0.0",
|
|
53
52
|
"@metamask/keyring-internal-api": "^7.0.0",
|
|
54
53
|
"@metamask/keyring-snap-client": "^6.0.0",
|
|
@@ -58,25 +57,24 @@
|
|
|
58
57
|
"@metamask/superstruct": "^3.1.0"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
61
|
-
"@metamask/account-api": "^0.
|
|
60
|
+
"@metamask/account-api": "^0.6.0",
|
|
62
61
|
"@metamask/accounts-controller": "^32.0.1",
|
|
63
62
|
"@metamask/auto-changelog": "^3.4.4",
|
|
63
|
+
"@metamask/eth-snap-keyring": "^14.0.0",
|
|
64
64
|
"@metamask/keyring-controller": "^22.1.0",
|
|
65
65
|
"@metamask/providers": "^22.1.0",
|
|
66
66
|
"@metamask/snaps-controllers": "^14.0.1",
|
|
67
67
|
"@types/jest": "^27.4.1",
|
|
68
|
-
"@types/uuid": "^8.3.0",
|
|
69
68
|
"deepmerge": "^4.2.2",
|
|
70
69
|
"jest": "^27.5.1",
|
|
71
70
|
"ts-jest": "^27.1.4",
|
|
72
71
|
"typedoc": "^0.24.8",
|
|
73
72
|
"typedoc-plugin-missing-exports": "^2.0.0",
|
|
74
73
|
"typescript": "~5.2.2",
|
|
75
|
-
"uuid": "^8.3.2",
|
|
76
74
|
"webextension-polyfill": "^0.12.0"
|
|
77
75
|
},
|
|
78
76
|
"peerDependencies": {
|
|
79
|
-
"@metamask/account-api": "^0.
|
|
77
|
+
"@metamask/account-api": "^0.6.0",
|
|
80
78
|
"@metamask/accounts-controller": "^32.0.0",
|
|
81
79
|
"@metamask/keyring-controller": "^22.0.0",
|
|
82
80
|
"@metamask/providers": "^22.0.0",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SnapAccountProvider = void 0;
|
|
4
|
-
const keyring_controller_1 = require("@metamask/keyring-controller");
|
|
5
|
-
const BaseAccountProvider_1 = require("./BaseAccountProvider.cjs");
|
|
6
|
-
class SnapAccountProvider extends BaseAccountProvider_1.BaseAccountProvider {
|
|
7
|
-
constructor(snapId, messenger) {
|
|
8
|
-
super(messenger);
|
|
9
|
-
this.snapId = snapId;
|
|
10
|
-
}
|
|
11
|
-
async withCreateAccount(createAccounts) {
|
|
12
|
-
// NOTE: We're not supposed to make the keyring instance escape `withKeyring` but
|
|
13
|
-
// we have to use the `SnapKeyring` instance to be able to create Solana account
|
|
14
|
-
// without triggering UI confirmation.
|
|
15
|
-
// Also, creating account that way won't invalidate the Snap keyring state. The
|
|
16
|
-
// account will get created and persisted properly with the Snap account creation
|
|
17
|
-
// flow "asynchronously" (with `notify:accountCreated`).
|
|
18
|
-
const createAccount = await this.withKeyring({ type: keyring_controller_1.KeyringTypes.snap }, async ({ keyring }) => keyring.createAccount.bind(keyring));
|
|
19
|
-
const accounts = await createAccounts((options) => createAccount(this.snapId, options, {
|
|
20
|
-
displayAccountNameSuggestion: false,
|
|
21
|
-
displayConfirmation: false,
|
|
22
|
-
setSelectedAccount: false,
|
|
23
|
-
}));
|
|
24
|
-
(0, BaseAccountProvider_1.assertAreBip44Accounts)(accounts);
|
|
25
|
-
return accounts;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.SnapAccountProvider = SnapAccountProvider;
|
|
29
|
-
//# sourceMappingURL=SnapAccountProvider.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnapAccountProvider.cjs","sourceRoot":"","sources":["../../src/providers/SnapAccountProvider.ts"],"names":[],"mappings":";;;AAGA,qEAA4D;AAK5D,mEAG+B;AAM/B,MAAsB,mBAAoB,SAAQ,yCAAmB;IAGnE,YAAY,MAAc,EAAE,SAA4C;QACtE,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAES,KAAK,CAAC,iBAAiB,CAC/B,cAE8B;QAE9B,iFAAiF;QACjF,gFAAgF;QAChF,sCAAsC;QACtC,+EAA+E;QAC/E,iFAAiF;QACjF,wDAAwD;QACxD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,WAAW,CAG1C,EAAE,IAAI,EAAE,iCAAY,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CACnD,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CACpC,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAChD,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE;YAClC,4BAA4B,EAAE,KAAK;YACnC,mBAAmB,EAAE,KAAK;YAC1B,kBAAkB,EAAE,KAAK;SAC1B,CAAC,CACH,CAAC;QAEF,IAAA,4CAAsB,EAAC,QAAQ,CAAC,CAAC;QAEjC,OAAO,QAAQ,CAAC;IAClB,CAAC;CAaF;AAnDD,kDAmDC","sourcesContent":["import { type Bip44Account } from '@metamask/account-api';\nimport type { SnapKeyring } from '@metamask/eth-snap-keyring';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type { Json, SnapId } from '@metamask/snaps-sdk';\nimport type { MultichainAccountServiceMessenger } from 'src/types';\n\nimport {\n assertAreBip44Accounts,\n BaseAccountProvider,\n} from './BaseAccountProvider';\n\nexport type RestrictedSnapKeyringCreateAccount = (\n options: Record<string, Json>,\n) => Promise<KeyringAccount>;\n\nexport abstract class SnapAccountProvider extends BaseAccountProvider {\n readonly snapId: SnapId;\n\n constructor(snapId: SnapId, messenger: MultichainAccountServiceMessenger) {\n super(messenger);\n\n this.snapId = snapId;\n }\n\n protected async withCreateAccount(\n createAccounts: (\n createAccount: RestrictedSnapKeyringCreateAccount,\n ) => Promise<KeyringAccount[]>,\n ): Promise<Bip44Account<KeyringAccount>[]> {\n // NOTE: We're not supposed to make the keyring instance escape `withKeyring` but\n // we have to use the `SnapKeyring` instance to be able to create Solana account\n // without triggering UI confirmation.\n // Also, creating account that way won't invalidate the Snap keyring state. The\n // account will get created and persisted properly with the Snap account creation\n // flow \"asynchronously\" (with `notify:accountCreated`).\n const createAccount = await this.withKeyring<\n SnapKeyring,\n SnapKeyring['createAccount']\n >({ type: KeyringTypes.snap }, async ({ keyring }) =>\n keyring.createAccount.bind(keyring),\n );\n\n const accounts = await createAccounts((options) =>\n createAccount(this.snapId, options, {\n displayAccountNameSuggestion: false,\n displayConfirmation: false,\n setSelectedAccount: false,\n }),\n );\n\n assertAreBip44Accounts(accounts);\n\n return accounts;\n }\n\n abstract isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;\n\n abstract createAccounts(options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]>;\n\n abstract discoverAndCreateAccounts(options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]>;\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type Bip44Account } from "@metamask/account-api";
|
|
2
|
-
import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
|
|
3
|
-
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
4
|
-
import type { Json, SnapId } from "@metamask/snaps-sdk";
|
|
5
|
-
import type { MultichainAccountServiceMessenger } from "src/types";
|
|
6
|
-
import { BaseAccountProvider } from "./BaseAccountProvider.cjs";
|
|
7
|
-
export type RestrictedSnapKeyringCreateAccount = (options: Record<string, Json>) => Promise<KeyringAccount>;
|
|
8
|
-
export declare abstract class SnapAccountProvider extends BaseAccountProvider {
|
|
9
|
-
readonly snapId: SnapId;
|
|
10
|
-
constructor(snapId: SnapId, messenger: MultichainAccountServiceMessenger);
|
|
11
|
-
protected withCreateAccount(createAccounts: (createAccount: RestrictedSnapKeyringCreateAccount) => Promise<KeyringAccount[]>): Promise<Bip44Account<KeyringAccount>[]>;
|
|
12
|
-
abstract isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;
|
|
13
|
-
abstract createAccounts(options: {
|
|
14
|
-
entropySource: EntropySourceId;
|
|
15
|
-
groupIndex: number;
|
|
16
|
-
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
17
|
-
abstract discoverAndCreateAccounts(options: {
|
|
18
|
-
entropySource: EntropySourceId;
|
|
19
|
-
groupIndex: number;
|
|
20
|
-
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=SnapAccountProvider.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnapAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/SnapAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,8BAA8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alAccount } from "@metamask/keyring-internal-api";
|
|
4
|
-
import type { Json, SnapId } from "@metamask/snaps-sdk";
|
|
5
|
-
import type { MultichainAccountServiceMessenger } from "src/types";
|
|
6
|
-
import { BaseAccountProvider } from "./BaseAccountProvider.mjs";
|
|
7
|
-
export type RestrictedSnapKeyringCreateAccount = (options: Record<string, Json>) => Promise<KeyringAccount>;
|
|
8
|
-
export declare abstract class SnapAccountProvider extends BaseAccountProvider {
|
|
9
|
-
readonly snapId: SnapId;
|
|
10
|
-
constructor(snapId: SnapId, messenger: MultichainAccountServiceMessenger);
|
|
11
|
-
protected withCreateAccount(createAccounts: (createAccount: RestrictedSnapKeyringCreateAccount) => Promise<KeyringAccount[]>): Promise<Bip44Account<KeyringAccount>[]>;
|
|
12
|
-
abstract isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;
|
|
13
|
-
abstract createAccounts(options: {
|
|
14
|
-
entropySource: EntropySourceId;
|
|
15
|
-
groupIndex: number;
|
|
16
|
-
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
17
|
-
abstract discoverAndCreateAccounts(options: {
|
|
18
|
-
entropySource: EntropySourceId;
|
|
19
|
-
groupIndex: number;
|
|
20
|
-
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=SnapAccountProvider.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnapAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/SnapAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,8BAA8B;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAE7E,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,4BAA4B;AACxD,OAAO,KAAK,EAAE,iCAAiC,EAAE,kBAAkB;AAEnE,OAAO,EAEL,mBAAmB,EACpB,kCAA8B;AAE/B,MAAM,MAAM,kCAAkC,GAAG,CAC/C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,KAC1B,OAAO,CAAC,cAAc,CAAC,CAAC;AAE7B,8BAAsB,mBAAoB,SAAQ,mBAAmB;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,iCAAiC;cAMxD,iBAAiB,CAC/B,cAAc,EAAE,CACd,aAAa,EAAE,kCAAkC,KAC9C,OAAO,CAAC,cAAc,EAAE,CAAC,GAC7B,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;IA2B1C,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,eAAe,CAAC,GAAG,OAAO;IAE7E,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE;QAC/B,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;IAE3C,QAAQ,CAAC,yBAAyB,CAAC,OAAO,EAAE;QAC1C,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;CAC5C"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
2
|
-
import { assertAreBip44Accounts, BaseAccountProvider } from "./BaseAccountProvider.mjs";
|
|
3
|
-
export class SnapAccountProvider extends BaseAccountProvider {
|
|
4
|
-
constructor(snapId, messenger) {
|
|
5
|
-
super(messenger);
|
|
6
|
-
this.snapId = snapId;
|
|
7
|
-
}
|
|
8
|
-
async withCreateAccount(createAccounts) {
|
|
9
|
-
// NOTE: We're not supposed to make the keyring instance escape `withKeyring` but
|
|
10
|
-
// we have to use the `SnapKeyring` instance to be able to create Solana account
|
|
11
|
-
// without triggering UI confirmation.
|
|
12
|
-
// Also, creating account that way won't invalidate the Snap keyring state. The
|
|
13
|
-
// account will get created and persisted properly with the Snap account creation
|
|
14
|
-
// flow "asynchronously" (with `notify:accountCreated`).
|
|
15
|
-
const createAccount = await this.withKeyring({ type: KeyringTypes.snap }, async ({ keyring }) => keyring.createAccount.bind(keyring));
|
|
16
|
-
const accounts = await createAccounts((options) => createAccount(this.snapId, options, {
|
|
17
|
-
displayAccountNameSuggestion: false,
|
|
18
|
-
displayConfirmation: false,
|
|
19
|
-
setSelectedAccount: false,
|
|
20
|
-
}));
|
|
21
|
-
assertAreBip44Accounts(accounts);
|
|
22
|
-
return accounts;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=SnapAccountProvider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnapAccountProvider.mjs","sourceRoot":"","sources":["../../src/providers/SnapAccountProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAK5D,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACpB,kCAA8B;AAM/B,MAAM,OAAgB,mBAAoB,SAAQ,mBAAmB;IAGnE,YAAY,MAAc,EAAE,SAA4C;QACtE,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAES,KAAK,CAAC,iBAAiB,CAC/B,cAE8B;QAE9B,iFAAiF;QACjF,gFAAgF;QAChF,sCAAsC;QACtC,+EAA+E;QAC/E,iFAAiF;QACjF,wDAAwD;QACxD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,WAAW,CAG1C,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CACnD,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CACpC,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAChD,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE;YAClC,4BAA4B,EAAE,KAAK;YACnC,mBAAmB,EAAE,KAAK;YAC1B,kBAAkB,EAAE,KAAK;SAC1B,CAAC,CACH,CAAC;QAEF,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QAEjC,OAAO,QAAQ,CAAC;IAClB,CAAC;CAaF","sourcesContent":["import { type Bip44Account } from '@metamask/account-api';\nimport type { SnapKeyring } from '@metamask/eth-snap-keyring';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type { Json, SnapId } from '@metamask/snaps-sdk';\nimport type { MultichainAccountServiceMessenger } from 'src/types';\n\nimport {\n assertAreBip44Accounts,\n BaseAccountProvider,\n} from './BaseAccountProvider';\n\nexport type RestrictedSnapKeyringCreateAccount = (\n options: Record<string, Json>,\n) => Promise<KeyringAccount>;\n\nexport abstract class SnapAccountProvider extends BaseAccountProvider {\n readonly snapId: SnapId;\n\n constructor(snapId: SnapId, messenger: MultichainAccountServiceMessenger) {\n super(messenger);\n\n this.snapId = snapId;\n }\n\n protected async withCreateAccount(\n createAccounts: (\n createAccount: RestrictedSnapKeyringCreateAccount,\n ) => Promise<KeyringAccount[]>,\n ): Promise<Bip44Account<KeyringAccount>[]> {\n // NOTE: We're not supposed to make the keyring instance escape `withKeyring` but\n // we have to use the `SnapKeyring` instance to be able to create Solana account\n // without triggering UI confirmation.\n // Also, creating account that way won't invalidate the Snap keyring state. The\n // account will get created and persisted properly with the Snap account creation\n // flow \"asynchronously\" (with `notify:accountCreated`).\n const createAccount = await this.withKeyring<\n SnapKeyring,\n SnapKeyring['createAccount']\n >({ type: KeyringTypes.snap }, async ({ keyring }) =>\n keyring.createAccount.bind(keyring),\n );\n\n const accounts = await createAccounts((options) =>\n createAccount(this.snapId, options, {\n displayAccountNameSuggestion: false,\n displayConfirmation: false,\n setSelectedAccount: false,\n }),\n );\n\n assertAreBip44Accounts(accounts);\n\n return accounts;\n }\n\n abstract isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;\n\n abstract createAccounts(options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]>;\n\n abstract discoverAndCreateAccounts(options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]>;\n}\n"]}
|
package/dist/providers/index.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./BaseAccountProvider.cjs"), exports);
|
|
18
|
-
__exportStar(require("./SnapAccountProvider.cjs"), exports);
|
|
19
|
-
// Concrete providers:
|
|
20
|
-
__exportStar(require("./SolAccountProvider.cjs"), exports);
|
|
21
|
-
__exportStar(require("./EvmAccountProvider.cjs"), exports);
|
|
22
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAsC;AACtC,4DAAsC;AAEtC,sBAAsB;AACtB,2DAAqC;AACrC,2DAAqC","sourcesContent":["export * from './BaseAccountProvider';\nexport * from './SnapAccountProvider';\n\n// Concrete providers:\nexport * from './SolAccountProvider';\nexport * from './EvmAccountProvider';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,0CAAsC;AAGtC,yCAAqC;AACrC,yCAAqC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,0CAAsC;AAGtC,yCAAqC;AACrC,yCAAqC"}
|
package/dist/providers/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,0CAAsC;AAEtC,sBAAsB;AACtB,yCAAqC;AACrC,yCAAqC","sourcesContent":["export * from './BaseAccountProvider';\nexport * from './SnapAccountProvider';\n\n// Concrete providers:\nexport * from './SolAccountProvider';\nexport * from './EvmAccountProvider';\n"]}
|