@metamask-previews/snap-account-service 2.1.2-preview-4f4c98e → 2.1.2-preview-eb263b0ee
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 +0 -1
- package/dist/SnapAccountService-method-action-types.cjs +7 -0
- package/dist/SnapAccountService-method-action-types.cjs.map +1 -0
- package/dist/{SnapAccountService-method-action-types.d.ts → SnapAccountService-method-action-types.d.cts} +2 -2
- package/dist/SnapAccountService-method-action-types.d.cts.map +1 -0
- package/dist/SnapAccountService-method-action-types.d.mts +141 -0
- package/dist/SnapAccountService-method-action-types.d.mts.map +1 -0
- package/dist/{SnapAccountService-method-action-types.js → SnapAccountService-method-action-types.mjs} +1 -1
- package/dist/SnapAccountService-method-action-types.mjs.map +1 -0
- package/dist/SnapAccountService.cjs +543 -0
- package/dist/SnapAccountService.cjs.map +1 -0
- package/dist/{SnapAccountService.d.ts → SnapAccountService.d.cts} +13 -13
- package/dist/SnapAccountService.d.cts.map +1 -0
- package/dist/SnapAccountService.d.mts +184 -0
- package/dist/SnapAccountService.d.mts.map +1 -0
- package/dist/{SnapAccountService.js → SnapAccountService.mjs} +13 -12
- package/dist/SnapAccountService.mjs.map +1 -0
- package/dist/SnapPlatformWatcher.cjs +61 -0
- package/dist/SnapPlatformWatcher.cjs.map +1 -0
- package/dist/{SnapPlatformWatcher.d.ts → SnapPlatformWatcher.d.cts} +2 -2
- package/dist/SnapPlatformWatcher.d.cts.map +1 -0
- package/dist/SnapPlatformWatcher.d.mts +14 -0
- package/dist/SnapPlatformWatcher.d.mts.map +1 -0
- package/dist/{SnapPlatformWatcher.js → SnapPlatformWatcher.mjs} +5 -4
- package/dist/{SnapPlatformWatcher.js.map → SnapPlatformWatcher.mjs.map} +1 -1
- package/dist/SnapTracker.cjs +92 -0
- package/dist/SnapTracker.cjs.map +1 -0
- package/dist/{SnapTracker.d.ts → SnapTracker.d.cts} +3 -3
- package/dist/SnapTracker.d.cts.map +1 -0
- package/dist/SnapTracker.d.mts +25 -0
- package/dist/SnapTracker.d.mts.map +1 -0
- package/dist/{SnapTracker.js → SnapTracker.mjs} +2 -2
- package/dist/SnapTracker.mjs.map +1 -0
- package/dist/errors.cjs +137 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/{errors.d.ts → errors.d.cts} +2 -2
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +86 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/{errors.js → errors.mjs} +2 -2
- package/dist/errors.mjs.map +1 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +6 -6
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger.cjs +9 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/{logger.d.ts → logger.d.cts} +3 -2
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +6 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/{logger.js → logger.mjs} +2 -2
- package/dist/logger.mjs.map +1 -0
- package/dist/types.cjs +3 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types.d.ts → types.d.cts} +3 -3
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +55 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +17 -13
- package/dist/SnapAccountService-method-action-types.d.ts.map +0 -1
- package/dist/SnapAccountService-method-action-types.js.map +0 -1
- package/dist/SnapAccountService.d.ts.map +0 -1
- package/dist/SnapAccountService.js.map +0 -1
- package/dist/SnapPlatformWatcher.d.ts.map +0 -1
- package/dist/SnapTracker.d.ts.map +0 -1
- package/dist/SnapTracker.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -36,7 +36,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
36
36
|
|
|
37
37
|
### Changed
|
|
38
38
|
|
|
39
|
-
- **BREAKING:** Bump minimum Node.js version to 22 ([#9168](https://github.com/MetaMask/core/pull/9168))
|
|
40
39
|
- Bump `@metamask/account-tree-controller` from `^7.5.4` to `^7.5.5` ([#9470](https://github.com/MetaMask/core/pull/9470))
|
|
41
40
|
- Bump `@metamask/account-api` from `^1.0.4` to `^1.1.1` ([#9676](https://github.com/MetaMask/core/pull/9676))
|
|
42
41
|
- Bump `@metamask/keyring-api` from `^23.5.0` to `^23.7.0` ([#9676](https://github.com/MetaMask/core/pull/9676))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapAccountService-method-action-types.cjs","sourceRoot":"","sources":["../src/SnapAccountService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SnapAccountService } from './SnapAccountService.js';\n\n/**\n * Returns the IDs of all currently tracked account-management Snaps —\n * Snaps that are installed, enabled, not blocked, and have the\n * `endowment:keyring` permission.\n *\n * @returns The IDs of tracked account-management Snaps.\n */\nexport type SnapAccountServiceGetSnapsAction = {\n type: `SnapAccountService:getSnaps`;\n handler: SnapAccountService['getSnaps'];\n};\n\n/**\n * Ensures everything is ready to use Snap accounts for the given Snap.\n * 1. Validates that `snapId` is a tracked account-management Snap.\n * 2. Asserts that the legacy -> v2 migration has been triggered (expected to\n * happen at `KeyringController:unlock` time).\n * 3. Atomically creates the v2 keyring for this Snap if it doesn't exist\n * yet.\n * 4. Waits for the Snap platform to be fully started.\n *\n * Safe to call concurrently — each step is idempotent or mutex-protected.\n *\n * @param snapId - ID of the Snap to ensure readiness for.\n * @throws If `snapId` is not a tracked account-management Snap.\n * @throws If the migration has not been triggered yet (wallet not unlocked).\n */\nexport type SnapAccountServiceEnsureReadyAction = {\n type: `SnapAccountService:ensureReady`;\n handler: SnapAccountService['ensureReady'];\n};\n\n/**\n * Migrate the legacy Snap keyring to the new (per-snap) Snap keyring v2.\n * Expected to be triggered at `KeyringController:unlock` time.\n * Safe to call concurrently — the migration runs only once; all callers\n * await the same promise.\n *\n * @returns A promise that resolves when the migration is complete.\n */\nexport type SnapAccountServiceEnsureMigratedAction = {\n type: `SnapAccountService:ensureMigrated`;\n handler: SnapAccountService['ensureMigrated'];\n};\n\n/**\n * Returns the keyring capabilities declared by the given Snap. These are\n * populated by the bridge keyring from the Snap's manifest, and describe\n * which keyring features the Snap supports (scopes, BIP-44 options, etc.).\n *\n * Consumers use this to decide whether to drive the Snap through the v1 or\n * v2 keyring path. Reading capabilities does not mutate state, so the\n * lock-free keyring access is used.\n *\n * @param snapId - ID of the Snap.\n * @returns The Snap's keyring capabilities.\n */\nexport type SnapAccountServiceGetCapabilitiesAction = {\n type: `SnapAccountService:getCapabilities`;\n handler: SnapAccountService['getCapabilities'];\n};\n\n/**\n * Returns the CAIP-19 asset type/ID list supported by an account.\n *\n * @param snapId - ID of the Snap.\n * @param id - ID of the account.\n * @returns A promise resolving to the list of supported CAIP-19 asset type/IDs.\n */\nexport type SnapAccountServiceGetAccountAssetsAction = {\n type: `SnapAccountService:getAccountAssets`;\n handler: SnapAccountService['getAccountAssets'];\n};\n\n/**\n * Returns the balances for an account for the requested asset types.\n *\n * @param snapId - ID of the Snap.\n * @param id - ID of the account.\n * @param assets - List of CAIP-19 fungible asset types to fetch balances for.\n * @returns A promise resolving to a map of asset type to balance.\n */\nexport type SnapAccountServiceGetAccountBalancesAction = {\n type: `SnapAccountService:getAccountBalances`;\n handler: SnapAccountService['getAccountBalances'];\n};\n\n/**\n * Returns a page of transactions for an account.\n *\n * @param snapId - ID of the Snap.\n * @param id - ID of the account.\n * @param pagination - Pagination options.\n * @returns A promise resolving to a page of transactions.\n */\nexport type SnapAccountServiceGetAccountTransactionsAction = {\n type: `SnapAccountService:getAccountTransactions`;\n handler: SnapAccountService['getAccountTransactions'];\n};\n\n/**\n * Resolves the account address to use for routing a signing request.\n *\n * @param snapId - ID of the Snap.\n * @param scope - CAIP-2 chain ID of the signing request.\n * @param request - The signing JSON-RPC request.\n * @returns A promise resolving to the resolved address, or `null` if the\n * Snap cannot determine an address for this request.\n */\nexport type SnapAccountServiceResolveAccountAddressAction = {\n type: `SnapAccountService:resolveAccountAddress`;\n handler: SnapAccountService['resolveAccountAddress'];\n};\n\n/**\n * Notifies a Snap of the currently selected accounts.\n *\n * For v1 Snaps the call goes through the keyring (signing interface); for\n * v2 Snaps it is routed via the RPC client because the keyring only covers\n * keyring-only operations (signing, account lifecycle).\n *\n * @param snapId - ID of the Snap.\n * @param accounts - IDs of the accounts to mark as selected.\n */\nexport type SnapAccountServiceSetSelectedAccountsAction = {\n type: `SnapAccountService:setSelectedAccounts`;\n handler: SnapAccountService['setSelectedAccounts'];\n};\n\n/**\n * Handle a message from a Snap.\n *\n * @param snapId - ID of the Snap.\n * @param message - Message sent by the Snap.\n * @returns The execution result.\n */\nexport type SnapAccountServiceHandleKeyringSnapMessageAction = {\n type: `SnapAccountService:handleKeyringSnapMessage`;\n handler: SnapAccountService['handleKeyringSnapMessage'];\n};\n\n/**\n * Union of all SnapAccountService action types.\n */\nexport type SnapAccountServiceMethodActions =\n | SnapAccountServiceGetSnapsAction\n | SnapAccountServiceEnsureReadyAction\n | SnapAccountServiceEnsureMigratedAction\n | SnapAccountServiceGetCapabilitiesAction\n | SnapAccountServiceGetAccountAssetsAction\n | SnapAccountServiceGetAccountBalancesAction\n | SnapAccountServiceGetAccountTransactionsAction\n | SnapAccountServiceResolveAccountAddressAction\n | SnapAccountServiceSetSelectedAccountsAction\n | SnapAccountServiceHandleKeyringSnapMessageAction;\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file is auto generated.
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
|
-
import type { SnapAccountService } from
|
|
5
|
+
import type { SnapAccountService } from "./SnapAccountService.cjs";
|
|
6
6
|
/**
|
|
7
7
|
* Returns the IDs of all currently tracked account-management Snaps —
|
|
8
8
|
* Snaps that are installed, enabled, not blocked, and have the
|
|
@@ -138,4 +138,4 @@ export type SnapAccountServiceHandleKeyringSnapMessageAction = {
|
|
|
138
138
|
* Union of all SnapAccountService action types.
|
|
139
139
|
*/
|
|
140
140
|
export type SnapAccountServiceMethodActions = SnapAccountServiceGetSnapsAction | SnapAccountServiceEnsureReadyAction | SnapAccountServiceEnsureMigratedAction | SnapAccountServiceGetCapabilitiesAction | SnapAccountServiceGetAccountAssetsAction | SnapAccountServiceGetAccountBalancesAction | SnapAccountServiceGetAccountTransactionsAction | SnapAccountServiceResolveAccountAddressAction | SnapAccountServiceSetSelectedAccountsAction | SnapAccountServiceHandleKeyringSnapMessageAction;
|
|
141
|
-
//# sourceMappingURL=SnapAccountService-method-action-types.d.
|
|
141
|
+
//# sourceMappingURL=SnapAccountService-method-action-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapAccountService-method-action-types.d.cts","sourceRoot":"","sources":["../src/SnapAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAAgC;AAElE;;;;;;GAMG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,6BAA6B,CAAC;IACpC,OAAO,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;CACzC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAk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,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,gCAAgC,GAChC,mCAAmC,GACnC,sCAAsC,GACtC,uCAAuC,GACvC,wCAAwC,GACxC,0CAA0C,GAC1C,8CAA8C,GAC9C,6CAA6C,GAC7C,2CAA2C,GAC3C,gDAAgD,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { SnapAccountService } from "./SnapAccountService.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Returns the IDs of all currently tracked account-management Snaps —
|
|
8
|
+
* Snaps that are installed, enabled, not blocked, and have the
|
|
9
|
+
* `endowment:keyring` permission.
|
|
10
|
+
*
|
|
11
|
+
* @returns The IDs of tracked account-management Snaps.
|
|
12
|
+
*/
|
|
13
|
+
export type SnapAccountServiceGetSnapsAction = {
|
|
14
|
+
type: `SnapAccountService:getSnaps`;
|
|
15
|
+
handler: SnapAccountService['getSnaps'];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Ensures everything is ready to use Snap accounts for the given Snap.
|
|
19
|
+
* 1. Validates that `snapId` is a tracked account-management Snap.
|
|
20
|
+
* 2. Asserts that the legacy -> v2 migration has been triggered (expected to
|
|
21
|
+
* happen at `KeyringController:unlock` time).
|
|
22
|
+
* 3. Atomically creates the v2 keyring for this Snap if it doesn't exist
|
|
23
|
+
* yet.
|
|
24
|
+
* 4. Waits for the Snap platform to be fully started.
|
|
25
|
+
*
|
|
26
|
+
* Safe to call concurrently — each step is idempotent or mutex-protected.
|
|
27
|
+
*
|
|
28
|
+
* @param snapId - ID of the Snap to ensure readiness for.
|
|
29
|
+
* @throws If `snapId` is not a tracked account-management Snap.
|
|
30
|
+
* @throws If the migration has not been triggered yet (wallet not unlocked).
|
|
31
|
+
*/
|
|
32
|
+
export type SnapAccountServiceEnsureReadyAction = {
|
|
33
|
+
type: `SnapAccountService:ensureReady`;
|
|
34
|
+
handler: SnapAccountService['ensureReady'];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Migrate the legacy Snap keyring to the new (per-snap) Snap keyring v2.
|
|
38
|
+
* Expected to be triggered at `KeyringController:unlock` time.
|
|
39
|
+
* Safe to call concurrently — the migration runs only once; all callers
|
|
40
|
+
* await the same promise.
|
|
41
|
+
*
|
|
42
|
+
* @returns A promise that resolves when the migration is complete.
|
|
43
|
+
*/
|
|
44
|
+
export type SnapAccountServiceEnsureMigratedAction = {
|
|
45
|
+
type: `SnapAccountService:ensureMigrated`;
|
|
46
|
+
handler: SnapAccountService['ensureMigrated'];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Returns the keyring capabilities declared by the given Snap. These are
|
|
50
|
+
* populated by the bridge keyring from the Snap's manifest, and describe
|
|
51
|
+
* which keyring features the Snap supports (scopes, BIP-44 options, etc.).
|
|
52
|
+
*
|
|
53
|
+
* Consumers use this to decide whether to drive the Snap through the v1 or
|
|
54
|
+
* v2 keyring path. Reading capabilities does not mutate state, so the
|
|
55
|
+
* lock-free keyring access is used.
|
|
56
|
+
*
|
|
57
|
+
* @param snapId - ID of the Snap.
|
|
58
|
+
* @returns The Snap's keyring capabilities.
|
|
59
|
+
*/
|
|
60
|
+
export type SnapAccountServiceGetCapabilitiesAction = {
|
|
61
|
+
type: `SnapAccountService:getCapabilities`;
|
|
62
|
+
handler: SnapAccountService['getCapabilities'];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Returns the CAIP-19 asset type/ID list supported by an account.
|
|
66
|
+
*
|
|
67
|
+
* @param snapId - ID of the Snap.
|
|
68
|
+
* @param id - ID of the account.
|
|
69
|
+
* @returns A promise resolving to the list of supported CAIP-19 asset type/IDs.
|
|
70
|
+
*/
|
|
71
|
+
export type SnapAccountServiceGetAccountAssetsAction = {
|
|
72
|
+
type: `SnapAccountService:getAccountAssets`;
|
|
73
|
+
handler: SnapAccountService['getAccountAssets'];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Returns the balances for an account for the requested asset types.
|
|
77
|
+
*
|
|
78
|
+
* @param snapId - ID of the Snap.
|
|
79
|
+
* @param id - ID of the account.
|
|
80
|
+
* @param assets - List of CAIP-19 fungible asset types to fetch balances for.
|
|
81
|
+
* @returns A promise resolving to a map of asset type to balance.
|
|
82
|
+
*/
|
|
83
|
+
export type SnapAccountServiceGetAccountBalancesAction = {
|
|
84
|
+
type: `SnapAccountService:getAccountBalances`;
|
|
85
|
+
handler: SnapAccountService['getAccountBalances'];
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Returns a page of transactions for an account.
|
|
89
|
+
*
|
|
90
|
+
* @param snapId - ID of the Snap.
|
|
91
|
+
* @param id - ID of the account.
|
|
92
|
+
* @param pagination - Pagination options.
|
|
93
|
+
* @returns A promise resolving to a page of transactions.
|
|
94
|
+
*/
|
|
95
|
+
export type SnapAccountServiceGetAccountTransactionsAction = {
|
|
96
|
+
type: `SnapAccountService:getAccountTransactions`;
|
|
97
|
+
handler: SnapAccountService['getAccountTransactions'];
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Resolves the account address to use for routing a signing request.
|
|
101
|
+
*
|
|
102
|
+
* @param snapId - ID of the Snap.
|
|
103
|
+
* @param scope - CAIP-2 chain ID of the signing request.
|
|
104
|
+
* @param request - The signing JSON-RPC request.
|
|
105
|
+
* @returns A promise resolving to the resolved address, or `null` if the
|
|
106
|
+
* Snap cannot determine an address for this request.
|
|
107
|
+
*/
|
|
108
|
+
export type SnapAccountServiceResolveAccountAddressAction = {
|
|
109
|
+
type: `SnapAccountService:resolveAccountAddress`;
|
|
110
|
+
handler: SnapAccountService['resolveAccountAddress'];
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Notifies a Snap of the currently selected accounts.
|
|
114
|
+
*
|
|
115
|
+
* For v1 Snaps the call goes through the keyring (signing interface); for
|
|
116
|
+
* v2 Snaps it is routed via the RPC client because the keyring only covers
|
|
117
|
+
* keyring-only operations (signing, account lifecycle).
|
|
118
|
+
*
|
|
119
|
+
* @param snapId - ID of the Snap.
|
|
120
|
+
* @param accounts - IDs of the accounts to mark as selected.
|
|
121
|
+
*/
|
|
122
|
+
export type SnapAccountServiceSetSelectedAccountsAction = {
|
|
123
|
+
type: `SnapAccountService:setSelectedAccounts`;
|
|
124
|
+
handler: SnapAccountService['setSelectedAccounts'];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Handle a message from a Snap.
|
|
128
|
+
*
|
|
129
|
+
* @param snapId - ID of the Snap.
|
|
130
|
+
* @param message - Message sent by the Snap.
|
|
131
|
+
* @returns The execution result.
|
|
132
|
+
*/
|
|
133
|
+
export type SnapAccountServiceHandleKeyringSnapMessageAction = {
|
|
134
|
+
type: `SnapAccountService:handleKeyringSnapMessage`;
|
|
135
|
+
handler: SnapAccountService['handleKeyringSnapMessage'];
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Union of all SnapAccountService action types.
|
|
139
|
+
*/
|
|
140
|
+
export type SnapAccountServiceMethodActions = SnapAccountServiceGetSnapsAction | SnapAccountServiceEnsureReadyAction | SnapAccountServiceEnsureMigratedAction | SnapAccountServiceGetCapabilitiesAction | SnapAccountServiceGetAccountAssetsAction | SnapAccountServiceGetAccountBalancesAction | SnapAccountServiceGetAccountTransactionsAction | SnapAccountServiceResolveAccountAddressAction | SnapAccountServiceSetSelectedAccountsAction | SnapAccountServiceHandleKeyringSnapMessageAction;
|
|
141
|
+
//# sourceMappingURL=SnapAccountService-method-action-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapAccountService-method-action-types.d.mts","sourceRoot":"","sources":["../src/SnapAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAAgC;AAElE;;;;;;GAMG;AACH,MAAM,MA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I,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gDAAgD,GAAG;IAC7D,IAAI,EAAE,6CAA6C,CAAC;IACpD,OAAO,EAAE,kBAAkB,CAAC,0BAA0B,CAAC,CAAC;CACzD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,gCAAgC,GAChC,mCAAmC,GACnC,sCAAsC,GACtC,uCAAuC,GACvC,wCAAwC,GACxC,0CAA0C,GAC1C,8CAA8C,GAC9C,6CAA6C,GAC7C,2CAA2C,GAC3C,gDAAgD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapAccountService-method-action-types.mjs","sourceRoot":"","sources":["../src/SnapAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SnapAccountService } from './SnapAccountService.js';\n\n/**\n * Returns the IDs of all currently tracked account-management Snaps —\n * Snaps that are installed, enabled, not blocked, and have the\n * `endowment:keyring` permission.\n *\n * @returns The IDs of tracked account-management Snaps.\n */\nexport type SnapAccountServiceGetSnapsAction = {\n type: `SnapAccountService:getSnaps`;\n handler: SnapAccountService['getSnaps'];\n};\n\n/**\n * Ensures everything is ready to use Snap accounts for the given Snap.\n * 1. Validates that `snapId` is a tracked account-management Snap.\n * 2. Asserts that the legacy -> v2 migration has been triggered (expected to\n * happen at `KeyringController:unlock` time).\n * 3. Atomically creates the v2 keyring for this Snap if it doesn't exist\n * yet.\n * 4. Waits for the Snap platform to be fully started.\n *\n * Safe to call concurrently — each step is idempotent or mutex-protected.\n *\n * @param snapId - ID of the Snap to ensure readiness for.\n * @throws If `snapId` is not a tracked account-management Snap.\n * @throws If the migration has not been triggered yet (wallet not unlocked).\n */\nexport type SnapAccountServiceEnsureReadyAction = {\n type: `SnapAccountService:ensureReady`;\n handler: SnapAccountService['ensureReady'];\n};\n\n/**\n * Migrate the legacy Snap keyring to the new (per-snap) Snap keyring v2.\n * Expected to be triggered at `KeyringController:unlock` time.\n * Safe to call concurrently — the migration runs only once; all callers\n * await the same promise.\n *\n * @returns A promise that resolves when the migration is complete.\n */\nexport type SnapAccountServiceEnsureMigratedAction = {\n type: `SnapAccountService:ensureMigrated`;\n handler: SnapAccountService['ensureMigrated'];\n};\n\n/**\n * Returns the keyring capabilities declared by the given Snap. These are\n * populated by the bridge keyring from the Snap's manifest, and describe\n * which keyring features the Snap supports (scopes, BIP-44 options, etc.).\n *\n * Consumers use this to decide whether to drive the Snap through the v1 or\n * v2 keyring path. Reading capabilities does not mutate state, so the\n * lock-free keyring access is used.\n *\n * @param snapId - ID of the Snap.\n * @returns The Snap's keyring capabilities.\n */\nexport type SnapAccountServiceGetCapabilitiesAction = {\n type: `SnapAccountService:getCapabilities`;\n handler: SnapAccountService['getCapabilities'];\n};\n\n/**\n * Returns the CAIP-19 asset type/ID list supported by an account.\n *\n * @param snapId - ID of the Snap.\n * @param id - ID of the account.\n * @returns A promise resolving to the list of supported CAIP-19 asset type/IDs.\n */\nexport type SnapAccountServiceGetAccountAssetsAction = {\n type: `SnapAccountService:getAccountAssets`;\n handler: SnapAccountService['getAccountAssets'];\n};\n\n/**\n * Returns the balances for an account for the requested asset types.\n *\n * @param snapId - ID of the Snap.\n * @param id - ID of the account.\n * @param assets - List of CAIP-19 fungible asset types to fetch balances for.\n * @returns A promise resolving to a map of asset type to balance.\n */\nexport type SnapAccountServiceGetAccountBalancesAction = {\n type: `SnapAccountService:getAccountBalances`;\n handler: SnapAccountService['getAccountBalances'];\n};\n\n/**\n * Returns a page of transactions for an account.\n *\n * @param snapId - ID of the Snap.\n * @param id - ID of the account.\n * @param pagination - Pagination options.\n * @returns A promise resolving to a page of transactions.\n */\nexport type SnapAccountServiceGetAccountTransactionsAction = {\n type: `SnapAccountService:getAccountTransactions`;\n handler: SnapAccountService['getAccountTransactions'];\n};\n\n/**\n * Resolves the account address to use for routing a signing request.\n *\n * @param snapId - ID of the Snap.\n * @param scope - CAIP-2 chain ID of the signing request.\n * @param request - The signing JSON-RPC request.\n * @returns A promise resolving to the resolved address, or `null` if the\n * Snap cannot determine an address for this request.\n */\nexport type SnapAccountServiceResolveAccountAddressAction = {\n type: `SnapAccountService:resolveAccountAddress`;\n handler: SnapAccountService['resolveAccountAddress'];\n};\n\n/**\n * Notifies a Snap of the currently selected accounts.\n *\n * For v1 Snaps the call goes through the keyring (signing interface); for\n * v2 Snaps it is routed via the RPC client because the keyring only covers\n * keyring-only operations (signing, account lifecycle).\n *\n * @param snapId - ID of the Snap.\n * @param accounts - IDs of the accounts to mark as selected.\n */\nexport type SnapAccountServiceSetSelectedAccountsAction = {\n type: `SnapAccountService:setSelectedAccounts`;\n handler: SnapAccountService['setSelectedAccounts'];\n};\n\n/**\n * Handle a message from a Snap.\n *\n * @param snapId - ID of the Snap.\n * @param message - Message sent by the Snap.\n * @returns The execution result.\n */\nexport type SnapAccountServiceHandleKeyringSnapMessageAction = {\n type: `SnapAccountService:handleKeyringSnapMessage`;\n handler: SnapAccountService['handleKeyringSnapMessage'];\n};\n\n/**\n * Union of all SnapAccountService action types.\n */\nexport type SnapAccountServiceMethodActions =\n | SnapAccountServiceGetSnapsAction\n | SnapAccountServiceEnsureReadyAction\n | SnapAccountServiceEnsureMigratedAction\n | SnapAccountServiceGetCapabilitiesAction\n | SnapAccountServiceGetAccountAssetsAction\n | SnapAccountServiceGetAccountBalancesAction\n | SnapAccountServiceGetAccountTransactionsAction\n | SnapAccountServiceResolveAccountAddressAction\n | SnapAccountServiceSetSelectedAccountsAction\n | SnapAccountServiceHandleKeyringSnapMessageAction;\n"]}
|