Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING: Replace Buffer with Typed Arrays #878

Merged
merged 1 commit into from Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/execution-environments/jest.config.js
Expand Up @@ -7,9 +7,9 @@ module.exports = {
coverageThreshold: {
global: {
branches: 82.88,
functions: 92.53,
lines: 85.97,
statements: 86.15,
functions: 92.48,
lines: 85.84,
statements: 86.02,
},
},
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
Expand Down

This file was deleted.

16 changes: 0 additions & 16 deletions packages/execution-environments/src/common/endowments/buffer.ts

This file was deleted.

@@ -1,7 +1,6 @@
import { SnapProvider } from '@metamask/snap-types';
import { hasProperty } from '@metamask/utils';
import { rootRealmGlobal } from '../globalObject';
import buffer from './buffer';
import interval from './interval';
import network from './network';
import timeout from './timeout';
Expand All @@ -25,7 +24,7 @@ type EndowmentFactoryResult = {
* the same factory function, but we only call each factory once for each snap.
* See {@link createEndowments} for details.
*/
const endowmentFactories = [buffer, timeout, interval, network, crypto].reduce(
const endowmentFactories = [timeout, interval, network, crypto].reduce(
(factories, builder) => {
builder.names.forEach((name) => {
factories.set(name, builder.factory);
Expand Down
14 changes: 13 additions & 1 deletion packages/utils/src/default-endowments.ts
Expand Up @@ -5,7 +5,6 @@ export const DEFAULT_ENDOWMENTS: readonly string[] = Object.freeze([
'atob',
'btoa',
'BigInt',
'Buffer', // The Node.js Buffer. Polyfilled in browser environments.
'console',
'crypto',
'Date',
Expand All @@ -19,6 +18,19 @@ export const DEFAULT_ENDOWMENTS: readonly string[] = Object.freeze([
'WebAssembly',
'setInterval',
'clearInterval',
'Int8Array',
'Uint8Array',
'Uint8ClampedArray',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array',
'BigInt64Array',
'BigUint64Array',
'DataView',
'ArrayBuffer',
// Used by fetch, but also as API for some packages that don't do network connections
// https://github.com/MetaMask/snaps-monorepo/issues/662
// https://github.com/MetaMask/snaps-monorepo/discussions/678
Expand Down