@metamask/snaps-rpc-methods 11.13.1 → 12.1.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/endowments/index.cjs +1 -0
- package/dist/endowments/index.cjs.map +1 -1
- package/dist/endowments/index.d.cts.map +1 -1
- package/dist/endowments/index.d.mts.map +1 -1
- package/dist/endowments/index.mjs +1 -0
- package/dist/endowments/index.mjs.map +1 -1
- package/dist/permitted/createInterface.d.cts +44 -44
- package/dist/permitted/createInterface.d.mts +44 -44
- package/dist/permitted/experimentalProviderRequest.d.cts +3 -3
- package/dist/permitted/experimentalProviderRequest.d.mts +3 -3
- package/dist/permitted/getFile.d.cts +2 -2
- package/dist/permitted/getFile.d.mts +2 -2
- package/dist/permitted/getState.d.cts +1 -1
- package/dist/permitted/getState.d.mts +1 -1
- package/dist/permitted/handlers.d.cts +16 -0
- package/dist/permitted/handlers.d.cts.map +1 -1
- package/dist/permitted/handlers.d.mts +16 -0
- package/dist/permitted/handlers.d.mts.map +1 -1
- package/dist/permitted/scheduleBackgroundEvent.cjs +2 -19
- package/dist/permitted/scheduleBackgroundEvent.cjs.map +1 -1
- package/dist/permitted/scheduleBackgroundEvent.d.cts +4 -4
- package/dist/permitted/scheduleBackgroundEvent.d.cts.map +1 -1
- package/dist/permitted/scheduleBackgroundEvent.d.mts +4 -4
- package/dist/permitted/scheduleBackgroundEvent.d.mts.map +1 -1
- package/dist/permitted/scheduleBackgroundEvent.mjs +4 -21
- package/dist/permitted/scheduleBackgroundEvent.mjs.map +1 -1
- package/dist/permitted/setState.d.cts +1 -1
- package/dist/permitted/setState.d.mts +1 -1
- package/dist/permitted/updateInterface.d.cts +44 -44
- package/dist/permitted/updateInterface.d.mts +44 -44
- package/dist/restricted/dialog.d.cts +91 -147
- package/dist/restricted/dialog.d.cts.map +1 -1
- package/dist/restricted/dialog.d.mts +91 -147
- package/dist/restricted/dialog.d.mts.map +1 -1
- package/dist/restricted/getBip32Entropy.cjs +16 -3
- package/dist/restricted/getBip32Entropy.cjs.map +1 -1
- package/dist/restricted/getBip32Entropy.d.cts +11 -1
- package/dist/restricted/getBip32Entropy.d.cts.map +1 -1
- package/dist/restricted/getBip32Entropy.d.mts +11 -1
- package/dist/restricted/getBip32Entropy.d.mts.map +1 -1
- package/dist/restricted/getBip32Entropy.mjs +17 -4
- package/dist/restricted/getBip32Entropy.mjs.map +1 -1
- package/dist/restricted/getBip32PublicKey.cjs +19 -3
- package/dist/restricted/getBip32PublicKey.cjs.map +1 -1
- package/dist/restricted/getBip32PublicKey.d.cts +13 -3
- package/dist/restricted/getBip32PublicKey.d.cts.map +1 -1
- package/dist/restricted/getBip32PublicKey.d.mts +13 -3
- package/dist/restricted/getBip32PublicKey.d.mts.map +1 -1
- package/dist/restricted/getBip32PublicKey.mjs +20 -4
- package/dist/restricted/getBip32PublicKey.mjs.map +1 -1
- package/dist/restricted/getBip44Entropy.cjs +8 -5
- package/dist/restricted/getBip44Entropy.cjs.map +1 -1
- package/dist/restricted/getBip44Entropy.d.cts +6 -6
- package/dist/restricted/getBip44Entropy.d.cts.map +1 -1
- package/dist/restricted/getBip44Entropy.d.mts +6 -6
- package/dist/restricted/getBip44Entropy.d.mts.map +1 -1
- package/dist/restricted/getBip44Entropy.mjs +9 -6
- package/dist/restricted/getBip44Entropy.mjs.map +1 -1
- package/dist/restricted/getEntropy.cjs +7 -7
- package/dist/restricted/getEntropy.cjs.map +1 -1
- package/dist/restricted/getEntropy.d.cts +8 -8
- package/dist/restricted/getEntropy.d.cts.map +1 -1
- package/dist/restricted/getEntropy.d.mts +8 -8
- package/dist/restricted/getEntropy.d.mts.map +1 -1
- package/dist/restricted/getEntropy.mjs +8 -8
- package/dist/restricted/getEntropy.mjs.map +1 -1
- package/dist/restricted/manageAccounts.d.cts +1 -1
- package/dist/restricted/manageAccounts.d.mts +1 -1
- package/dist/restricted/manageState.cjs +4 -4
- package/dist/restricted/manageState.cjs.map +1 -1
- package/dist/restricted/manageState.d.cts +3 -3
- package/dist/restricted/manageState.d.cts.map +1 -1
- package/dist/restricted/manageState.d.mts +3 -3
- package/dist/restricted/manageState.d.mts.map +1 -1
- package/dist/restricted/manageState.mjs +5 -5
- package/dist/restricted/manageState.mjs.map +1 -1
- package/dist/restricted/notify.d.cts +74 -74
- package/dist/restricted/notify.d.mts +74 -74
- package/dist/utils.cjs +68 -23
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +40 -16
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts +40 -16
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +63 -19
- package/dist/utils.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -3,7 +3,7 @@ import { rpcErrors } from "@metamask/rpc-errors";
|
|
|
3
3
|
import { ManageStateOperation } from "@metamask/snaps-sdk";
|
|
4
4
|
import { STATE_ENCRYPTION_MAGIC_VALUE } from "@metamask/snaps-utils";
|
|
5
5
|
import { isObject, getJsonSize } from "@metamask/utils";
|
|
6
|
-
import {
|
|
6
|
+
import { deriveEntropyFromSeed } from "../utils.mjs";
|
|
7
7
|
// The salt used for SIP-6-based entropy derivation.
|
|
8
8
|
export const STATE_ENCRYPTION_SALT = 'snap_manageState encryption';
|
|
9
9
|
const methodName = 'snap_manageState';
|
|
@@ -47,15 +47,15 @@ export const STORAGE_SIZE_LIMIT = 64000000; // In bytes (64 MB)
|
|
|
47
47
|
*
|
|
48
48
|
* @param args - The encryption key args.
|
|
49
49
|
* @param args.snapId - The ID of the snap to get the encryption key for.
|
|
50
|
-
* @param args.
|
|
50
|
+
* @param args.seed - The mnemonic seed to derive the encryption key
|
|
51
51
|
* from.
|
|
52
52
|
* @param args.cryptographicFunctions - The cryptographic functions to use for
|
|
53
53
|
* the client.
|
|
54
54
|
* @returns The state encryption key.
|
|
55
55
|
*/
|
|
56
|
-
export async function getEncryptionEntropy({
|
|
57
|
-
return await
|
|
58
|
-
|
|
56
|
+
export async function getEncryptionEntropy({ seed, snapId, cryptographicFunctions, }) {
|
|
57
|
+
return await deriveEntropyFromSeed({
|
|
58
|
+
seed,
|
|
59
59
|
input: snapId,
|
|
60
60
|
salt: STATE_ENCRYPTION_SALT,
|
|
61
61
|
magic: STATE_ENCRYPTION_MAGIC_VALUE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manageState.mjs","sourceRoot":"","sources":["../../src/restricted/manageState.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,wCAAwC;AAC9E,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAEjD,OAAO,EAAE,oBAAoB,EAAE,4BAA4B;AAC3D,OAAO,EAAE,4BAA4B,EAAE,8BAA8B;AAErE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB;AAGxD,OAAO,EAAE,aAAa,EAAE,qBAAiB;AAEzC,oDAAoD;AACpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,6BAA6B,CAAC;AAEnE,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAiDtC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAI7B,CAAC,EACH,cAAc,GAAG,IAAI,EACrB,WAAW,GAC4B,EAAE,EAAE;IAC3C,OAAO;QACL,cAAc,EAAE,cAAc,CAAC,gBAAgB;QAC/C,UAAU,EAAE,UAAU;QACtB,cAAc;QACd,oBAAoB,EAAE,4BAA4B,CAAC,WAAW,CAAC;QAC/D,YAAY,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC;KACjC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAA8C;IAC7D,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,UAAU,EAAE,UAAU;IACt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;QACL,CAAC;QAED,IAAI,IAAI,CAAC;QACT,IAAI,CAAC;YACH,kEAAkE;YAClE,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,SAAS,CAAC,aAAa,CAAC;gBAC5B,OAAO,EAAE,WAAW,MAAM,iEAAiE;aAC5F,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,GAAG,gBAAgB,EAAE,CAAC;YAC5B,MAAM,SAAS,CAAC,aAAa,CAAC;gBAC5B,OAAO,EAAE,WAAW,MAAM,wDACxB,gBAAgB,GAAG,OACrB,cAAc;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAA2B,CAAC;AACrC,CAAC","sourcesContent":["import type { CryptographicFunctions } from '@metamask/key-tree';\nimport type {\n PermissionSpecificationBuilder,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { ManageStateParams, ManageStateResult } from '@metamask/snaps-sdk';\nimport { ManageStateOperation } from '@metamask/snaps-sdk';\nimport { STATE_ENCRYPTION_MAGIC_VALUE } from '@metamask/snaps-utils';\nimport type { Json, NonEmptyArray } from '@metamask/utils';\nimport { isObject, getJsonSize } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\nimport { deriveEntropy } from '../utils';\n\n// The salt used for SIP-6-based entropy derivation.\nexport const STATE_ENCRYPTION_SALT = 'snap_manageState encryption';\n\nconst methodName = 'snap_manageState';\n\nexport type ManageStateMethodHooks = {\n /**\n * Waits for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n\n /**\n * A function that clears the state of the requesting Snap.\n */\n clearSnapState: (snapId: string, encrypted: boolean) => void;\n\n /**\n * A function that gets the encrypted state of the requesting Snap.\n *\n * @returns The current state of the Snap.\n */\n getSnapState: (\n snapId: string,\n encrypted: boolean,\n ) => Promise<Record<string, Json>>;\n\n /**\n * A function that updates the state of the requesting Snap.\n *\n * @param newState - The new state of the Snap.\n */\n updateSnapState: (\n snapId: string,\n newState: Record<string, Json>,\n encrypted: boolean,\n ) => Promise<void>;\n};\n\ntype ManageStateSpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: ManageStateMethodHooks;\n};\n\ntype ManageStateSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof methodName;\n methodImplementation: ReturnType<typeof getManageStateImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\n/**\n * The specification builder for the `snap_manageState` permission.\n * `snap_manageState` lets the Snap store and manage some of its state on\n * your device.\n *\n * @param options - The specification builder options.\n * @param options.allowedCaveats - The optional allowed caveats for the permission.\n * @param options.methodHooks - The RPC method hooks needed by the method implementation.\n * @returns The specification for the `snap_manageState` permission.\n */\nexport const specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n ManageStateSpecificationBuilderOptions,\n ManageStateSpecification\n> = ({\n allowedCaveats = null,\n methodHooks,\n}: ManageStateSpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName: methodName,\n allowedCaveats,\n methodImplementation: getManageStateImplementation(methodHooks),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<ManageStateMethodHooks> = {\n getUnlockPromise: true,\n clearSnapState: true,\n getSnapState: true,\n updateSnapState: true,\n};\n\nexport const manageStateBuilder = Object.freeze({\n targetName: methodName,\n specificationBuilder,\n methodHooks,\n} as const);\n\nexport const STORAGE_SIZE_LIMIT = 64_000_000; // In bytes (64 MB)\n\ntype GetEncryptionKeyArgs = {\n snapId: string;\n mnemonicPhrase: Uint8Array;\n cryptographicFunctions?: CryptographicFunctions | undefined;\n};\n\n/**\n * Get a deterministic encryption key to use for encrypting and decrypting the\n * state.\n *\n * This key should only be used for state encryption using `snap_manageState`.\n * To get other encryption keys, a different salt can be used.\n *\n * @param args - The encryption key args.\n * @param args.snapId - The ID of the snap to get the encryption key for.\n * @param args.mnemonicPhrase - The mnemonic phrase to derive the encryption key\n * from.\n * @param args.cryptographicFunctions - The cryptographic functions to use for\n * the client.\n * @returns The state encryption key.\n */\nexport async function getEncryptionEntropy({\n mnemonicPhrase,\n snapId,\n cryptographicFunctions,\n}: GetEncryptionKeyArgs) {\n return await deriveEntropy({\n mnemonicPhrase,\n input: snapId,\n salt: STATE_ENCRYPTION_SALT,\n magic: STATE_ENCRYPTION_MAGIC_VALUE,\n cryptographicFunctions,\n });\n}\n\n/**\n * Builds the method implementation for `snap_manageState`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.clearSnapState - A function that clears the state stored for a\n * snap.\n * @param hooks.getSnapState - A function that fetches the persisted decrypted\n * state for a snap.\n * @param hooks.updateSnapState - A function that updates the state stored for a\n * snap.\n * @param hooks.getUnlockPromise - A function that resolves once the MetaMask\n * extension is unlocked and prompts the user to unlock their MetaMask if it is\n * locked.\n * @returns The method implementation which either returns `null` for a\n * successful state update/deletion or returns the decrypted state.\n * @throws If the params are invalid.\n */\nexport function getManageStateImplementation({\n getUnlockPromise,\n clearSnapState,\n getSnapState,\n updateSnapState,\n}: ManageStateMethodHooks) {\n return async function manageState(\n options: RestrictedMethodOptions<ManageStateParams>,\n ): Promise<ManageStateResult> {\n const {\n params = {},\n method,\n context: { origin },\n } = options;\n const validatedParams = getValidatedParams(params, method);\n\n // If the encrypted param is undefined or null we default to true.\n const shouldEncrypt = validatedParams.encrypted ?? true;\n\n // We only need to prompt the user when the mnemonic is needed\n // which it isn't for the clear operation or unencrypted storage.\n if (\n shouldEncrypt &&\n validatedParams.operation !== ManageStateOperation.ClearState\n ) {\n await getUnlockPromise(true);\n }\n\n switch (validatedParams.operation) {\n case ManageStateOperation.ClearState:\n clearSnapState(origin, shouldEncrypt);\n return null;\n\n case ManageStateOperation.GetState: {\n return await getSnapState(origin, shouldEncrypt);\n }\n\n case ManageStateOperation.UpdateState: {\n await updateSnapState(origin, validatedParams.newState, shouldEncrypt);\n return null;\n }\n\n default:\n throw rpcErrors.invalidParams(\n `Invalid ${method} operation: \"${\n validatedParams.operation as string\n }\"`,\n );\n }\n };\n}\n\n/**\n * Validates the manageState method `params` and returns them cast to the correct\n * type. Throws if validation fails.\n *\n * @param params - The unvalidated params object from the method request.\n * @param method - RPC method name used for debugging errors.\n * @param storageSizeLimit - Maximum allowed size (in bytes) of a new state object.\n * @returns The validated method parameter object.\n */\nexport function getValidatedParams(\n params: unknown,\n method: string,\n storageSizeLimit = STORAGE_SIZE_LIMIT,\n): ManageStateParams {\n if (!isObject(params)) {\n throw rpcErrors.invalidParams({\n message: 'Expected params to be a single object.',\n });\n }\n\n const { operation, newState, encrypted } = params;\n\n if (\n !operation ||\n typeof operation !== 'string' ||\n !Object.values(ManageStateOperation).includes(\n operation as ManageStateOperation,\n )\n ) {\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid manage state \"operation\".',\n });\n }\n\n if (encrypted !== undefined && typeof encrypted !== 'boolean') {\n throw rpcErrors.invalidParams({\n message: '\"encrypted\" parameter must be a boolean if specified.',\n });\n }\n\n if (operation === ManageStateOperation.UpdateState) {\n if (!isObject(newState)) {\n throw rpcErrors.invalidParams({\n message: `Invalid ${method} \"newState\" parameter: The new state must be a plain object.`,\n });\n }\n\n let size;\n try {\n // `getJsonSize` will throw if the state is not JSON serializable.\n size = getJsonSize(newState);\n } catch {\n throw rpcErrors.invalidParams({\n message: `Invalid ${method} \"newState\" parameter: The new state must be JSON serializable.`,\n });\n }\n\n if (size > storageSizeLimit) {\n throw rpcErrors.invalidParams({\n message: `Invalid ${method} \"newState\" parameter: The new state must not exceed ${\n storageSizeLimit / 1_000_000\n } MB in size.`,\n });\n }\n }\n\n return params as ManageStateParams;\n}\n"]}
|
|
1
|
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AAiE;aAC5F,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,GAAG,gBAAgB,EAAE,CAAC;YAC5B,MAAM,SAAS,CAAC,aAAa,CAAC;gBAC5B,OAAO,EAAE,WAAW,MAAM,wDACxB,gBAAgB,GAAG,OACrB,cAAc;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAA2B,CAAC;AACrC,CAAC","sourcesContent":["import type { CryptographicFunctions } from '@metamask/key-tree';\nimport type {\n PermissionSpecificationBuilder,\n RestrictedMethodOptions,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { ManageStateParams, ManageStateResult } from '@metamask/snaps-sdk';\nimport { ManageStateOperation } from '@metamask/snaps-sdk';\nimport { STATE_ENCRYPTION_MAGIC_VALUE } from '@metamask/snaps-utils';\nimport type { Json, NonEmptyArray } from '@metamask/utils';\nimport { isObject, getJsonSize } from '@metamask/utils';\n\nimport type { MethodHooksObject } from '../utils';\nimport { deriveEntropyFromSeed } from '../utils';\n\n// The salt used for SIP-6-based entropy derivation.\nexport const STATE_ENCRYPTION_SALT = 'snap_manageState encryption';\n\nconst methodName = 'snap_manageState';\n\nexport type ManageStateMethodHooks = {\n /**\n * Waits for the extension to be unlocked.\n *\n * @returns A promise that resolves once the extension is unlocked.\n */\n getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;\n\n /**\n * A function that clears the state of the requesting Snap.\n */\n clearSnapState: (snapId: string, encrypted: boolean) => void;\n\n /**\n * A function that gets the encrypted state of the requesting Snap.\n *\n * @returns The current state of the Snap.\n */\n getSnapState: (\n snapId: string,\n encrypted: boolean,\n ) => Promise<Record<string, Json>>;\n\n /**\n * A function that updates the state of the requesting Snap.\n *\n * @param newState - The new state of the Snap.\n */\n updateSnapState: (\n snapId: string,\n newState: Record<string, Json>,\n encrypted: boolean,\n ) => Promise<void>;\n};\n\ntype ManageStateSpecificationBuilderOptions = {\n allowedCaveats?: Readonly<NonEmptyArray<string>> | null;\n methodHooks: ManageStateMethodHooks;\n};\n\ntype ManageStateSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.RestrictedMethod;\n targetName: typeof methodName;\n methodImplementation: ReturnType<typeof getManageStateImplementation>;\n allowedCaveats: Readonly<NonEmptyArray<string>> | null;\n}>;\n\n/**\n * The specification builder for the `snap_manageState` permission.\n * `snap_manageState` lets the Snap store and manage some of its state on\n * your device.\n *\n * @param options - The specification builder options.\n * @param options.allowedCaveats - The optional allowed caveats for the permission.\n * @param options.methodHooks - The RPC method hooks needed by the method implementation.\n * @returns The specification for the `snap_manageState` permission.\n */\nexport const specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n ManageStateSpecificationBuilderOptions,\n ManageStateSpecification\n> = ({\n allowedCaveats = null,\n methodHooks,\n}: ManageStateSpecificationBuilderOptions) => {\n return {\n permissionType: PermissionType.RestrictedMethod,\n targetName: methodName,\n allowedCaveats,\n methodImplementation: getManageStateImplementation(methodHooks),\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nconst methodHooks: MethodHooksObject<ManageStateMethodHooks> = {\n getUnlockPromise: true,\n clearSnapState: true,\n getSnapState: true,\n updateSnapState: true,\n};\n\nexport const manageStateBuilder = Object.freeze({\n targetName: methodName,\n specificationBuilder,\n methodHooks,\n} as const);\n\nexport const STORAGE_SIZE_LIMIT = 64_000_000; // In bytes (64 MB)\n\ntype GetEncryptionKeyArgs = {\n snapId: string;\n seed: Uint8Array;\n cryptographicFunctions?: CryptographicFunctions | undefined;\n};\n\n/**\n * Get a deterministic encryption key to use for encrypting and decrypting the\n * state.\n *\n * This key should only be used for state encryption using `snap_manageState`.\n * To get other encryption keys, a different salt can be used.\n *\n * @param args - The encryption key args.\n * @param args.snapId - The ID of the snap to get the encryption key for.\n * @param args.seed - The mnemonic seed to derive the encryption key\n * from.\n * @param args.cryptographicFunctions - The cryptographic functions to use for\n * the client.\n * @returns The state encryption key.\n */\nexport async function getEncryptionEntropy({\n seed,\n snapId,\n cryptographicFunctions,\n}: GetEncryptionKeyArgs) {\n return await deriveEntropyFromSeed({\n seed,\n input: snapId,\n salt: STATE_ENCRYPTION_SALT,\n magic: STATE_ENCRYPTION_MAGIC_VALUE,\n cryptographicFunctions,\n });\n}\n\n/**\n * Builds the method implementation for `snap_manageState`.\n *\n * @param hooks - The RPC method hooks.\n * @param hooks.clearSnapState - A function that clears the state stored for a\n * snap.\n * @param hooks.getSnapState - A function that fetches the persisted decrypted\n * state for a snap.\n * @param hooks.updateSnapState - A function that updates the state stored for a\n * snap.\n * @param hooks.getUnlockPromise - A function that resolves once the MetaMask\n * extension is unlocked and prompts the user to unlock their MetaMask if it is\n * locked.\n * @returns The method implementation which either returns `null` for a\n * successful state update/deletion or returns the decrypted state.\n * @throws If the params are invalid.\n */\nexport function getManageStateImplementation({\n getUnlockPromise,\n clearSnapState,\n getSnapState,\n updateSnapState,\n}: ManageStateMethodHooks) {\n return async function manageState(\n options: RestrictedMethodOptions<ManageStateParams>,\n ): Promise<ManageStateResult> {\n const {\n params = {},\n method,\n context: { origin },\n } = options;\n const validatedParams = getValidatedParams(params, method);\n\n // If the encrypted param is undefined or null we default to true.\n const shouldEncrypt = validatedParams.encrypted ?? true;\n\n // We only need to prompt the user when the mnemonic is needed\n // which it isn't for the clear operation or unencrypted storage.\n if (\n shouldEncrypt &&\n validatedParams.operation !== ManageStateOperation.ClearState\n ) {\n await getUnlockPromise(true);\n }\n\n switch (validatedParams.operation) {\n case ManageStateOperation.ClearState:\n clearSnapState(origin, shouldEncrypt);\n return null;\n\n case ManageStateOperation.GetState: {\n return await getSnapState(origin, shouldEncrypt);\n }\n\n case ManageStateOperation.UpdateState: {\n await updateSnapState(origin, validatedParams.newState, shouldEncrypt);\n return null;\n }\n\n default:\n throw rpcErrors.invalidParams(\n `Invalid ${method} operation: \"${\n validatedParams.operation as string\n }\"`,\n );\n }\n };\n}\n\n/**\n * Validates the manageState method `params` and returns them cast to the correct\n * type. Throws if validation fails.\n *\n * @param params - The unvalidated params object from the method request.\n * @param method - RPC method name used for debugging errors.\n * @param storageSizeLimit - Maximum allowed size (in bytes) of a new state object.\n * @returns The validated method parameter object.\n */\nexport function getValidatedParams(\n params: unknown,\n method: string,\n storageSizeLimit = STORAGE_SIZE_LIMIT,\n): ManageStateParams {\n if (!isObject(params)) {\n throw rpcErrors.invalidParams({\n message: 'Expected params to be a single object.',\n });\n }\n\n const { operation, newState, encrypted } = params;\n\n if (\n !operation ||\n typeof operation !== 'string' ||\n !Object.values(ManageStateOperation).includes(\n operation as ManageStateOperation,\n )\n ) {\n throw rpcErrors.invalidParams({\n message: 'Must specify a valid manage state \"operation\".',\n });\n }\n\n if (encrypted !== undefined && typeof encrypted !== 'boolean') {\n throw rpcErrors.invalidParams({\n message: '\"encrypted\" parameter must be a boolean if specified.',\n });\n }\n\n if (operation === ManageStateOperation.UpdateState) {\n if (!isObject(newState)) {\n throw rpcErrors.invalidParams({\n message: `Invalid ${method} \"newState\" parameter: The new state must be a plain object.`,\n });\n }\n\n let size;\n try {\n // `getJsonSize` will throw if the state is not JSON serializable.\n size = getJsonSize(newState);\n } catch {\n throw rpcErrors.invalidParams({\n message: `Invalid ${method} \"newState\" parameter: The new state must be JSON serializable.`,\n });\n }\n\n if (size > storageSizeLimit) {\n throw rpcErrors.invalidParams({\n message: `Invalid ${method} \"newState\" parameter: The new state must not exceed ${\n storageSizeLimit / 1_000_000\n } MB in size.`,\n });\n }\n }\n\n return params as ManageStateParams;\n}\n"]}
|
|
@@ -7,80 +7,81 @@ import type { NonEmptyArray } from "@metamask/utils";
|
|
|
7
7
|
import { type MethodHooksObject } from "../utils.cjs";
|
|
8
8
|
declare const methodName = "snap_notify";
|
|
9
9
|
declare const NotificationParametersStruct: import("@metamask/superstruct").Struct<{
|
|
10
|
-
type: "native";
|
|
11
10
|
message: string;
|
|
11
|
+
type: "native";
|
|
12
12
|
} | {
|
|
13
|
-
type: "inApp";
|
|
14
13
|
message: string;
|
|
15
|
-
} | {
|
|
16
14
|
type: "inApp";
|
|
15
|
+
} | {
|
|
17
16
|
message: string;
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
type: "inApp";
|
|
18
|
+
title: string;
|
|
19
|
+
content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AssetSelectorProps, "AssetSelector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressInputProps, "AddressInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ButtonProps, "Button"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CheckboxProps, "Checkbox"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FormProps, "Form"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FieldProps, "Field"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FileInputProps, "FileInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").InputProps, "Input"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").DropdownProps, "Dropdown"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SelectorProps, "Selector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AvatarProps, "Avatar"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CardProps, "Card"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ContainerProps, "Container"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SectionProps, "Section"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BannerProps, "Banner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SkeletonProps, "Skeleton"> | {
|
|
20
20
|
value: string;
|
|
21
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
21
22
|
sensitive?: boolean | undefined;
|
|
22
23
|
} | {
|
|
23
24
|
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
24
25
|
} | {
|
|
25
|
-
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
26
26
|
value: string;
|
|
27
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
27
28
|
} | {
|
|
28
|
-
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
29
29
|
value: string;
|
|
30
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
30
31
|
} | {
|
|
31
32
|
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
32
33
|
} | {
|
|
33
|
-
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
34
34
|
value: string;
|
|
35
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
35
36
|
markdown?: boolean | undefined;
|
|
36
37
|
} | {
|
|
37
|
-
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
38
38
|
value: `0x${string}`;
|
|
39
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
39
40
|
} | {
|
|
40
|
-
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
41
41
|
value: {
|
|
42
|
-
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
43
42
|
value: string;
|
|
43
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
44
44
|
} | {
|
|
45
|
-
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
46
45
|
value: string;
|
|
46
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
47
47
|
markdown?: boolean | undefined;
|
|
48
48
|
} | {
|
|
49
|
-
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
50
49
|
value: `0x${string}`;
|
|
50
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
51
51
|
};
|
|
52
|
+
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
52
53
|
label: string;
|
|
53
|
-
variant?: "default" | "
|
|
54
|
+
variant?: "default" | "critical" | "warning" | undefined;
|
|
54
55
|
} | {
|
|
55
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
56
56
|
name: string;
|
|
57
|
-
|
|
58
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
57
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
59
58
|
value?: string | undefined;
|
|
60
59
|
label?: string | undefined;
|
|
60
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
61
61
|
placeholder?: string | undefined;
|
|
62
|
+
error?: string | undefined;
|
|
62
63
|
} | {
|
|
63
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
64
64
|
value: string;
|
|
65
|
-
|
|
65
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
66
66
|
name?: string | undefined;
|
|
67
|
+
variant?: "primary" | "secondary" | undefined;
|
|
67
68
|
buttonType?: "button" | "submit" | undefined;
|
|
68
69
|
} | {
|
|
69
|
-
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
70
70
|
name: string;
|
|
71
|
+
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
71
72
|
children: ({
|
|
72
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
73
73
|
name: string;
|
|
74
|
-
|
|
75
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
74
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
76
75
|
value?: string | undefined;
|
|
77
76
|
label?: string | undefined;
|
|
77
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
78
78
|
placeholder?: string | undefined;
|
|
79
|
+
error?: string | undefined;
|
|
79
80
|
} | {
|
|
80
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
81
81
|
value: string;
|
|
82
|
-
|
|
82
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
83
83
|
name?: string | undefined;
|
|
84
|
+
variant?: "primary" | "secondary" | undefined;
|
|
84
85
|
buttonType?: "button" | "submit" | undefined;
|
|
85
86
|
})[];
|
|
86
87
|
} | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
@@ -100,86 +101,86 @@ declare const NotificationParametersStruct: import("@metamask/superstruct").Stru
|
|
|
100
101
|
children: import("@metamask/snaps-sdk/jsx").StringElement;
|
|
101
102
|
size?: "sm" | "md" | "lg" | undefined;
|
|
102
103
|
}, "Heading">;
|
|
103
|
-
title: string;
|
|
104
104
|
footerLink?: {
|
|
105
105
|
text: string;
|
|
106
106
|
href: string;
|
|
107
107
|
} | undefined;
|
|
108
108
|
}, [head: import("@metamask/superstruct").Struct<{
|
|
109
|
-
type: "inApp";
|
|
110
109
|
message: string;
|
|
110
|
+
type: "inApp";
|
|
111
111
|
}, {
|
|
112
112
|
type: import("@metamask/superstruct").Struct<"inApp", null>;
|
|
113
113
|
message: import("@metamask/superstruct").Struct<string, null>;
|
|
114
114
|
}>, import("@metamask/superstruct").Struct<{
|
|
115
|
-
type: "inApp";
|
|
116
115
|
message: string;
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
type: "inApp";
|
|
117
|
+
title: string;
|
|
118
|
+
content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AssetSelectorProps, "AssetSelector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressInputProps, "AddressInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ButtonProps, "Button"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CheckboxProps, "Checkbox"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FormProps, "Form"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FieldProps, "Field"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FileInputProps, "FileInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").InputProps, "Input"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").DropdownProps, "Dropdown"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SelectorProps, "Selector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AvatarProps, "Avatar"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CardProps, "Card"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ContainerProps, "Container"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SectionProps, "Section"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BannerProps, "Banner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SkeletonProps, "Skeleton"> | {
|
|
119
119
|
value: string;
|
|
120
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
120
121
|
sensitive?: boolean | undefined;
|
|
121
122
|
} | {
|
|
122
123
|
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
123
124
|
} | {
|
|
124
|
-
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
125
125
|
value: string;
|
|
126
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
126
127
|
} | {
|
|
127
|
-
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
128
128
|
value: string;
|
|
129
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
129
130
|
} | {
|
|
130
131
|
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
131
132
|
} | {
|
|
132
|
-
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
133
133
|
value: string;
|
|
134
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
134
135
|
markdown?: boolean | undefined;
|
|
135
136
|
} | {
|
|
136
|
-
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
137
137
|
value: `0x${string}`;
|
|
138
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
138
139
|
} | {
|
|
139
|
-
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
140
140
|
value: {
|
|
141
|
-
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
142
141
|
value: string;
|
|
142
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
143
143
|
} | {
|
|
144
|
-
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
145
144
|
value: string;
|
|
145
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
146
146
|
markdown?: boolean | undefined;
|
|
147
147
|
} | {
|
|
148
|
-
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
149
148
|
value: `0x${string}`;
|
|
149
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
150
150
|
};
|
|
151
|
+
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
151
152
|
label: string;
|
|
152
|
-
variant?: "default" | "
|
|
153
|
+
variant?: "default" | "critical" | "warning" | undefined;
|
|
153
154
|
} | {
|
|
154
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
155
155
|
name: string;
|
|
156
|
-
|
|
157
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
156
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
158
157
|
value?: string | undefined;
|
|
159
158
|
label?: string | undefined;
|
|
159
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
160
160
|
placeholder?: string | undefined;
|
|
161
|
+
error?: string | undefined;
|
|
161
162
|
} | {
|
|
162
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
163
163
|
value: string;
|
|
164
|
-
|
|
164
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
165
165
|
name?: string | undefined;
|
|
166
|
+
variant?: "primary" | "secondary" | undefined;
|
|
166
167
|
buttonType?: "button" | "submit" | undefined;
|
|
167
168
|
} | {
|
|
168
|
-
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
169
169
|
name: string;
|
|
170
|
+
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
170
171
|
children: ({
|
|
171
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
172
172
|
name: string;
|
|
173
|
-
|
|
174
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
173
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
175
174
|
value?: string | undefined;
|
|
176
175
|
label?: string | undefined;
|
|
176
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
177
177
|
placeholder?: string | undefined;
|
|
178
|
+
error?: string | undefined;
|
|
178
179
|
} | {
|
|
179
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
180
180
|
value: string;
|
|
181
|
-
|
|
181
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
182
182
|
name?: string | undefined;
|
|
183
|
+
variant?: "primary" | "secondary" | undefined;
|
|
183
184
|
buttonType?: "button" | "submit" | undefined;
|
|
184
185
|
})[];
|
|
185
186
|
} | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
@@ -199,7 +200,6 @@ declare const NotificationParametersStruct: import("@metamask/superstruct").Stru
|
|
|
199
200
|
children: import("@metamask/snaps-sdk/jsx").StringElement;
|
|
200
201
|
size?: "sm" | "md" | "lg" | undefined;
|
|
201
202
|
}, "Heading">;
|
|
202
|
-
title: string;
|
|
203
203
|
footerLink?: {
|
|
204
204
|
text: string;
|
|
205
205
|
href: string;
|
|
@@ -207,72 +207,72 @@ declare const NotificationParametersStruct: import("@metamask/superstruct").Stru
|
|
|
207
207
|
}, {
|
|
208
208
|
type: import("@metamask/superstruct").Struct<"inApp", null>;
|
|
209
209
|
message: import("@metamask/superstruct").Struct<string, null>;
|
|
210
|
-
content: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ButtonProps, "Button"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CheckboxProps, "Checkbox"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FormProps, "Form"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FieldProps, "Field"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FileInputProps, "FileInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").InputProps, "Input"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").DropdownProps, "Dropdown"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SelectorProps, "Selector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AvatarProps, "Avatar"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CardProps, "Card"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ContainerProps, "Container"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SectionProps, "Section"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BannerProps, "Banner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SkeletonProps, "Skeleton"> | {
|
|
211
|
-
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
210
|
+
content: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AssetSelectorProps, "AssetSelector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressInputProps, "AddressInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ButtonProps, "Button"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CheckboxProps, "Checkbox"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FormProps, "Form"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FieldProps, "Field"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").FileInputProps, "FileInput"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").InputProps, "Input"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").DropdownProps, "Dropdown"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SelectorProps, "Selector"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoldProps, "Bold"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ItalicProps, "Italic"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AvatarProps, "Avatar"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").AddressProps, "Address"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BoxProps, "Box"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CardProps, "Card"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").ContainerProps, "Container"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").CopyableProps, "Copyable"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").IconProps, "Icon"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").LinkProps, "Link"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").RowProps, "Row"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SectionProps, "Section"> | import("@metamask/snaps-sdk/jsx").SnapElement<Record<string, never>, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TextProps, "Text"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").TooltipProps, "Tooltip"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").BannerProps, "Banner"> | import("@metamask/snaps-sdk/jsx").SnapElement<import("@metamask/snaps-sdk/jsx").SkeletonProps, "Skeleton"> | {
|
|
212
211
|
value: string;
|
|
212
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
213
213
|
sensitive?: boolean | undefined;
|
|
214
214
|
} | {
|
|
215
215
|
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
216
216
|
} | {
|
|
217
|
-
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
218
217
|
value: string;
|
|
218
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
219
219
|
} | {
|
|
220
|
-
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
221
220
|
value: string;
|
|
221
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
222
222
|
} | {
|
|
223
223
|
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
224
224
|
} | {
|
|
225
|
-
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
226
225
|
value: string;
|
|
226
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
227
227
|
markdown?: boolean | undefined;
|
|
228
228
|
} | {
|
|
229
|
-
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
230
229
|
value: `0x${string}`;
|
|
230
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
231
231
|
} | {
|
|
232
|
-
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
233
232
|
value: {
|
|
234
|
-
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
235
233
|
value: string;
|
|
234
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
236
235
|
} | {
|
|
237
|
-
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
238
236
|
value: string;
|
|
237
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
239
238
|
markdown?: boolean | undefined;
|
|
240
239
|
} | {
|
|
241
|
-
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
242
240
|
value: `0x${string}`;
|
|
241
|
+
type: import("@metamask/snaps-sdk").NodeType.Address;
|
|
243
242
|
};
|
|
243
|
+
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
244
244
|
label: string;
|
|
245
|
-
variant?: "default" | "
|
|
245
|
+
variant?: "default" | "critical" | "warning" | undefined;
|
|
246
246
|
} | {
|
|
247
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
248
247
|
name: string;
|
|
249
|
-
|
|
250
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
248
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
251
249
|
value?: string | undefined;
|
|
252
250
|
label?: string | undefined;
|
|
251
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
253
252
|
placeholder?: string | undefined;
|
|
253
|
+
error?: string | undefined;
|
|
254
254
|
} | {
|
|
255
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
256
255
|
value: string;
|
|
257
|
-
|
|
256
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
258
257
|
name?: string | undefined;
|
|
258
|
+
variant?: "primary" | "secondary" | undefined;
|
|
259
259
|
buttonType?: "button" | "submit" | undefined;
|
|
260
260
|
} | {
|
|
261
|
-
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
262
261
|
name: string;
|
|
262
|
+
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
263
263
|
children: ({
|
|
264
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
265
264
|
name: string;
|
|
266
|
-
|
|
267
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
265
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
268
266
|
value?: string | undefined;
|
|
269
267
|
label?: string | undefined;
|
|
268
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
270
269
|
placeholder?: string | undefined;
|
|
270
|
+
error?: string | undefined;
|
|
271
271
|
} | {
|
|
272
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
273
272
|
value: string;
|
|
274
|
-
|
|
273
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
275
274
|
name?: string | undefined;
|
|
275
|
+
variant?: "primary" | "secondary" | undefined;
|
|
276
276
|
buttonType?: "button" | "submit" | undefined;
|
|
277
277
|
})[];
|
|
278
278
|
} | import("@metamask/snaps-sdk/jsx").SnapElement<{
|
|
@@ -301,8 +301,8 @@ declare const NotificationParametersStruct: import("@metamask/superstruct").Stru
|
|
|
301
301
|
text: import("@metamask/superstruct").Struct<string, null>;
|
|
302
302
|
}>;
|
|
303
303
|
}>, import("@metamask/superstruct").Struct<{
|
|
304
|
-
type: "native";
|
|
305
304
|
message: string;
|
|
305
|
+
type: "native";
|
|
306
306
|
}, {
|
|
307
307
|
type: import("@metamask/superstruct").Struct<"native", null>;
|
|
308
308
|
message: import("@metamask/superstruct").Struct<string, null>;
|