@metamask/rpc-methods
Advanced tools
Comparing version 0.38.1-flask.1 to 0.38.2-flask.1
@@ -9,2 +9,7 @@ # Changelog | ||
## [0.38.2-flask.1] | ||
### Changed | ||
- Remove business-logic callbacks from `manageAccounts` ([#1725](https://github.com/MetaMask/snaps/pull/1725)) | ||
- Bump `@metamask/utils` and `@metamask/snaps-registry` ([#1694](https://github.com/MetaMask/snaps/pull/1694)) | ||
## [0.38.1-flask.1] | ||
@@ -28,5 +33,6 @@ ### Fixed | ||
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/rpc-methods@0.38.1-flask.1...HEAD | ||
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/rpc-methods@0.38.2-flask.1...HEAD | ||
[0.38.2-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/rpc-methods@0.38.1-flask.1...@metamask/rpc-methods@0.38.2-flask.1 | ||
[0.38.1-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/rpc-methods@0.38.0-flask.1...@metamask/rpc-methods@0.38.1-flask.1 | ||
[0.38.0-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/rpc-methods@0.37.2-flask.1...@metamask/rpc-methods@0.38.0-flask.1 | ||
[0.37.2-flask.1]: https://github.com/MetaMask/snaps/releases/tag/@metamask/rpc-methods@0.37.2-flask.1 |
@@ -52,3 +52,3 @@ "use strict"; | ||
}; | ||
function manageAccountsImplementation({ getSnapKeyring, saveSnapKeyring }) { | ||
function manageAccountsImplementation({ getSnapKeyring }) { | ||
return async function manageAccounts(options) { | ||
@@ -58,12 +58,3 @@ const { context: { origin }, params } = options; | ||
const keyring = await getSnapKeyring(origin); | ||
const result = await keyring.handleKeyringSnapMessage(origin, params); | ||
const { method } = params; | ||
if ([ | ||
'updateAccount', | ||
'createAccount', | ||
'deleteAccount' | ||
].includes(method)) { | ||
await saveSnapKeyring(); | ||
} | ||
return result; | ||
return await keyring.handleKeyringSnapMessage(origin, params); | ||
}; | ||
@@ -75,4 +66,3 @@ } | ||
methodHooks: { | ||
getSnapKeyring: true, | ||
saveSnapKeyring: true | ||
getSnapKeyring: true | ||
} | ||
@@ -79,0 +69,0 @@ }); |
@@ -41,7 +41,6 @@ import { SubjectType, PermissionType } from '@metamask/permission-controller'; | ||
* @param hooks.getSnapKeyring - A function to get the snap keyring. | ||
* @param hooks.saveSnapKeyring - A function to save the snap keyring. | ||
* @returns The method implementation which either returns `null` for a | ||
* successful state update/deletion or returns the decrypted state. | ||
* @throws If the params are invalid. | ||
*/ export function manageAccountsImplementation({ getSnapKeyring, saveSnapKeyring }) { | ||
*/ export function manageAccountsImplementation({ getSnapKeyring }) { | ||
return async function manageAccounts(options) { | ||
@@ -51,12 +50,3 @@ const { context: { origin }, params } = options; | ||
const keyring = await getSnapKeyring(origin); | ||
const result = await keyring.handleKeyringSnapMessage(origin, params); | ||
const { method } = params; | ||
if ([ | ||
'updateAccount', | ||
'createAccount', | ||
'deleteAccount' | ||
].includes(method)) { | ||
await saveSnapKeyring(); | ||
} | ||
return result; | ||
return await keyring.handleKeyringSnapMessage(origin, params); | ||
}; | ||
@@ -68,4 +58,3 @@ } | ||
methodHooks: { | ||
getSnapKeyring: true, | ||
saveSnapKeyring: true | ||
getSnapKeyring: true | ||
} | ||
@@ -72,0 +61,0 @@ }); |
@@ -207,3 +207,2 @@ import type { DialogMethodHooks } from './dialog'; | ||
readonly getSnapKeyring: true; | ||
readonly saveSnapKeyring: true; | ||
}; | ||
@@ -210,0 +209,0 @@ }>; |
@@ -20,6 +20,2 @@ import type { RestrictedMethodOptions, ValidPermissionSpecification, PermissionSpecificationBuilder } from '@metamask/permission-controller'; | ||
}>; | ||
/** | ||
* Saves the snap keyring, should be called after mutable operations. | ||
*/ | ||
saveSnapKeyring: () => Promise<void>; | ||
}; | ||
@@ -51,3 +47,2 @@ declare type ManageAccountsSpecificationBuilderOptions = { | ||
* @param hooks.getSnapKeyring - A function to get the snap keyring. | ||
* @param hooks.saveSnapKeyring - A function to save the snap keyring. | ||
* @returns The method implementation which either returns `null` for a | ||
@@ -57,3 +52,3 @@ * successful state update/deletion or returns the decrypted state. | ||
*/ | ||
export declare function manageAccountsImplementation({ getSnapKeyring, saveSnapKeyring, }: ManageAccountsMethodHooks): (options: RestrictedMethodOptions<Message>) => Promise<Json>; | ||
export declare function manageAccountsImplementation({ getSnapKeyring, }: ManageAccountsMethodHooks): (options: RestrictedMethodOptions<Message>) => Promise<Json>; | ||
export declare const manageAccountsBuilder: Readonly<{ | ||
@@ -69,5 +64,4 @@ readonly targetName: "snap_manageAccounts"; | ||
readonly getSnapKeyring: true; | ||
readonly saveSnapKeyring: true; | ||
}; | ||
}>; | ||
export {}; |
{ | ||
"name": "@metamask/rpc-methods", | ||
"version": "0.38.1-flask.1", | ||
"version": "0.38.2-flask.1", | ||
"description": "MetaMask Snap RPC method implementations.", | ||
@@ -43,5 +43,5 @@ "repository": { | ||
"@metamask/snaps-ui": "^0.37.4-flask.1", | ||
"@metamask/snaps-utils": "^0.38.2-flask.1", | ||
"@metamask/snaps-utils": "^0.38.3-flask.1", | ||
"@metamask/types": "^1.1.0", | ||
"@metamask/utils": "^6.0.1", | ||
"@metamask/utils": "^7.1.0", | ||
"@noble/hashes": "^1.3.1", | ||
@@ -62,3 +62,3 @@ "eth-rpc-errors": "^4.0.3", | ||
"@swc/jest": "^0.2.26", | ||
"@types/node": "^20.3.1", | ||
"@types/node": "18.14.2", | ||
"@typescript-eslint/eslint-plugin": "^5.42.1", | ||
@@ -65,0 +65,0 @@ "@typescript-eslint/parser": "^5.42.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
458309
4631
+ Added@metamask/snaps-utils@0.38.3-flask.1(transitive)
- Removed@metamask/snaps-utils@0.38.2-flask.1(transitive)
Updated@metamask/utils@^7.1.0