diff --git a/packages/snaps-cli/tsconfig.json b/packages/snaps-cli/tsconfig.json index b2d6b082b1..526029de4f 100644 --- a/packages/snaps-cli/tsconfig.json +++ b/packages/snaps-cli/tsconfig.json @@ -7,7 +7,6 @@ "references": [ { "path": "../snaps-utils" }, { "path": "../snaps-browserify-plugin" }, - { "path": "../snaps-types" }, { "path": "../snaps-webpack-plugin" } ] } diff --git a/packages/snaps-sdk/src/index.ts b/packages/snaps-sdk/src/index.ts index f3ce97e87c..aa5662b75f 100644 --- a/packages/snaps-sdk/src/index.ts +++ b/packages/snaps-sdk/src/index.ts @@ -8,5 +8,13 @@ export { SNAP_ERROR_MESSAGE, } from './internals'; +// Re-exported from `@metamask/utils` for convenience. +export type { + Json, + JsonRpcError, + JsonRpcRequest, + JsonRpcParams, +} from '@metamask/utils'; + export * from './errors'; export * from './types'; diff --git a/packages/snaps-types/.depcheckrc.json b/packages/snaps-types/.depcheckrc.json deleted file mode 100644 index 15d64e734b..0000000000 --- a/packages/snaps-types/.depcheckrc.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "ignore-patterns": ["dist", "coverage"], - "ignores": [ - "@lavamoat/allow-scripts", - "@lavamoat/preinstall-always-fail", - "@metamask/auto-changelog", - "@metamask/eslint-*", - "@types/*", - "@typescript-eslint/*", - "eslint-config-*", - "eslint-plugin-*", - "prettier-plugin-packagejson", - "ts-node", - "typedoc", - "typescript" - ] -} diff --git a/packages/snaps-types/.eslintrc.js b/packages/snaps-types/.eslintrc.js deleted file mode 100644 index cb13062a8f..0000000000 --- a/packages/snaps-types/.eslintrc.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - extends: ['../../.eslintrc.js'], - - ignorePatterns: ['**/*.d.ts'], - - parserOptions: { - tsconfigRootDir: __dirname, - }, -}; diff --git a/packages/snaps-types/CHANGELOG.md b/packages/snaps-types/CHANGELOG.md deleted file mode 100644 index b3ba229fe9..0000000000 --- a/packages/snaps-types/CHANGELOG.md +++ /dev/null @@ -1,65 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [3.1.0] -### Added -- Add types for `OnHomePage` export ([#1918](https://github.com/MetaMask/snaps/pull/1918)) - -## [3.0.1] -### Changed -- Update multiple MetaMask dependencies ([#1841](https://github.com/MetaMask/snaps/pull/1841)) - -## [3.0.0] -### Added -- Add keyring export and endowment ([#1787](https://github.com/MetaMask/snaps/pull/1787)) - -### Changed -- **BREAKING:** Bump minimum Node.js version to `^18.16.0` ([#1741](https://github.com/MetaMask/snaps/pull/1741)) - -## [2.0.0] -### Changed -- Initial stable release from main branch ([#1757](https://github.com/MetaMask/snaps/pull/1757)) - -## [0.38.3-flask.1] -### Added -- Add `onNameLookup` types ([#1759](https://github.com/MetaMask/snaps/pull/1759)) - -### Changed -- Bump `metamask/utils` and `metamask/snaps-registry` ([#1738](https://github.com/MetaMask/snaps/pull/1738), [#1694](https://github.com/MetaMask/snaps/pull/1694)) - -## [0.38.2-flask.1] -### Fixed -- Remove unused dependencies ([#1680](https://github.com/MetaMask/snaps/pull/1680)) - -## [0.38.1-flask.1] -### Changed -- Update transaction insights response and add severity level enum ([#1653](https://github.com/MetaMask/snaps/pull/1653)) - - Snaps are now able to specify a `severity` alongside their insights. - - See [SIP-11](https://metamask.github.io/SIPs/SIPS/sip-11) for more information. - -## [0.38.0-flask.1] -### Added -- Add `onInstall` and `onUpdate` lifecycle hooks ([#1643](https://github.com/MetaMask/snaps/pull/1643)) - - This package now exports the `OnInstallHandler` and `OnUpdateHandler` types. - -## [0.37.2-flask.1] -### Changed -- Release package independently ([#1600](https://github.com/MetaMask/snaps/pull/1600)) - - The version of the package no longer needs to match the version of all other - MetaMask Snaps packages. - -[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@3.1.0...HEAD -[3.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@3.0.1...@metamask/snaps-types@3.1.0 -[3.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@3.0.0...@metamask/snaps-types@3.0.1 -[3.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@2.0.0...@metamask/snaps-types@3.0.0 -[2.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@0.38.3-flask.1...@metamask/snaps-types@2.0.0 -[0.38.3-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@0.38.2-flask.1...@metamask/snaps-types@0.38.3-flask.1 -[0.38.2-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@0.38.1-flask.1...@metamask/snaps-types@0.38.2-flask.1 -[0.38.1-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@0.38.0-flask.1...@metamask/snaps-types@0.38.1-flask.1 -[0.38.0-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-types@0.37.2-flask.1...@metamask/snaps-types@0.38.0-flask.1 -[0.37.2-flask.1]: https://github.com/MetaMask/snaps/releases/tag/@metamask/snaps-types@0.37.2-flask.1 diff --git a/packages/snaps-types/LICENSE b/packages/snaps-types/LICENSE deleted file mode 100644 index 3280a3260f..0000000000 --- a/packages/snaps-types/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright ConsenSys Software Inc. 2021. All rights reserved. - -You acknowledge and agree that ConsenSys Software Inc. (“ConsenSys”) (or ConsenSys’s licensors) own all legal right, title and interest in and to the work, software, application, source code, documentation and any other documents in this repository (collectively, the “Program”), including any intellectual property rights which subsist in the Program (whether those rights happen to be registered or not, and wherever in the world those rights may exist), whether in source code or any other form. - -Subject to the limited license below, you may not (and you may not permit anyone else to) distribute, publish, copy, modify, merge, combine with another program, create derivative works of, reverse engineer, decompile or otherwise attempt to extract the source code of, the Program or any part thereof, except that you may contribute to this repository. - -You are granted a non-exclusive, non-transferable, non-sublicensable license to distribute, publish, copy, modify, merge, combine with another program or create derivative works of the Program (such resulting program, collectively, the “Resulting Program”) solely for Non-Commercial Use as long as you: - 1. give prominent notice (“Notice”) with each copy of the Resulting Program that the Program is used in the Resulting Program and that the Program is the copyright of ConsenSys; and - 2. subject the Resulting Program and any distribution, publication, copy, modification, merger therewith, combination with another program or derivative works thereof to the same Notice requirement and Non-Commercial Use restriction set forth herein. - -“Non-Commercial Use” means each use as described in clauses (1)-(3) below, as reasonably determined by ConsenSys in its sole discretion: - 1. personal use for research, personal study, private entertainment, hobby projects or amateur pursuits, in each case without any anticipated commercial application; - 2. use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution; or - 3. the number of monthly active users of the Resulting Program across all versions thereof and platforms globally do not exceed 10,000 at any time. - -You will not use any trade mark, service mark, trade name, logo of ConsenSys or any other company or organization in a way that is likely or intended to cause confusion about the owner or authorized user of such marks, names or logos. - -If you have any questions, comments or interest in pursuing any other use cases, please reach out to us at metamask.license@consensys.net. diff --git a/packages/snaps-types/README.md b/packages/snaps-types/README.md deleted file mode 100644 index aa2547b637..0000000000 --- a/packages/snaps-types/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @metamask/snaps-types - -TypeScript types used by MetaMask Snaps at runtime. Contains both a global declaration for the global snap provider (`wallet`) and importable types for e.g. the `onRpcRequest` handler function. diff --git a/packages/snaps-types/package.json b/packages/snaps-types/package.json deleted file mode 100644 index c5f8ba728b..0000000000 --- a/packages/snaps-types/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@metamask/snaps-types", - "version": "3.1.0", - "description": "TypeScript types for developing MetaMask Snaps.", - "repository": { - "type": "git", - "url": "https://github.com/MetaMask/snaps.git" - }, - "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/types/index.d.ts", - "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" - ], - "scripts": { - "test": "echo \"N/A\" && exit 0", - "test:ci": "yarn test", - "lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx", - "lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore", - "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", - "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", - "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-types", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", - "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", - "clean": "rimraf '*.tsbuildinfo' 'dist'", - "publish:preview": "yarn npm publish --tag preview", - "lint:ci": "yarn lint", - "lint:dependencies": "depcheck" - }, - "dependencies": { - "@metamask/utils": "^8.1.0" - }, - "devDependencies": { - "@lavamoat/allow-scripts": "^2.5.1", - "@metamask/auto-changelog": "^3.4.3", - "@metamask/eslint-config": "^12.1.0", - "@metamask/eslint-config-jest": "^12.1.0", - "@metamask/eslint-config-nodejs": "^12.1.0", - "@metamask/eslint-config-typescript": "^12.1.0", - "@swc/cli": "^0.1.62", - "@swc/core": "1.3.78", - "@typescript-eslint/eslint-plugin": "^5.42.1", - "@typescript-eslint/parser": "^5.42.1", - "depcheck": "^1.4.7", - "eslint": "^8.27.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-import": "^2.26.0", - "eslint-plugin-jest": "^27.1.5", - "eslint-plugin-jsdoc": "^39.6.2", - "eslint-plugin-n": "^15.7.0", - "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-promise": "^6.1.1", - "prettier": "^2.7.1", - "prettier-plugin-packagejson": "^2.2.11", - "rimraf": "^4.1.2", - "typescript": "~4.8.4" - }, - "engines": { - "node": "^18.16 || >=20" - }, - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - } -} diff --git a/packages/snaps-types/src/index.ts b/packages/snaps-types/src/index.ts deleted file mode 100644 index fcb073fefc..0000000000 --- a/packages/snaps-types/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './types'; diff --git a/packages/snaps-types/src/types.ts b/packages/snaps-types/src/types.ts deleted file mode 100644 index d4050312b7..0000000000 --- a/packages/snaps-types/src/types.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Exported again for convenience. -export type { Json, JsonRpcRequest } from '@metamask/utils'; diff --git a/packages/snaps-types/tsconfig.build.json b/packages/snaps-types/tsconfig.build.json deleted file mode 100644 index 1b00e57664..0000000000 --- a/packages/snaps-types/tsconfig.build.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../tsconfig.packages.build.json", - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/types", - "rootDir": "./src" - }, - "include": ["./src"], - "references": [ - { - "path": "../snaps-utils/tsconfig.build.json" - } - ] -} diff --git a/packages/snaps-types/tsconfig.json b/packages/snaps-types/tsconfig.json deleted file mode 100644 index 4a3ba29e4e..0000000000 --- a/packages/snaps-types/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.packages.json", - "compilerOptions": { - "baseUrl": "./" - }, - "include": ["./src"], - "references": [ - { - "path": "../snaps-utils" - } - ] -} diff --git a/scripts/verify-tsconfig.mjs b/scripts/verify-tsconfig.mjs index b8b3c864f1..e18faf6dde 100644 --- a/scripts/verify-tsconfig.mjs +++ b/scripts/verify-tsconfig.mjs @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url'; const cwd = pathUtils.dirname(fileURLToPath(import.meta.url)) // These are the packages we expect to _not_ be referenced in the root tsconfig. -const IGNORE_LIST = new Set(['examples', 'snaps-types', 'test-snaps']); +const IGNORE_LIST = new Set(['examples', 'test-snaps']); // Get reference paths from root tsconfig.json const rootTsconfig = JSON.parse(await fs.readFile('./tsconfig.json', { encoding: 'utf8' })); diff --git a/tsconfig.build.json b/tsconfig.build.json index 06ceeb2162..598d4117a3 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -11,7 +11,6 @@ { "path": "./packages/snaps-rpc-methods/tsconfig.build.json" }, { "path": "./packages/snaps-sdk/tsconfig.build.json" }, { "path": "./packages/snaps-simulator/tsconfig.build.json" }, - { "path": "./packages/snaps-types/tsconfig.build.json" }, { "path": "./packages/snaps-ui/tsconfig.build.json" }, { "path": "./packages/snaps-utils/tsconfig.build.json" }, { "path": "./packages/snaps-webpack-plugin/tsconfig.build.json" } diff --git a/tsconfig.json b/tsconfig.json index 6d6e9f9fd1..ad146fce70 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,6 @@ { "path": "./packages/snaps-rpc-methods" }, { "path": "./packages/snaps-sdk" }, { "path": "./packages/snaps-simulator" }, - { "path": "./packages/snaps-types" }, { "path": "./packages/snaps-ui" }, { "path": "./packages/snaps-utils" }, { "path": "./packages/snaps-webpack-plugin" } diff --git a/yarn.lock b/yarn.lock index 08918490d9..7c3147691e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5595,37 +5595,6 @@ __metadata: languageName: unknown linkType: soft -"@metamask/snaps-types@workspace:packages/snaps-types": - version: 0.0.0-use.local - resolution: "@metamask/snaps-types@workspace:packages/snaps-types" - dependencies: - "@lavamoat/allow-scripts": ^2.5.1 - "@metamask/auto-changelog": ^3.4.3 - "@metamask/eslint-config": ^12.1.0 - "@metamask/eslint-config-jest": ^12.1.0 - "@metamask/eslint-config-nodejs": ^12.1.0 - "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/utils": ^8.1.0 - "@swc/cli": ^0.1.62 - "@swc/core": 1.3.78 - "@typescript-eslint/eslint-plugin": ^5.42.1 - "@typescript-eslint/parser": ^5.42.1 - depcheck: ^1.4.7 - eslint: ^8.27.0 - eslint-config-prettier: ^8.5.0 - eslint-plugin-import: ^2.26.0 - eslint-plugin-jest: ^27.1.5 - eslint-plugin-jsdoc: ^39.6.2 - eslint-plugin-n: ^15.7.0 - eslint-plugin-prettier: ^4.2.1 - eslint-plugin-promise: ^6.1.1 - prettier: ^2.7.1 - prettier-plugin-packagejson: ^2.2.11 - rimraf: ^4.1.2 - typescript: ~4.8.4 - languageName: unknown - linkType: soft - "@metamask/snaps-ui@workspace:^, @metamask/snaps-ui@workspace:packages/snaps-ui": version: 0.0.0-use.local resolution: "@metamask/snaps-ui@workspace:packages/snaps-ui"