@metamask/snaps-execution-environments 6.10.0 → 6.12.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 +21 -1
- package/dist/browserify/iframe/bundle.js +5 -5
- package/dist/browserify/node-process/bundle.js +4 -4
- package/dist/browserify/node-thread/bundle.js +4 -4
- package/dist/browserify/webview/index.html +5 -5
- package/dist/browserify/worker-executor/bundle.js +5 -5
- package/dist/browserify/worker-pool/bundle.js +5 -5
- package/dist/common/BaseSnapExecutor.cjs +9 -7
- package/dist/common/BaseSnapExecutor.cjs.map +1 -1
- package/dist/common/BaseSnapExecutor.d.cts.map +1 -1
- package/dist/common/BaseSnapExecutor.d.mts.map +1 -1
- package/dist/common/BaseSnapExecutor.mjs +9 -7
- package/dist/common/BaseSnapExecutor.mjs.map +1 -1
- package/dist/common/SnapProvider.cjs +14 -0
- package/dist/common/SnapProvider.cjs.map +1 -0
- package/dist/common/SnapProvider.d.cts +6 -0
- package/dist/common/SnapProvider.d.cts.map +1 -0
- package/dist/common/SnapProvider.d.mts +6 -0
- package/dist/common/SnapProvider.d.mts.map +1 -0
- package/dist/common/SnapProvider.mjs +10 -0
- package/dist/common/SnapProvider.mjs.map +1 -0
- package/dist/common/commands.cjs +1 -0
- package/dist/common/commands.cjs.map +1 -1
- package/dist/common/commands.d.cts.map +1 -1
- package/dist/common/commands.d.mts.map +1 -1
- package/dist/common/commands.mjs +1 -0
- package/dist/common/commands.mjs.map +1 -1
- package/dist/common/utils.cjs +0 -4
- package/dist/common/utils.cjs.map +1 -1
- package/dist/common/utils.d.cts.map +1 -1
- package/dist/common/utils.d.mts.map +1 -1
- package/dist/common/utils.mjs +0 -4
- package/dist/common/utils.mjs.map +1 -1
- package/dist/iframe/IFrameSnapExecutor.mjs +1 -2
- package/dist/iframe/IFrameSnapExecutor.mjs.map +1 -1
- package/dist/node-process/ChildProcessSnapExecutor.mjs +1 -2
- package/dist/node-process/ChildProcessSnapExecutor.mjs.map +1 -1
- package/dist/node-thread/ThreadSnapExecutor.mjs +1 -2
- package/dist/node-thread/ThreadSnapExecutor.mjs.map +1 -1
- package/dist/proxy/ProxySnapExecutor.mjs +1 -2
- package/dist/proxy/ProxySnapExecutor.mjs.map +1 -1
- package/dist/webview/WebViewExecutorStream.mjs +1 -2
- package/dist/webview/WebViewExecutorStream.mjs.map +1 -1
- package/dist/webworker/executor/WebWorkerSnapExecutor.mjs +1 -2
- package/dist/webworker/executor/WebWorkerSnapExecutor.mjs.map +1 -1
- package/dist/webworker/pool/WebWorkerPool.mjs +1 -2
- package/dist/webworker/pool/WebWorkerPool.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.mjs","sourceRoot":"","sources":["../../src/common/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,8BAA8B;AACpD,OAAO,EAAE,gBAAgB,EAAE,wBAAwB;AAWnD,OAAO,EACL,qCAAqC,EACrC,mCAAmC,EACnC,oCAAoC,EACpC,mCAAmC,EACpC,yBAAqB;AAStB;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAc,EACd,OAAoB,EACpB,OAAgC;IAEhC,sEAAsE;IAEtE,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;YAC/B,qCAAqC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAEtD,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;YACnE,OAAO;gBACL,WAAW;gBACX,OAAO;gBACP,iBAAiB;aAClB,CAAC;QACJ,CAAC;QACD,KAAK,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;YAC7B,mCAAmC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAEpD,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,OAA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E,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAChC,CAAC;QAED;YACE,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,+BAA+B,CAC7C,SAA8D,EAC9D,UAAsB,EACtB,WAAuB;IAEvB,OAAO;QACL,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;QACvC,SAAS,EAAE,KAAK,IAAI,EAAE;YACpB,WAAW,EAAE,CAAC;YACd,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QAED,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;YACpD,MAAM,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;YAClD,OAAO,CACL,CAAC,MAAM,UAAU,CACf,MAAM,EACN,OAAO,EACP,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAC9C,CAAC,IAAI,IAAI,CACX,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { HandlerType } from '@metamask/snaps-utils';\nimport { assertExhaustive } from '@metamask/utils';\n\nimport type { InvokeSnap, InvokeSnapArgs } from './BaseSnapExecutor';\nimport type {\n ExecuteSnap,\n JsonRpcRequestWithoutId,\n Ping,\n PossibleLookupRequestArgs,\n SnapRpc,\n Terminate,\n} from './validation';\nimport {\n assertIsOnTransactionRequestArguments,\n assertIsOnSignatureRequestArguments,\n assertIsOnNameLookupRequestArguments,\n assertIsOnUserInputRequestArguments,\n} from './validation';\n\nexport type CommandMethodsMapping = {\n ping: Ping;\n terminate: Terminate;\n executeSnap: ExecuteSnap;\n snapRpc: SnapRpc;\n};\n\n/**\n * Formats the arguments for the given handler.\n *\n * @param origin - The origin of the request.\n * @param handler - The handler to pass the request to.\n * @param request - The request object.\n * @returns The formatted arguments.\n */\nexport function getHandlerArguments(\n origin: string,\n handler: HandlerType,\n request: JsonRpcRequestWithoutId,\n): InvokeSnapArgs {\n // `request` is already validated by the time this function is called.\n\n switch (handler) {\n case HandlerType.OnTransaction: {\n assertIsOnTransactionRequestArguments(request.params);\n\n const { transaction, chainId, transactionOrigin } = request.params;\n return {\n transaction,\n chainId,\n transactionOrigin,\n };\n }\n case HandlerType.OnSignature: {\n assertIsOnSignatureRequestArguments(request.params);\n\n const { signature, signatureOrigin } = request.params;\n return { signature, signatureOrigin };\n }\n case HandlerType.OnNameLookup: {\n assertIsOnNameLookupRequestArguments(request.params);\n\n // TS complains that domain/address are not part of the type\n // casting here as we've already validated the request args in the above step.\n const { chainId, domain, address } =\n request.params as unknown as PossibleLookupRequestArgs;\n\n return domain\n ? {\n chainId,\n domain,\n }\n : {\n chainId,\n address,\n };\n }\n case HandlerType.OnRpcRequest:\n case HandlerType.OnKeyringRequest:\n return { origin, request };\n\n case HandlerType.OnCronjob:\n return { request };\n\n case HandlerType.OnInstall:\n case HandlerType.OnUpdate:\n return { origin };\n\n case HandlerType.OnHomePage:\n case HandlerType.OnSettingsPage:\n return {};\n case HandlerType.OnUserInput: {\n assertIsOnUserInputRequestArguments(request.params);\n\n const { id, event, context } = request.params;\n return { id, event, context };\n }\n\n default:\n return assertExhaustive(handler);\n }\n}\n\n/**\n * Gets an object mapping internal, \"command\" JSON-RPC method names to their\n * implementations.\n *\n * @param startSnap - A function that starts a snap.\n * @param invokeSnap - A function that invokes the RPC method handler of a\n * snap.\n * @param onTerminate - A function that will be called when this executor is\n * terminated in order to handle cleanup tasks.\n * @returns An object containing the \"command\" method implementations.\n */\nexport function getCommandMethodImplementations(\n startSnap: (...args: Parameters<ExecuteSnap>) => Promise<void>,\n invokeSnap: InvokeSnap,\n onTerminate: () => void,\n): CommandMethodsMapping {\n return {\n ping: async () => Promise.resolve('OK'),\n terminate: async () => {\n onTerminate();\n return Promise.resolve('OK');\n },\n\n executeSnap: async (snapId, sourceCode, endowments) => {\n await startSnap(snapId, sourceCode, endowments);\n return 'OK';\n },\n\n snapRpc: async (target, handler, origin, request) => {\n return (\n (await invokeSnap(\n target,\n handler,\n getHandlerArguments(origin, handler, request),\n )) ?? null\n );\n },\n };\n}\n"]}
|
package/dist/common/utils.cjs
CHANGED
|
@@ -46,10 +46,6 @@ exports.BLOCKED_RPC_METHODS = Object.freeze([
|
|
|
46
46
|
'wallet_revokePermissions',
|
|
47
47
|
// We disallow all of these confirmations for now, since the screens are not ready for Snaps.
|
|
48
48
|
'eth_sendTransaction',
|
|
49
|
-
'eth_signTypedData',
|
|
50
|
-
'eth_signTypedData_v1',
|
|
51
|
-
'eth_signTypedData_v3',
|
|
52
|
-
'eth_signTypedData_v4',
|
|
53
49
|
'eth_decrypt',
|
|
54
50
|
'eth_getEncryptionPublicKey',
|
|
55
51
|
'wallet_addEthereumChain',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AACjD,2CAA6E;AAE7E,4CAAiC;AAEjC,4EAA4E;AAC5E,yDAAyD;AACzD,MAAM,sBAAsB,GAAG,QAAU,CAAC;AAE1C;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAChC,eAA8B,EAC9B,WAAqC;IAErC,MAAM,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC;IAC5C,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,eAAe;aACZ,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;Y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,EAAE,OAAO,CAAC,EACvD,sBAAS,CAAC,cAAc,CAAC;QACvB,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB;KACF,CAAC,CACH,CAAC;IACF,IAAA,cAAM,EACJ,CAAC,2BAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAC1C,sBAAS,CAAC,cAAc,CAAC;QACvB,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAlBD,sEAkBC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,KAAc;IACrD,6EAA6E;IAC7E,8EAA8E;IAC9E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,IAAA,mBAAW,EAAC,IAAI,CAAqB,CAAC;AAC/C,CAAC;AALD,4DAKC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,QAAiC;IAC/D,IAAI,CAAC,IAAA,gBAAQ,EAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,qEAAqE;QACrE,MAAM,IAAI,GAAG,IAAA,mBAAW,EAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,IAAI,GAAG,sBAAsB,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAZD,0CAYC","sourcesContent":["import type { RequestArguments } from '@metamask/providers';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { assert, getJsonSize, getSafeJson, isObject } from '@metamask/utils';\n\nimport { log } from '../logging';\n\n// 64 MB - we chose this number because it is the size limit for postMessage\n// between the extension and the dapp enforced by Chrome.\nconst MAX_RESPONSE_JSON_SIZE = 64_000_000;\n\n/**\n * Make proxy for Promise and handle the teardown process properly.\n * If the teardown is called in the meanwhile, Promise result will not be\n * exposed to the snap anymore and warning will be logged to the console.\n *\n * @param originalPromise - Original promise.\n * @param teardownRef - Reference containing teardown count.\n * @param teardownRef.lastTeardown - Number of the last teardown.\n * @returns New proxy promise.\n */\nexport async function withTeardown<Type>(\n originalPromise: Promise<Type>,\n teardownRef: { lastTeardown: number },\n): Promise<Type> {\n const myTeardown = teardownRef.lastTeardown;\n return new Promise<Type>((resolve, reject) => {\n originalPromise\n .then((value) => {\n if (teardownRef.lastTeardown === myTeardown) {\n resolve(value);\n } else {\n log(\n 'Late promise received after Snap finished execution. Promise will be dropped.',\n );\n }\n })\n .catch((reason) => {\n if (teardownRef.lastTeardown === myTeardown) {\n reject(reason);\n } else {\n log(\n 'Late promise received after Snap finished execution. Promise will be dropped.',\n );\n }\n });\n });\n}\n\n// We're blocking these RPC methods for v1, will revisit later.\nexport const BLOCKED_RPC_METHODS = Object.freeze([\n 'wallet_requestPermissions',\n 'wallet_revokePermissions',\n // We disallow all of these confirmations for now, since the screens are not ready for Snaps.\n 'eth_sendTransaction',\n 'eth_decrypt',\n 'eth_getEncryptionPublicKey',\n 'wallet_addEthereumChain',\n 'wallet_switchEthereumChain',\n 'wallet_watchAsset',\n 'wallet_registerOnboarding',\n 'wallet_scanQRCode',\n]);\n\n/**\n * Asserts the validity of request arguments for a snap outbound request using the `snap.request` API.\n *\n * @param args - The arguments to validate.\n */\nexport function assertSnapOutboundRequest(args: RequestArguments) {\n // Disallow any non `wallet_` or `snap_` methods for separation of concerns.\n assert(\n String.prototype.startsWith.call(args.method, 'wallet_') ||\n String.prototype.startsWith.call(args.method, 'snap_'),\n 'The global Snap API only allows RPC methods starting with `wallet_*` and `snap_*`.',\n rpcErrors.methodNotSupported,\n );\n assert(\n !BLOCKED_RPC_METHODS.includes(args.method),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n}\n\n/**\n * Asserts the validity of request arguments for an ethereum outbound request using the `ethereum.request` API.\n *\n * @param args - The arguments to validate.\n */\nexport function assertEthereumOutboundRequest(args: RequestArguments) {\n // Disallow snaps methods for separation of concerns.\n assert(\n !String.prototype.startsWith.call(args.method, 'snap_'),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n assert(\n !BLOCKED_RPC_METHODS.includes(args.method),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n}\n\n/**\n * Gets a sanitized value to be used for passing to the underlying MetaMask provider.\n *\n * @param value - An unsanitized value from a snap.\n * @returns A sanitized value ready to be passed to a MetaMask provider.\n */\nexport function sanitizeRequestArguments(value: unknown): RequestArguments {\n // Before passing to getSafeJson we run the value through JSON serialization.\n // This lets request arguments contain undefined which is normally disallowed.\n const json = JSON.parse(JSON.stringify(value));\n return getSafeJson(json) as RequestArguments;\n}\n\n/**\n * Check if the input is a valid response.\n *\n * @param response - The response.\n * @returns True if the response is valid, otherwise false.\n */\nexport function isValidResponse(response: Record<string, unknown>) {\n if (!isObject(response)) {\n return false;\n }\n\n try {\n // If the JSON is invalid this will throw and we should return false.\n const size = getJsonSize(response);\n return size < MAX_RESPONSE_JSON_SIZE;\n } catch {\n return false;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B;AAU5D;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,IAAI,EACrC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,EAC9B,WAAW,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAGD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B;AAU5D;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,IAAI,EACrC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,EAC9B,WAAW,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAGD,eAAO,MAAM,mBAAmB,mBAY9B,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,gBAAgB,QAgB/D;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,gBAAgB,QAkBnE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAKzE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAYhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B;AAU5D;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,IAAI,EACrC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,EAC9B,WAAW,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAGD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B;AAU5D;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,IAAI,EACrC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,EAC9B,WAAW,EAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAGD,eAAO,MAAM,mBAAmB,mBAY9B,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,gBAAgB,QAgB/D;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,gBAAgB,QAkBnE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAKzE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAYhE"}
|
package/dist/common/utils.mjs
CHANGED
|
@@ -42,10 +42,6 @@ export const BLOCKED_RPC_METHODS = Object.freeze([
|
|
|
42
42
|
'wallet_revokePermissions',
|
|
43
43
|
// We disallow all of these confirmations for now, since the screens are not ready for Snaps.
|
|
44
44
|
'eth_sendTransaction',
|
|
45
|
-
'eth_signTypedData',
|
|
46
|
-
'eth_signTypedData_v1',
|
|
47
|
-
'eth_signTypedData_v3',
|
|
48
|
-
'eth_signTypedData_v4',
|
|
49
45
|
'eth_decrypt',
|
|
50
46
|
'eth_getEncryptionPublicKey',
|
|
51
47
|
'wallet_addEthereumChain',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,6BAA6B;AACjD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,wBAAwB;AAE7E,OAAO,EAAE,GAAG,EAAE,uBAAmB;AAEjC,4EAA4E;AAC5E,yDAAyD;AACzD,MAAM,sBAAsB,GAAG,QAAU,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,eAA8B,EAC9B,WAAqC;IAErC,MAAM,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC;IAC5C,OAAO,IAAI,OAAO,CAAO,CAAC,O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;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,IAAsB;IAClE,qDAAqD;IACrD,MAAM,CACJ,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EACvD,SAAS,CAAC,cAAc,CAAC;QACvB,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB;KACF,CAAC,CACH,CAAC;IACF,MAAM,CACJ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAC1C,SAAS,CAAC,cAAc,CAAC;QACvB,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,6EAA6E;IAC7E,8EAA8E;IAC9E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,WAAW,CAAC,IAAI,CAAqB,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,QAAiC;IAC/D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,qEAAqE;QACrE,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,IAAI,GAAG,sBAAsB,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import type { RequestArguments } from '@metamask/providers';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport { assert, getJsonSize, getSafeJson, isObject } from '@metamask/utils';\n\nimport { log } from '../logging';\n\n// 64 MB - we chose this number because it is the size limit for postMessage\n// between the extension and the dapp enforced by Chrome.\nconst MAX_RESPONSE_JSON_SIZE = 64_000_000;\n\n/**\n * Make proxy for Promise and handle the teardown process properly.\n * If the teardown is called in the meanwhile, Promise result will not be\n * exposed to the snap anymore and warning will be logged to the console.\n *\n * @param originalPromise - Original promise.\n * @param teardownRef - Reference containing teardown count.\n * @param teardownRef.lastTeardown - Number of the last teardown.\n * @returns New proxy promise.\n */\nexport async function withTeardown<Type>(\n originalPromise: Promise<Type>,\n teardownRef: { lastTeardown: number },\n): Promise<Type> {\n const myTeardown = teardownRef.lastTeardown;\n return new Promise<Type>((resolve, reject) => {\n originalPromise\n .then((value) => {\n if (teardownRef.lastTeardown === myTeardown) {\n resolve(value);\n } else {\n log(\n 'Late promise received after Snap finished execution. Promise will be dropped.',\n );\n }\n })\n .catch((reason) => {\n if (teardownRef.lastTeardown === myTeardown) {\n reject(reason);\n } else {\n log(\n 'Late promise received after Snap finished execution. Promise will be dropped.',\n );\n }\n });\n });\n}\n\n// We're blocking these RPC methods for v1, will revisit later.\nexport const BLOCKED_RPC_METHODS = Object.freeze([\n 'wallet_requestPermissions',\n 'wallet_revokePermissions',\n // We disallow all of these confirmations for now, since the screens are not ready for Snaps.\n 'eth_sendTransaction',\n 'eth_decrypt',\n 'eth_getEncryptionPublicKey',\n 'wallet_addEthereumChain',\n 'wallet_switchEthereumChain',\n 'wallet_watchAsset',\n 'wallet_registerOnboarding',\n 'wallet_scanQRCode',\n]);\n\n/**\n * Asserts the validity of request arguments for a snap outbound request using the `snap.request` API.\n *\n * @param args - The arguments to validate.\n */\nexport function assertSnapOutboundRequest(args: RequestArguments) {\n // Disallow any non `wallet_` or `snap_` methods for separation of concerns.\n assert(\n String.prototype.startsWith.call(args.method, 'wallet_') ||\n String.prototype.startsWith.call(args.method, 'snap_'),\n 'The global Snap API only allows RPC methods starting with `wallet_*` and `snap_*`.',\n rpcErrors.methodNotSupported,\n );\n assert(\n !BLOCKED_RPC_METHODS.includes(args.method),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n}\n\n/**\n * Asserts the validity of request arguments for an ethereum outbound request using the `ethereum.request` API.\n *\n * @param args - The arguments to validate.\n */\nexport function assertEthereumOutboundRequest(args: RequestArguments) {\n // Disallow snaps methods for separation of concerns.\n assert(\n !String.prototype.startsWith.call(args.method, 'snap_'),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n assert(\n !BLOCKED_RPC_METHODS.includes(args.method),\n rpcErrors.methodNotFound({\n data: {\n method: args.method,\n },\n }),\n );\n}\n\n/**\n * Gets a sanitized value to be used for passing to the underlying MetaMask provider.\n *\n * @param value - An unsanitized value from a snap.\n * @returns A sanitized value ready to be passed to a MetaMask provider.\n */\nexport function sanitizeRequestArguments(value: unknown): RequestArguments {\n // Before passing to getSafeJson we run the value through JSON serialization.\n // This lets request arguments contain undefined which is normally disallowed.\n const json = JSON.parse(JSON.stringify(value));\n return getSafeJson(json) as RequestArguments;\n}\n\n/**\n * Check if the input is a valid response.\n *\n * @param response - The response.\n * @returns True if the response is valid, otherwise false.\n */\nexport function isValidResponse(response: Record<string, unknown>) {\n if (!isObject(response)) {\n return false;\n }\n\n try {\n // If the JSON is invalid this will throw and we should return false.\n const size = getJsonSize(response);\n return size < MAX_RESPONSE_JSON_SIZE;\n } catch {\n return false;\n }\n}\n"]}
|
|
@@ -6,8 +6,7 @@ function $importDefault(module) {
|
|
|
6
6
|
}
|
|
7
7
|
import $ObjectMultiplex from "@metamask/object-multiplex";
|
|
8
8
|
const ObjectMultiplex = $importDefault($ObjectMultiplex);
|
|
9
|
-
import
|
|
10
|
-
const { WindowPostMessageStream } = $metamaskpostmessagestream;
|
|
9
|
+
import { WindowPostMessageStream } from "@metamask/post-message-stream";
|
|
11
10
|
import { logError, SNAP_STREAM_NAMES } from "@metamask/snaps-utils";
|
|
12
11
|
import { pipeline } from "readable-stream";
|
|
13
12
|
import { BaseSnapExecutor } from "../common/BaseSnapExecutor.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IFrameSnapExecutor.mjs","sourceRoot":"","sources":["../../src/iframe/IFrameSnapExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,gBAAe,mCAAmC
|
|
1
|
+
{"version":3,"file":"IFrameSnapExecutor.mjs","sourceRoot":"","sources":["../../src/iframe/IFrameSnapExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,gBAAe,mCAAmC;;AAEzD,OAAO,EAAE,uBAAuB,EAAE,sCAAsC;AACxE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,8BAA8B;AACpE,OAAO,EAAE,QAAQ,EAAE,wBAAwB;AAE3C,OAAO,EAAE,gBAAgB,EAAE,uCAAmC;AAC9D,OAAO,EAAE,GAAG,EAAE,uBAAmB;AAEjC,MAAM,OAAO,kBAAmB,SAAQ,gBAAgB;IACtD;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CACf,SAAgC,IAAI,uBAAuB,CAAC;QAC1D,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,QAAQ;QAChB,YAAY,EAAE,IAAI,CAAC,MAAM;QACzB,YAAY,EAAE,GAAG;KAClB,CAAC;QAEF,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAErC,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACtC,IAAI,KAAK,EAAE,CAAC;gBACV,QAAQ,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;YAC5D,CAAC;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAClE,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAE/D,OAAO,IAAI,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["import ObjectMultiplex from '@metamask/object-multiplex';\nimport type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { WindowPostMessageStream } from '@metamask/post-message-stream';\nimport { logError, SNAP_STREAM_NAMES } from '@metamask/snaps-utils';\nimport { pipeline } from 'readable-stream';\n\nimport { BaseSnapExecutor } from '../common/BaseSnapExecutor';\nimport { log } from '../logging';\n\nexport class IFrameSnapExecutor extends BaseSnapExecutor {\n /**\n * Initialize the IFrameSnapExecutor. This creates a post message stream from\n * and to the parent window, for two-way communication with the iframe.\n *\n * @param stream - The stream to use for communication.\n * @returns An instance of `IFrameSnapExecutor`, with the initialized post\n * message streams.\n */\n static initialize(\n stream: BasePostMessageStream = new WindowPostMessageStream({\n name: 'child',\n target: 'parent',\n targetWindow: self.parent,\n targetOrigin: '*',\n }),\n ) {\n log('Worker: Connecting to parent.');\n\n const mux = new ObjectMultiplex();\n pipeline(stream, mux, stream, (error) => {\n if (error) {\n logError(`Parent stream failure, closing worker.`, error);\n }\n self.close();\n });\n\n const commandStream = mux.createStream(SNAP_STREAM_NAMES.COMMAND);\n const rpcStream = mux.createStream(SNAP_STREAM_NAMES.JSON_RPC);\n\n return new IFrameSnapExecutor(commandStream, rpcStream);\n }\n}\n"]}
|
|
@@ -6,8 +6,7 @@ function $importDefault(module) {
|
|
|
6
6
|
}
|
|
7
7
|
import $ObjectMultiplex from "@metamask/object-multiplex";
|
|
8
8
|
const ObjectMultiplex = $importDefault($ObjectMultiplex);
|
|
9
|
-
import
|
|
10
|
-
const { ProcessMessageStream } = $metamaskpostmessagestream;
|
|
9
|
+
import { ProcessMessageStream } from "@metamask/post-message-stream";
|
|
11
10
|
import { logError, SNAP_STREAM_NAMES } from "@metamask/snaps-utils";
|
|
12
11
|
import { pipeline } from "readable-stream";
|
|
13
12
|
import { BaseSnapExecutor } from "../common/BaseSnapExecutor.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChildProcessSnapExecutor.mjs","sourceRoot":"","sources":["../../src/node-process/ChildProcessSnapExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,gBAAe,mCAAmC
|
|
1
|
+
{"version":3,"file":"ChildProcessSnapExecutor.mjs","sourceRoot":"","sources":["../../src/node-process/ChildProcessSnapExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,gBAAe,mCAAmC;;AACzD,OAAO,EAAE,oBAAoB,EAAE,sCAAsC;AACrE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,8BAA8B;AACpE,OAAO,EAAE,QAAQ,EAAE,wBAAwB;AAE3C,OAAO,EAAE,gBAAgB,EAAE,uCAAmC;AAC9D,OAAO,EAAE,GAAG,EAAE,uBAAmB;AAEjC,MAAM,OAAO,wBAAyB,SAAQ,gBAAgB;IAC5D,MAAM,CAAC,UAAU;QACf,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAErC,MAAM,YAAY,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAChD,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,QAAQ,CAAC,YAAY,EAAE,GAAU,EAAE,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YACzD,IAAI,KAAK,EAAE,CAAC;gBACV,QAAQ,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;YAC5D,CAAC;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAClE,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAQ,CAAC;QACtE,OAAO,IAAI,wBAAwB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;CACF","sourcesContent":["import ObjectMultiplex from '@metamask/object-multiplex';\nimport { ProcessMessageStream } from '@metamask/post-message-stream';\nimport { logError, SNAP_STREAM_NAMES } from '@metamask/snaps-utils';\nimport { pipeline } from 'readable-stream';\n\nimport { BaseSnapExecutor } from '../common/BaseSnapExecutor';\nimport { log } from '../logging';\n\nexport class ChildProcessSnapExecutor extends BaseSnapExecutor {\n static initialize() {\n log('Worker: Connecting to parent.');\n\n const parentStream = new ProcessMessageStream();\n const mux = new ObjectMultiplex();\n pipeline(parentStream, mux as any, parentStream, (error) => {\n if (error) {\n logError(`Parent stream failure, closing worker.`, error);\n }\n self.close();\n });\n\n const commandStream = mux.createStream(SNAP_STREAM_NAMES.COMMAND);\n const rpcStream = mux.createStream(SNAP_STREAM_NAMES.JSON_RPC) as any;\n return new ChildProcessSnapExecutor(commandStream, rpcStream);\n }\n}\n"]}
|
|
@@ -6,8 +6,7 @@ function $importDefault(module) {
|
|
|
6
6
|
}
|
|
7
7
|
import $ObjectMultiplex from "@metamask/object-multiplex";
|
|
8
8
|
const ObjectMultiplex = $importDefault($ObjectMultiplex);
|
|
9
|
-
import
|
|
10
|
-
const { ThreadMessageStream } = $metamaskpostmessagestream;
|
|
9
|
+
import { ThreadMessageStream } from "@metamask/post-message-stream";
|
|
11
10
|
import { logError, SNAP_STREAM_NAMES } from "@metamask/snaps-utils";
|
|
12
11
|
import { pipeline } from "readable-stream";
|
|
13
12
|
import { BaseSnapExecutor } from "../common/BaseSnapExecutor.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadSnapExecutor.mjs","sourceRoot":"","sources":["../../src/node-thread/ThreadSnapExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,gBAAe,mCAAmC
|
|
1
|
+
{"version":3,"file":"ThreadSnapExecutor.mjs","sourceRoot":"","sources":["../../src/node-thread/ThreadSnapExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,gBAAe,mCAAmC;;AACzD,OAAO,EAAE,mBAAmB,EAAE,sCAAsC;AACpE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,8BAA8B;AACpE,OAAO,EAAE,QAAQ,EAAE,wBAAwB;AAE3C,OAAO,EAAE,gBAAgB,EAAE,uCAAmC;AAC9D,OAAO,EAAE,GAAG,EAAE,uBAAmB;AAEjC,MAAM,OAAO,kBAAmB,SAAQ,gBAAgB;IACtD,MAAM,CAAC,UAAU;QACf,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAErC,MAAM,YAAY,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC/C,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,QAAQ,CAAC,YAAY,EAAE,GAAU,EAAE,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YACzD,IAAI,KAAK,EAAE,CAAC;gBACV,QAAQ,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;YAC5D,CAAC;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAClE,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAQ,CAAC;QACtE,OAAO,IAAI,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["import ObjectMultiplex from '@metamask/object-multiplex';\nimport { ThreadMessageStream } from '@metamask/post-message-stream';\nimport { logError, SNAP_STREAM_NAMES } from '@metamask/snaps-utils';\nimport { pipeline } from 'readable-stream';\n\nimport { BaseSnapExecutor } from '../common/BaseSnapExecutor';\nimport { log } from '../logging';\n\nexport class ThreadSnapExecutor extends BaseSnapExecutor {\n static initialize() {\n log('Worker: Connecting to parent.');\n\n const parentStream = new ThreadMessageStream();\n const mux = new ObjectMultiplex();\n pipeline(parentStream, mux as any, parentStream, (error) => {\n if (error) {\n logError(`Parent stream failure, closing worker.`, error);\n }\n self.close();\n });\n\n const commandStream = mux.createStream(SNAP_STREAM_NAMES.COMMAND);\n const rpcStream = mux.createStream(SNAP_STREAM_NAMES.JSON_RPC) as any;\n return new ThreadSnapExecutor(commandStream, rpcStream);\n }\n}\n"]}
|
|
@@ -10,8 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _ProxySnapExecutor_instances, _ProxySnapExecutor_stream, _ProxySnapExecutor_frameUrl, _ProxySnapExecutor_onData, _ProxySnapExecutor_initializeJob, _ProxySnapExecutor_terminateJob;
|
|
13
|
-
import
|
|
14
|
-
const { WindowPostMessageStream } = $metamaskpostmessagestream;
|
|
13
|
+
import { WindowPostMessageStream } from "@metamask/post-message-stream";
|
|
15
14
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
16
15
|
import packageJson from "@metamask/snaps-execution-environments/package.json" with { type: "json" };
|
|
17
16
|
import { createWindow, logError } from "@metamask/snaps-utils";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxySnapExecutor.mjs","sourceRoot":"","sources":["../../src/proxy/ProxySnapExecutor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProxySnapExecutor.mjs","sourceRoot":"","sources":["../../src/proxy/ProxySnapExecutor.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,uBAAuB,EAAE,sCAAsC;AACxE,6DAA6D;AAC7D,OAAO,WAAW,kFAA4D;AAC9E,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,8BAA8B;AAE/D,OAAO,EAAE,MAAM,EAAE,wBAAwB;AAQzC,MAAM,UAAU,GAAG,wCAAwC,WAAW,CAAC,OAAO,aAAa,CAAC;AAE5F;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,iBAAiB;IAO5B;;;;;;;OAOG;IACH,MAAM,CAAC,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;;;;GAKG;AACH,KAAK,2CAAgB,KAAa;IAChC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,EAAE,GAAG,EAAE,uBAAA,IAAI,mCAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACtE,MAAM,SAAS,GAAG,IAAI,uBAAuB,CAAC;QAC5C,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,OAAO;QACf,YAAY,EAAE,MAAM,EAAE,2BAA2B;QACjD,YAAY,EAAE,GAAG;KAClB,CAAC,CAAC;IAEH,yEAAyE;IACzE,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAC5B,uBAAA,IAAI,iCAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC5D,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC,6EAQa,KAAa;IACzB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,QAAQ,KAAK,cAAc,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,EAAE,mBAAmB,KAAK,cAAc,CAAC,CAAC;IAEvD,MAAM,CAAC,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { WindowPostMessageStream } from '@metamask/post-message-stream';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport packageJson from '@metamask/snaps-execution-environments/package.json';\nimport { createWindow, logError } from '@metamask/snaps-utils';\nimport type { JsonRpcRequest } from '@metamask/utils';\nimport { assert } from '@metamask/utils';\n\ntype ExecutorJob = {\n id: string;\n window: Window;\n stream: WindowPostMessageStream;\n};\n\nconst IFRAME_URL = `https://execution.metamask.io/iframe/${packageJson.version}/index.html`;\n\n/**\n * A \"proxy\" snap executor that uses a level of indirection to execute snaps.\n *\n * Useful for multiple execution environments.\n *\n * This is not a traditional snap executor, as it does not execute snaps itself.\n * Instead, it creates an iframe window for each snap execution, and sends the\n * snap execution request to the iframe window. The iframe window is responsible\n * for executing the snap.\n *\n * This executor is persisted between snap executions. The executor essentially\n * acts as a proxy between the client and the iframe execution environment.\n */\nexport class ProxySnapExecutor {\n readonly #stream: BasePostMessageStream;\n\n readonly #frameUrl: string;\n\n readonly jobs: Record<string, ExecutorJob> = {};\n\n /**\n * Initialize the executor with the given stream. This is a wrapper around the\n * constructor.\n *\n * @param stream - The stream to use for communication.\n * @param frameUrl - An optional URL for the iframe to use.\n * @returns The initialized executor.\n */\n static initialize(stream: BasePostMessageStream, frameUrl = IFRAME_URL) {\n return new ProxySnapExecutor(stream, frameUrl);\n }\n\n constructor(stream: BasePostMessageStream, frameUrl: string) {\n this.#stream = stream;\n this.#stream.on('data', this.#onData.bind(this));\n this.#frameUrl = frameUrl;\n }\n\n /**\n * Handle an incoming message from a `ProxyExecutionService`. This\n * assumes that the message contains a `jobId` property, and a JSON-RPC\n * request in the `data` property.\n *\n * @param data - The message data.\n * @param data.data - The JSON-RPC request.\n * @param data.jobId - The job ID.\n */\n #onData(data: { data: JsonRpcRequest; jobId: string }) {\n const { jobId, data: request } = data;\n\n if (!this.jobs[jobId]) {\n // This ensures that a job is initialized before it is used. To avoid\n // code duplication, we call the `#onData` method again, which will\n // run the rest of the logic after initialization.\n this.#initializeJob(jobId)\n .then(() => {\n this.#onData(data);\n })\n .catch((error) => {\n logError('[Worker] Error initializing job:', error);\n });\n\n return;\n }\n\n // This is a method specific to the `OffscreenSnapExecutor`, as the service\n // itself does not have access to the iframes directly.\n if (request.method === 'terminateJob') {\n this.#terminateJob(jobId);\n return;\n }\n\n this.jobs[jobId].stream.write(request);\n }\n\n /**\n * Create a new iframe and set up a stream to communicate with it.\n *\n * @param jobId - The job ID.\n * @returns The executor job object.\n */\n async #initializeJob(jobId: string): Promise<ExecutorJob> {\n const window = await createWindow({ uri: this.#frameUrl, id: jobId });\n const jobStream = new WindowPostMessageStream({\n name: 'parent',\n target: 'child',\n targetWindow: window, // iframe's internal window\n targetOrigin: '*',\n });\n\n // Write messages from the iframe to the parent, wrapped with the job ID.\n jobStream.on('data', (data) => {\n this.#stream.write({ data, jobId });\n });\n\n this.jobs[jobId] = { id: jobId, window, stream: jobStream };\n return this.jobs[jobId];\n }\n\n /**\n * Terminate the job with the given ID. This will close the iframe and delete\n * the job from the internal job map.\n *\n * @param jobId - The job ID.\n */\n #terminateJob(jobId: string) {\n assert(this.jobs[jobId], `Job \"${jobId}\" not found.`);\n\n const iframe = document.getElementById(jobId);\n assert(iframe, `Iframe with ID \"${jobId}\" not found.`);\n\n iframe.remove();\n this.jobs[jobId].stream.destroy();\n delete this.jobs[jobId];\n }\n}\n"]}
|
|
@@ -10,8 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _WebViewExecutorStream_name, _WebViewExecutorStream_target, _WebViewExecutorStream_targetWindow;
|
|
13
|
-
import
|
|
14
|
-
const { BasePostMessageStream } = $metamaskpostmessagestream;
|
|
13
|
+
import { BasePostMessageStream } from "@metamask/post-message-stream";
|
|
15
14
|
import { isValidStreamMessage } from "@metamask/post-message-stream/dist/utils.js";
|
|
16
15
|
import { base64ToBytes, bytesToString } from "@metamask/utils";
|
|
17
16
|
export class WebViewExecutorStream extends BasePostMessageStream {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebViewExecutorStream.mjs","sourceRoot":"","sources":["../../src/webview/WebViewExecutorStream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebViewExecutorStream.mjs","sourceRoot":"","sources":["../../src/webview/WebViewExecutorStream.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,qBAAqB,EAAE,sCAAsC;AACtE,OAAO,EAAE,oBAAoB,EAAE,oDAAiD;AAChF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,wBAAwB;AAQ/D,MAAM,OAAO,qBAAsB,SAAQ,qBAAqB;IAO9D;;;;;;;;;;;;;OAaG;IAEH,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAA6B;QACnE,KAAK,EAAE,CAAC;QAtBV,8CAAM;QAEN,gDAAQ;QAER,sDAAc;QAoBZ,uBAAA,IAAI,+BAAS,IAAI,MAAA,CAAC;QAClB,uBAAA,IAAI,iCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,uCAAiB,YAAY,MAAA,CAAC;QAElC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7C,gCAAgC;QAChC,6DAA6D;QAC7D,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAiB,EAAE,KAAK,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED;;;OAGG;IAEO,YAAY,CAAC,IAAa;QAClC,uBAAA,IAAI,2CAAc,CAAC,WAAW,CAC5B,IAAI,CAAC,SAAS,CAAC;YACb,MAAM,EAAE,uBAAA,IAAI,qCAAQ;YACpB,IAAI;SACL,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,UAAU,CAAC,KAAuB;QACxC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;QAEjD,gEAAgE;QAChE,0CAA0C;QAC1C,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,uBAAA,IAAI,mCAAM,EAAE,CAAC;YACpE,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,gCAAgC;QAChC,6DAA6D;QAC7D,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAiB,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;CACF","sourcesContent":["import type { PostMessageEvent } from '@metamask/post-message-stream';\nimport { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { isValidStreamMessage } from '@metamask/post-message-stream/dist/utils';\nimport { base64ToBytes, bytesToString } from '@metamask/utils';\n\ntype WebViewExecutorStreamArgs = {\n name: string;\n target: string;\n targetWindow: Window['ReactNativeWebView'];\n};\n\nexport class WebViewExecutorStream extends BasePostMessageStream {\n #name;\n\n #target;\n\n #targetWindow;\n\n /**\n * A special post-message-stream to be used by the WebView executor.\n *\n * This stream is different in a few ways:\n * - It expects data to be base64 encoded\n * - It stringifies the data it posts\n * - It does less validation of origins\n *\n * @param args - Options bag.\n * @param args.name - The name of the stream. Used to differentiate between\n * multiple streams sharing the same window object. child:WebView\n * @param args.target - The name of the stream to exchange messages with. parent:rnside\n * @param args.targetWindow - The window object of the target stream.\n */\n\n constructor({ name, target, targetWindow }: WebViewExecutorStreamArgs) {\n super();\n\n this.#name = name;\n this.#target = target;\n this.#targetWindow = targetWindow;\n\n this._onMessage = this._onMessage.bind(this);\n\n // This method is already bound.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n window.addEventListener('message', this._onMessage as any, false);\n\n this._handshake();\n }\n\n /**\n * Webview needs to receive strings only on postMessage. That's the main difference between this and the original window post message stream.\n * Reference: https://github.com/react-native-webview/react-native-webview/blob/master/docs/Guide.md?plain=1#L471\n */\n\n protected _postMessage(data: unknown): void {\n this.#targetWindow.postMessage(\n JSON.stringify({\n target: this.#target,\n data,\n }),\n );\n }\n\n private _onMessage(event: PostMessageEvent): void {\n if (typeof event.data !== 'string') {\n return;\n }\n\n const bytes = base64ToBytes(event.data);\n const message = JSON.parse(bytesToString(bytes));\n\n // Notice that we don't check targetWindow or targetOrigin here.\n // This doesn't seem possible to do in RN.\n if (!isValidStreamMessage(message) || message.target !== this.#name) {\n return;\n }\n\n this._onData(message.data);\n }\n\n _destroy() {\n // This method is already bound.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n window.removeEventListener('message', this._onMessage as any, false);\n }\n}\n"]}
|
|
@@ -6,8 +6,7 @@ function $importDefault(module) {
|
|
|
6
6
|
}
|
|
7
7
|
import $ObjectMultiplex from "@metamask/object-multiplex";
|
|
8
8
|
const ObjectMultiplex = $importDefault($ObjectMultiplex);
|
|
9
|
-
import
|
|
10
|
-
const { WebWorkerPostMessageStream } = $metamaskpostmessagestream;
|
|
9
|
+
import { WebWorkerPostMessageStream } from "@metamask/post-message-stream";
|
|
11
10
|
import { logError, SNAP_STREAM_NAMES } from "@metamask/snaps-utils";
|
|
12
11
|
import { pipeline } from "readable-stream";
|
|
13
12
|
import { BaseSnapExecutor } from "../../common/BaseSnapExecutor.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebWorkerSnapExecutor.mjs","sourceRoot":"","sources":["../../../src/webworker/executor/WebWorkerSnapExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,gBAAe,mCAAmC
|
|
1
|
+
{"version":3,"file":"WebWorkerSnapExecutor.mjs","sourceRoot":"","sources":["../../../src/webworker/executor/WebWorkerSnapExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,gBAAe,mCAAmC;;AAEzD,OAAO,EAAE,0BAA0B,EAAE,sCAAsC;AAC3E,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,8BAA8B;AACpE,OAAO,EAAE,QAAQ,EAAE,wBAAwB;AAE3C,OAAO,EAAE,gBAAgB,EAAE,0CAAsC;AACjE,OAAO,EAAE,GAAG,EAAE,0BAAsB;AAEpC,MAAM,OAAO,qBAAsB,SAAQ,gBAAgB;IACzD;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CACf,SAAgC,IAAI,0BAA0B,EAAE;QAEhE,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAErC,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACtC,IAAI,KAAK,EAAE,CAAC;gBACV,QAAQ,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;YAC5D,CAAC;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAClE,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAE/D,OAAO,IAAI,qBAAqB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import ObjectMultiplex from '@metamask/object-multiplex';\nimport type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { WebWorkerPostMessageStream } from '@metamask/post-message-stream';\nimport { logError, SNAP_STREAM_NAMES } from '@metamask/snaps-utils';\nimport { pipeline } from 'readable-stream';\n\nimport { BaseSnapExecutor } from '../../common/BaseSnapExecutor';\nimport { log } from '../../logging';\n\nexport class WebWorkerSnapExecutor extends BaseSnapExecutor {\n /**\n * Initialize the WebWorkerSnapExecutor. This creates a post message stream\n * from and to the parent window, for two-way communication with the iframe.\n *\n * @param stream - The stream to use for communication.\n * @returns An instance of `WebWorkerSnapExecutor`, with the initialized post\n * message streams.\n */\n static initialize(\n stream: BasePostMessageStream = new WebWorkerPostMessageStream(),\n ) {\n log('Worker: Connecting to parent.');\n\n const mux = new ObjectMultiplex();\n pipeline(stream, mux, stream, (error) => {\n if (error) {\n logError(`Parent stream failure, closing worker.`, error);\n }\n self.close();\n });\n\n const commandStream = mux.createStream(SNAP_STREAM_NAMES.COMMAND);\n const rpcStream = mux.createStream(SNAP_STREAM_NAMES.JSON_RPC);\n\n return new WebWorkerSnapExecutor(commandStream, rpcStream);\n }\n}\n"]}
|
|
@@ -10,8 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _WebWorkerPool_instances, _WebWorkerPool_poolSize, _WebWorkerPool_stream, _WebWorkerPool_url, _WebWorkerPool_workerSourceURL, _WebWorkerPool_onData, _WebWorkerPool_initializeJob, _WebWorkerPool_terminateJob, _WebWorkerPool_getWorker, _WebWorkerPool_updatePool, _WebWorkerPool_createWorker, _WebWorkerPool_getWorkerURL;
|
|
13
|
-
import
|
|
14
|
-
const { WebWorkerParentPostMessageStream, WindowPostMessageStream } = $metamaskpostmessagestream;
|
|
13
|
+
import { WebWorkerParentPostMessageStream, WindowPostMessageStream } from "@metamask/post-message-stream";
|
|
15
14
|
import { logError } from "@metamask/snaps-utils";
|
|
16
15
|
import { assert } from "@metamask/utils";
|
|
17
16
|
import { nanoid } from "nanoid/non-secure";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebWorkerPool.mjs","sourceRoot":"","sources":["../../../src/webworker/pool/WebWorkerPool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"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B,CAAC;QAC1C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,KAAK;IACH,OAAO,IAAI,MAAM,CAAC,MAAM,uBAAA,IAAI,6DAAc,MAAlB,IAAI,CAAgB,EAAE;QAC5C,IAAI,EAAE,UAAU,MAAM,EAAE,EAAE;KAC3B,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,KAAK;IACH,IAAI,uBAAA,IAAI,sCAAiB,EAAE,CAAC;QAC1B,OAAO,uBAAA,IAAI,sCAAiB,CAAC;IAC/B,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,uBAAA,IAAI,0BAAK,CAAC;SAChC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;SACzC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvC,uBAAA,IAAI,kCAAoB,IAAI,MAAA,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport {\n WebWorkerParentPostMessageStream,\n WindowPostMessageStream,\n} from '@metamask/post-message-stream';\nimport { logError } from '@metamask/snaps-utils';\nimport type { JsonRpcRequest } from '@metamask/utils';\nimport { assert } from '@metamask/utils';\nimport { nanoid } from 'nanoid/non-secure';\n\ntype ExecutorJob = {\n id: string;\n worker: Worker;\n stream: WebWorkerParentPostMessageStream;\n};\n\n/**\n * A snap executor using the WebWorker API.\n *\n * This is not a traditional snap executor, as it does not execute snaps itself.\n * Instead, it creates a pool of webworkers for each snap execution, and sends\n * the snap execution request to the webworker. The webworker is responsible for\n * executing the snap.\n */\nexport class WebWorkerPool {\n readonly #poolSize;\n\n readonly #stream: BasePostMessageStream;\n\n readonly #url: string;\n\n readonly pool: Worker[] = [];\n\n readonly jobs: Map<string, ExecutorJob> = new Map();\n\n #workerSourceURL?: string;\n\n /* istanbul ignore next - Constructor arguments. */\n static initialize(\n stream: BasePostMessageStream = new WindowPostMessageStream({\n name: 'child',\n target: 'parent',\n targetWindow: self.parent,\n targetOrigin: '*',\n }),\n url = '../executor/bundle.js',\n poolSize?: number,\n ) {\n return new WebWorkerPool(stream, url, poolSize);\n }\n\n constructor(stream: BasePostMessageStream, url: string, poolSize = 3) {\n this.#stream = stream;\n this.#url = url;\n this.#poolSize = poolSize;\n\n this.#stream.on('data', this.#onData.bind(this));\n }\n\n /**\n * Handle an incoming message from the `WebWorkerExecutionService`. This\n * assumes that the message contains a `jobId` property, and a JSON-RPC\n * request in the `data` property.\n *\n * @param data - The message data.\n * @param data.data - The JSON-RPC request.\n * @param data.jobId - The job ID.\n */\n #onData(data: { data: JsonRpcRequest; jobId: string }) {\n const { jobId, data: request } = data;\n\n const job = this.jobs.get(jobId);\n if (!job) {\n // This ensures that a job is initialized before it is used. To avoid\n // code duplication, we call the `#onData` method again, which will\n // run the rest of the logic after initialization.\n this.#initializeJob(jobId)\n .then(() => {\n this.#onData(data);\n })\n .catch((error) => {\n logError('[Worker] Error initializing job:', error.toString());\n\n this.#stream.write({\n jobId,\n data: {\n name: 'command',\n data: {\n jsonrpc: '2.0',\n id: request.id ?? null,\n error: {\n code: -32000,\n message: 'Internal error',\n },\n },\n },\n });\n });\n\n return;\n }\n\n // This is a method specific to the `WebWorkerPool`, as the service itself\n // does not have access to the workers directly.\n if (request.method === 'terminateJob') {\n this.#terminateJob(jobId);\n return;\n }\n\n job.stream.write(request);\n }\n\n /**\n * Create a new worker and set up a stream to communicate with it.\n *\n * @param jobId - The job ID.\n * @returns The job.\n */\n async #initializeJob(jobId: string): Promise<ExecutorJob> {\n const worker = await this.#getWorker();\n const jobStream = new WebWorkerParentPostMessageStream({\n worker,\n });\n\n // Write messages from the worker to the parent, wrapped with the job ID.\n jobStream.on('data', (data) => {\n this.#stream.write({ data, jobId });\n });\n\n const job = { id: jobId, worker, stream: jobStream };\n this.jobs.set(jobId, job);\n return job;\n }\n\n /**\n * Terminate the job with the given ID. This will close the worker and delete\n * the job from the internal job map.\n *\n * @param jobId - The job ID.\n */\n #terminateJob(jobId: string) {\n const job = this.jobs.get(jobId);\n assert(job, `Job \"${jobId}\" not found.`);\n\n job.stream.destroy();\n job.worker.terminate();\n\n this.jobs.delete(jobId);\n }\n\n /**\n * Get a worker from the pool. A new worker will be created automatically.\n *\n * @returns The worker.\n */\n async #getWorker() {\n // Lazily create the pool of workers.\n if (this.pool.length === 0) {\n await this.#updatePool();\n }\n\n const worker = this.pool.shift();\n assert(worker, 'Worker not found.');\n\n await this.#updatePool();\n\n return worker;\n }\n\n /**\n * Update the pool of workers. This will create new workers if the pool is\n * below the minimum size.\n */\n async #updatePool() {\n while (this.pool.length < this.#poolSize) {\n const worker = await this.#createWorker();\n this.pool.push(worker);\n }\n }\n\n /**\n * Create a new worker. This will fetch the worker source if it has not\n * already been fetched.\n *\n * @returns The worker.\n */\n async #createWorker() {\n return new Worker(await this.#getWorkerURL(), {\n name: `worker-${nanoid()}`,\n });\n }\n\n /**\n * Get the URL of the worker source. This will fetch the worker source if it\n * has not already been fetched.\n *\n * @returns The worker source URL, as a `blob:` URL.\n */\n async #getWorkerURL() {\n if (this.#workerSourceURL) {\n return this.#workerSourceURL;\n }\n\n const blob = await fetch(this.#url)\n .then(async (response) => response.blob())\n .then(URL.createObjectURL.bind(URL));\n\n this.#workerSourceURL = blob;\n return blob;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-execution-environments",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.12.0",
|
|
4
4
|
"description": "Snap sandbox environments for executing SES javascript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"test:watch": "jest --watch"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@metamask/json-rpc-engine": "^10.0.
|
|
68
|
-
"@metamask/object-multiplex": "^2.
|
|
69
|
-
"@metamask/post-message-stream": "^
|
|
70
|
-
"@metamask/providers": "^18.
|
|
71
|
-
"@metamask/rpc-errors": "^7.0.
|
|
72
|
-
"@metamask/snaps-sdk": "^6.
|
|
73
|
-
"@metamask/snaps-utils": "^8.
|
|
67
|
+
"@metamask/json-rpc-engine": "^10.0.2",
|
|
68
|
+
"@metamask/object-multiplex": "^2.1.0",
|
|
69
|
+
"@metamask/post-message-stream": "^9.0.0",
|
|
70
|
+
"@metamask/providers": "^18.3.1",
|
|
71
|
+
"@metamask/rpc-errors": "^7.0.2",
|
|
72
|
+
"@metamask/snaps-sdk": "^6.15.0",
|
|
73
|
+
"@metamask/snaps-utils": "^8.8.0",
|
|
74
74
|
"@metamask/superstruct": "^3.1.0",
|
|
75
|
-
"@metamask/utils": "^
|
|
75
|
+
"@metamask/utils": "^11.0.1",
|
|
76
76
|
"nanoid": "^3.1.31",
|
|
77
77
|
"readable-stream": "^3.6.2"
|
|
78
78
|
},
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@metamask/eslint-config-typescript": "^12.1.0",
|
|
93
93
|
"@swc/core": "1.3.78",
|
|
94
94
|
"@swc/jest": "^0.2.26",
|
|
95
|
-
"@ts-bridge/cli": "^0.6.
|
|
95
|
+
"@ts-bridge/cli": "^0.6.1",
|
|
96
96
|
"@types/express": "^4.17.17",
|
|
97
97
|
"@types/jest": "^27.5.1",
|
|
98
98
|
"@types/node": "18.14.2",
|