Skip to content

Commit

Permalink
feat: clean up and update dependency (#259)
Browse files Browse the repository at this point in the history
* feat: add new cd workflow

* feat: add code scan

* chore: update code scan in duel process

* chore: merge sonar scan in test workflow

* chore: add token for scan

* chore: restore report coverage from specific node version

* fix: update secret

* fix: missing node version on the cache key

* chore: update dependency for ui and snap

* fix: update yarn lock

* fix: update yarn.lock

* fix: remove unuse package in get-starknet

* fix: remove metamask/rpc-methods

* chore: remove metamask/rpc-methods

* chore: update yarn lock

* chore: update snap package.json
  • Loading branch information
stanleyyconsensys authored Jul 2, 2024
1 parent 02b92f9 commit fcb83e1
Show file tree
Hide file tree
Showing 27 changed files with 1,716 additions and 2,982 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
lts/*
40 changes: 0 additions & 40 deletions .yarn/patches/luxon-npm-3.3.0-bdbae9bfd5.patch

This file was deleted.

9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-allow-scripts",
factory: function (require) {
var plugin=(()=>{var l=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(o,e)=>(typeof require<"u"?require:o)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var u=(t,o)=>{for(var e in o)l(t,e,{get:o[e],enumerable:!0})},f=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of a(o))!c.call(t,i)&&i!==e&&l(t,i,{get:()=>o[i],enumerable:!(r=s(o,i))||r.enumerable});return t};var m=t=>f(l({},"__esModule",{value:!0}),t);var g={};u(g,{default:()=>d});var n=p("@yarnpkg/shell"),x={hooks:{afterAllInstalled:async()=>{let t=await(0,n.execute)("yarn run allow-scripts");t!==0&&process.exit(t)}}},d=x;return m(g);})();
return plugin;
}
};
4 changes: 2 additions & 2 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

786 changes: 786 additions & 0 deletions .yarn/releases/yarn-3.2.1.cjs

Large diffs are not rendered by default.

873 changes: 0 additions & 873 deletions .yarn/releases/yarn-berry.cjs

This file was deleted.

14 changes: 12 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
enableScripts: false

enableTelemetry: 0

logFilters:
- code: YN0004
level: discard

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
spec: '@yarnpkg/plugin-workspace-tools'
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
spec: 'https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js'

yarnPath: .yarn/releases/yarn-berry.cjs
yarnPath: .yarn/releases/yarn-3.2.1.cjs
19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
"main": "index.js",
"private": true,
"license": "(Apache-2.0 OR MIT)",
"repository": "https://github.com/ConsenSys/starknet-snap.git",
"repository": {
"type": "git",
"url": "https://github.com/ConsenSys/starknet-snap.git"
},
"workspaces": [
"packages/*"
],
"scripts": {
"allow-scripts": "yarn workspaces foreach --parallel --interlaced --verbose run allow-scripts",
"clean": "yarn workspaces foreach --parallel --interlaced --verbose run clean",
"build": "yarn workspaces foreach --parallel --interlaced --verbose run build",
"lint": "yarn workspaces foreach --parallel --interlaced --verbose run lint",
Expand All @@ -20,12 +22,19 @@
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@lavamoat/allow-scripts": "^3.0.0",
"@lavamoat/preinstall-always-fail": "^2.0.0",
"husky": "^8.0.0"
},
"resolutions": {
"luxon@^3.2.1": "patch:luxon@npm%3A3.3.0#./.yarn/patches/luxon-npm-3.3.0-bdbae9bfd5.patch"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18.6.0"
},
"lavamoat": {
"allowScripts": {
"@lavamoat/preinstall-always-fail": false,
"sharp": true,
"@commitlint/cli>@commitlint/load>ts-node>@swc/core": false
}
}
}
10 changes: 0 additions & 10 deletions packages/get-starknet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,14 @@
"keywords": [],
"author": "Consensys",
"devDependencies": {
"@types/chai": "^4.3.1",
"@types/chai-as-promised": "^7.1.5",
"@types/sinon": "^10.0.11",
"@types/sinon-chai": "^3.2.8",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"depcheck": "^1.4.7",
"dotenv": "^16.4.5",
"eslint": "^8.13.0",
"get-starknet-core": "^3.2.0",
"html-webpack-plugin": "5.6.0",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"serve": "14.2.1",
"sinon": "^13.0.2",
"sinon-chai": "^3.7.0",
"ts-loader": "^9.5.1",
"typescript": "^4.6.3",
"webpack": "^5.91.0",
Expand Down
73 changes: 33 additions & 40 deletions packages/starknet-snap/package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,52 @@
{
"name": "@consensys/starknet-snap",
"version": "2.8.0",
"license": "(Apache-2.0 OR MIT)",
"keywords": [],
"repository": {
"type": "git",
"url": "https://github.com/ConsenSys/starknet-snap.git"
},
"license": "(Apache-2.0 OR MIT)",
"author": "",
"main": "./dist/bundle.js",
"files": [
"dist/",
"images/",
"snap.manifest.json"
],
"scripts": {
"build:clean": "yarn clean && yarn build",
"allow-scripts": "yarn workspace root allow-scripts",
"build": "mm-snap build",
"serve": "mm-snap serve",
"build:clean": "yarn clean && yarn build",
"clean": "rimraf dist",
"start": "mm-snap watch",
"test": "yarn run test:unit && yarn run cover:report",
"cover:report": "nyc report --reporter=lcov --reporter=text",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"lint:misc": "prettier '**/*.ts' '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path .gitignore",
"serve": "mm-snap serve",
"start": "mm-snap watch",
"test": "yarn run test:unit && yarn run cover:report",
"test:unit": "nyc --check-coverage --statements 80 --branches 80 --functions 80 --lines 80 mocha --colors -r ts-node/register \"test/**/*.test.ts\"",
"test:unit:one": "nyc --check-coverage --statements 80 --branches 80 --functions 80 --lines 80 mocha --colors -r ts-node/register",
"cover:report": "nyc report --reporter=lcov --reporter=text"
"test:unit:one": "nyc --check-coverage --statements 80 --branches 80 --functions 80 --lines 80 mocha --colors -r ts-node/register"
},
"keywords": [],
"author": "",
"devDependencies": {
"@lavamoat/allow-scripts": "^2.0.3",
"nyc": {
"exclude": [
"**/addNetwork.ts",
"**/*.test.ts"
]
},
"dependencies": {
"@metamask/key-tree": "9.0.0",
"@metamask/rpc-methods": "3.0.0",
"@metamask/snaps-cli": "5.0.0",
"@metamask/snaps-sdk": "^4.0.0",
"async-mutex": "^0.3.2",
"ethereum-unit-converter": "^0.0.17",
"ethers": "^5.5.1",
"starknet": "6.7.0",
"starknet_v4.22.0": "npm:[email protected]"
},
"devDependencies": {
"@metamask/snaps-cli": "^6.1.0",
"@types/chai": "^4.3.1",
"@types/chai-as-promised": "^7.1.5",
"@types/sinon": "^10.0.11",
Expand All @@ -42,44 +55,24 @@
"@typescript-eslint/parser": "^5.20.0",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"concurrently": "^7.1.0",
"cross-env": "^7.0.3",
"dotenv": "^16.4.5",
"eslint": "^8.13.0",
"mocha": "^9.2.2",
"nyc": "^15.1.0",
"prettier": "^2.6.2",
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^3.0.2",
"sinon": "^13.0.2",
"sinon-chai": "^3.7.0",
"standard-version": "^9.5.0",
"ts-node": "^10.8.1",
"typescript": "^4.6.3"
"typescript": "^4.7.4"
},
"dependencies": {
"@metamask/snaps-sdk": "3.0.1",
"async-mutex": "^0.3.2",
"dotenv": "^16.4.5",
"ethereum-unit-converter": "^0.0.17",
"ethers": "^5.5.1",
"starknet": "6.7.0",
"starknet_v4.22.0": "npm:[email protected]"
"packageManager": "[email protected]",
"engines": {
"node": ">=18.6.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"lavamoat": {
"allowScripts": {
"@lavamoat/preinstall-always-fail": false,
"@metamask/rpc-methods>@metamask/permission-controller>@metamask/controller-utils>ethereumjs-util>ethereum-cryptography>keccak": true,
"@metamask/rpc-methods>@metamask/permission-controller>@metamask/controller-utils>ethereumjs-util>ethereum-cryptography>secp256k1": true,
"ts-node>@swc/core": false
}
},
"nyc": {
"exclude": [
"**/addNetwork.ts",
"**/*.test.ts"
]
}
}
2 changes: 1 addition & 1 deletion packages/starknet-snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/ConsenSys/starknet-snap.git"
},
"source": {
"shasum": "w/9IComQVArE5jU1RHIW8Y5CnN//nBoHKBQDFRhM8yI=",
"shasum": "RzIvMTaF+Zf6YlhAcsnXoCYzBpzluw4FPBvK0qhIyYY=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/addErc20Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import {
getAddTokenText,
} from './utils/snapUtils';
import { DEFAULT_DECIMAL_PLACES } from './utils/constants';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel } from '@metamask/snaps-sdk';
import { heading, panel, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';

export async function addErc20Token(params: ApiParams) {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/addNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { AddNetworkRequestParams, ApiParams } from './types/snapApi';
import { validateAddNetworkParams, upsertNetwork, getNetworkTxt } from './utils/snapUtils';
import { logger } from './utils/logger';
import { Network } from './types/snapState';
import { DialogType } from '@metamask/rpc-methods';
import { panel, heading } from '@metamask/snaps-sdk';
import { panel, heading, DialogType } from '@metamask/snaps-sdk';

export async function addNetwork(params: ApiParams) {
try {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/declareContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { toJson } from './utils/serializer';
import { ApiParams, DeclareContractRequestParams } from './types/snapApi';
import { getNetworkFromChainId, getDeclareSnapTxt, showUpgradeRequestModal } from './utils/snapUtils';
import { getKeysFromAddress, declareContract as declareContractUtil, isUpgradeRequired } from './utils/starknetUtils';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel } from '@metamask/snaps-sdk';
import { heading, panel, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';

export async function declareContract(params: ApiParams) {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/executeTxn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import {
} from './utils/starknetUtils';
import { ApiParams, ExecuteTxnRequestParams } from './types/snapApi';
import { createAccount } from './createAccount';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel, divider } from '@metamask/snaps-sdk';
import { heading, panel, divider, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';
import { ACCOUNT_CLASS_HASH } from './utils/constants';

Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/extractPrivateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { validateAndParseAddress } from '../src/utils/starknetUtils';
import { ApiParams, ExtractPrivateKeyRequestParams } from './types/snapApi';
import { getNetworkFromChainId } from './utils/snapUtils';
import { getKeysFromAddress, isUpgradeRequired } from './utils/starknetUtils';
import { DialogType } from '@metamask/rpc-methods';
import { copyable, panel, text } from '@metamask/snaps-sdk';
import { copyable, panel, text, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';

export async function extractPrivateKey(params: ApiParams) {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/sendTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import {
} from './utils/starknetUtils';
import { ApiParams, SendTransactionRequestParams } from './types/snapApi';
import { createAccount } from './createAccount';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel } from '@metamask/snaps-sdk';
import { heading, panel, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';

export async function sendTransaction(params: ApiParams) {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/signDeclareTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {
isUpgradeRequired,
} from './utils/starknetUtils';
import { getNetworkFromChainId, getSignTxnTxt, showUpgradeRequestModal } from './utils/snapUtils';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel } from '@metamask/snaps-sdk';
import { heading, panel, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';

export async function signDeclareTransaction(params: ApiParams): Promise<Signature | boolean> {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/signDeployAccountTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {
isUpgradeRequired,
} from './utils/starknetUtils';
import { getNetworkFromChainId, getSignTxnTxt, showUpgradeRequestModal } from './utils/snapUtils';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel } from '@metamask/snaps-sdk';
import { heading, panel, DialogType } from '@metamask/snaps-sdk';
import { logger } from '../src/utils/logger';

export async function signDeployAccountTransaction(params: ApiParams): Promise<Signature | boolean> {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/signMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {
} from './utils/starknetUtils';
import { getNetworkFromChainId, addDialogTxt, showUpgradeRequestModal } from './utils/snapUtils';
import { ApiParams, SignMessageRequestParams } from './types/snapApi';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel } from '@metamask/snaps-sdk';
import { heading, panel, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';

export async function signMessage(params: ApiParams) {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/signTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { Signature } from 'starknet';
import { ApiParams, SignTransactionRequestParams } from './types/snapApi';
import { getKeysFromAddress, signTransactions, isUpgradeRequired } from './utils/starknetUtils';
import { getNetworkFromChainId, getSignTxnTxt, showUpgradeRequestModal } from './utils/snapUtils';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel } from '@metamask/snaps-sdk';
import { heading, panel, DialogType } from '@metamask/snaps-sdk';
import { logger } from '../src/utils/logger';

export async function signTransaction(params: ApiParams): Promise<Signature | boolean> {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/switchNetwork.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { toJson } from './utils/serializer';
import { ApiParams, SwitchNetworkRequestParams } from './types/snapApi';
import { getNetwork, setCurrentNetwork, getNetworkTxt } from './utils/snapUtils';
import { DialogType } from '@metamask/rpc-methods';
import { panel, heading } from '@metamask/snaps-sdk';
import { panel, heading, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';

export async function switchNetwork(params: ApiParams) {
Expand Down
3 changes: 1 addition & 2 deletions packages/starknet-snap/src/upgradeAccContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
import { getNetworkFromChainId, upsertTransaction, getSendTxnText } from './utils/snapUtils';
import { ApiParams, UpgradeTransactionRequestParams } from './types/snapApi';
import { ACCOUNT_CLASS_HASH, CAIRO_VERSION_LEGACY } from './utils/constants';
import { DialogType } from '@metamask/rpc-methods';
import { heading, panel } from '@metamask/snaps-sdk';
import { heading, panel, DialogType } from '@metamask/snaps-sdk';
import { logger } from './utils/logger';

export async function upgradeAccContract(params: ApiParams) {
Expand Down
Loading

0 comments on commit fcb83e1

Please sign in to comment.