From 131696834537f71da053df500137178263fc7e22 Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Wed, 24 Jul 2024 12:10:32 +0200 Subject: [PATCH 01/17] feat: starknet.js v6.11.0 --- packages/starknet-snap/index.html | 5 +---- packages/starknet-snap/package.json | 2 +- packages/starknet-snap/snap.manifest.json | 2 +- packages/starknet-snap/src/index.ts | 8 +------- packages/starknet-snap/src/types/snapApi.ts | 1 - packages/starknet-snap/src/utils/constants.ts | 15 +-------------- packages/starknet-snap/test/constants.test.ts | 2 +- 7 files changed, 6 insertions(+), 29 deletions(-) diff --git a/packages/starknet-snap/index.html b/packages/starknet-snap/index.html index 5b8b031e..d783e8d0 100644 --- a/packages/starknet-snap/index.html +++ b/packages/starknet-snap/index.html @@ -30,10 +30,8 @@

Hello, Snaps!


- +
- -
- - - diff --git a/packages/starknet-snap/package.json b/packages/starknet-snap/package.json index 6d93a8d5..c9af7a92 100644 --- a/packages/starknet-snap/package.json +++ b/packages/starknet-snap/package.json @@ -23,7 +23,7 @@ "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", + "lint:misc": "prettier 'index.html' '**/*.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", From 3124ad6b0a530ce0634c050a1d1f77a5a9bfa9eb Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Thu, 25 Jul 2024 12:11:37 +0200 Subject: [PATCH 04/17] revert: packages/starknet-snap/index.html --- packages/starknet-snap/index.html | 132 +++--------------------------- 1 file changed, 11 insertions(+), 121 deletions(-) diff --git a/packages/starknet-snap/index.html b/packages/starknet-snap/index.html index f382be7f..5b8b031e 100644 --- a/packages/starknet-snap/index.html +++ b/packages/starknet-snap/index.html @@ -4,123 +4,6 @@ Hello, Snaps! - @@ -147,8 +30,10 @@

Hello, Snaps!


- +
+ +
+ + + From ce4c7cec24721ce41c668875575c276355650435 Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Thu, 25 Jul 2024 15:01:18 +0200 Subject: [PATCH 05/17] revert: package.json root --- package.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5e4ee068..e2e186c1 100644 --- a/package.json +++ b/package.json @@ -18,16 +18,14 @@ "lint:fix": "yarn workspaces foreach --parallel --interlaced --verbose run lint:fix", "start": "yarn workspaces foreach --parallel --interlaced --verbose run start", "test": "yarn workspaces foreach --parallel --interlaced --verbose run test", - "prepare": "husky install", - "start-debug-ui": "http-server packages/starknet-snap" + "prepare": "husky install" }, "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", - "http-server": "^14.1.1" + "husky": "^8.0.0" }, "packageManager": "yarn@3.2.1", "engines": { From 41713625bacea50f682c01b0089744d55a9dac2b Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Thu, 25 Jul 2024 15:03:08 +0200 Subject: [PATCH 06/17] feat: v6.11.0 starknet.js in wallet-ui and get-starknet --- packages/starknet-snap/package.json | 2 +- packages/starknet-snap/src/index.ts | 7 +++++- packages/starknet-snap/src/utils/constants.ts | 5 ++++- packages/starknet-snap/src/utils/keyPair.ts | 22 +++++++++---------- packages/wallet-ui/package.json | 2 +- .../AmountInput/AmountInput.stories.tsx | 2 +- .../AssetListItem/AssetListItem.stories.tsx | 2 +- packages/wallet-ui/src/utils/constants.ts | 2 +- packages/wallet-ui/src/utils/utils.ts | 2 +- 9 files changed, 27 insertions(+), 19 deletions(-) diff --git a/packages/starknet-snap/package.json b/packages/starknet-snap/package.json index 5f78d000..eb780388 100644 --- a/packages/starknet-snap/package.json +++ b/packages/starknet-snap/package.json @@ -42,7 +42,7 @@ "async-mutex": "^0.3.2", "ethereum-unit-converter": "^0.0.17", "ethers": "^5.5.1", - "starknet": "6.11.0", + "starknet": "^6.11.0", "starknet_v4.22.0": "npm:starknet@4.22.0" }, "devDependencies": { diff --git a/packages/starknet-snap/src/index.ts b/packages/starknet-snap/src/index.ts index bcc192b4..2e38042b 100644 --- a/packages/starknet-snap/src/index.ts +++ b/packages/starknet-snap/src/index.ts @@ -118,7 +118,12 @@ export const onRpcRequest: OnRpcRequestHandler = async ({ request }) => { } // pre-inserted the default networks and tokens await upsertNetwork(STARKNET_MAINNET_NETWORK, snap, saveMutex, state); - await upsertNetwork(STARKNET_SEPOLIA_TESTNET_NETWORK, snap, saveMutex, state); + await upsertNetwork( + STARKNET_SEPOLIA_TESTNET_NETWORK, + snap, + saveMutex, + state, + ); // remove the testnet network (migration) await removeNetwork(STARKNET_TESTNET_NETWORK, snap, saveMutex, state); diff --git a/packages/starknet-snap/src/utils/constants.ts b/packages/starknet-snap/src/utils/constants.ts index 57348a8d..4db722ce 100644 --- a/packages/starknet-snap/src/utils/constants.ts +++ b/packages/starknet-snap/src/utils/constants.ts @@ -170,7 +170,10 @@ export const PRELOADED_TOKENS = [ STRK_SEPOLIA_TESTNET, ]; -export const PRELOADED_NETWORKS = [STARKNET_MAINNET_NETWORK, STARKNET_SEPOLIA_TESTNET_NETWORK]; +export const PRELOADED_NETWORKS = [ + STARKNET_MAINNET_NETWORK, + STARKNET_SEPOLIA_TESTNET_NETWORK, +]; export const PROXY_CONTRACT_HASH = '0x25ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918'; // for cairo 0 proxy contract diff --git a/packages/starknet-snap/src/utils/keyPair.ts b/packages/starknet-snap/src/utils/keyPair.ts index 453e9b16..cc731b0a 100644 --- a/packages/starknet-snap/src/utils/keyPair.ts +++ b/packages/starknet-snap/src/utils/keyPair.ts @@ -1,7 +1,7 @@ import type { BIP44AddressKeyDeriver } from '@metamask/key-tree'; import { getBIP44AddressKeyDeriver } from '@metamask/key-tree'; import { utils } from 'ethers'; -import { number, ec } from 'starknet_v4.22.0'; +import { num as numUtils, ec } from 'starknet'; /** * @@ -25,17 +25,17 @@ export async function getAddressKeyDeriver(wallet) { * @param keySeed * @param keyValueLimit */ -export function grindKey(keySeed: string, keyValueLimit = ec.ec.n): string { +export function grindKey( + keySeed: string, + keyValueLimit: bigint | undefined | null = ec.starkCurve.CURVE.n, +): string { if (!keyValueLimit) { return keySeed; } - const sha256EcMaxDigest = number.toBN( - '1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000', - 16, - ); - const maxAllowedVal = sha256EcMaxDigest.sub( - sha256EcMaxDigest.mod(keyValueLimit), + const sha256EcMaxDigest = BigInt( + '0x10000000000000000000000000000000000000000000000000000000000000000', ); + const maxAllowedVal = sha256EcMaxDigest - (sha256EcMaxDigest % keyValueLimit); // Make sure the produced key is derived by the Stark EC order, // and falls within the range [0, maxAllowedVal). @@ -44,9 +44,9 @@ export function grindKey(keySeed: string, keyValueLimit = ec.ec.n): string { do { key = hashKeyWithIndex(keySeed, i); i += 1; - } while (!key.lt(maxAllowedVal)); + } while (key >= maxAllowedVal); // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - return `0x${key.umod(keyValueLimit).toString('hex')}`; + return `0x${(key % keyValueLimit).toString(16)}`; } /** @@ -57,7 +57,7 @@ export function grindKey(keySeed: string, keyValueLimit = ec.ec.n): string { function hashKeyWithIndex(key: string, index: number) { const payload = utils.concat([utils.arrayify(key), utils.arrayify(index)]); const hash = utils.sha256(payload); - return number.toBN(hash); + return numUtils.toBigInt(hash); } /** diff --git a/packages/wallet-ui/package.json b/packages/wallet-ui/package.json index 44ec1459..e31198f6 100644 --- a/packages/wallet-ui/package.json +++ b/packages/wallet-ui/package.json @@ -65,7 +65,7 @@ "react-redux": "^8.0.1", "redux-persist": "^6.0.0", "semver": "^7.5.2", - "starknet": "^4.22.0", + "starknet": "^6.11.0", "styled-components": "^5.3.5", "toastr2": "^3.0.0-alpha.18", "web-vitals": "^2.1.4" diff --git a/packages/wallet-ui/src/components/ui/molecule/AmountInput/AmountInput.stories.tsx b/packages/wallet-ui/src/components/ui/molecule/AmountInput/AmountInput.stories.tsx index 5f04d774..8ae157ad 100644 --- a/packages/wallet-ui/src/components/ui/molecule/AmountInput/AmountInput.stories.tsx +++ b/packages/wallet-ui/src/components/ui/molecule/AmountInput/AmountInput.stories.tsx @@ -11,7 +11,7 @@ export default { const asset = { address: '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', amount: BigNumber.from('1000000000000000000'), - chainId: constants.StarknetChainId.TESTNET, + chainId: constants.StarknetChainId.SN_SEPOLIA, decimals: 18, name: 'Ether', symbol: 'ETH', diff --git a/packages/wallet-ui/src/components/ui/molecule/AssetsList/AssetListItem/AssetListItem.stories.tsx b/packages/wallet-ui/src/components/ui/molecule/AssetsList/AssetListItem/AssetListItem.stories.tsx index d8364a52..273451e8 100644 --- a/packages/wallet-ui/src/components/ui/molecule/AssetsList/AssetListItem/AssetListItem.stories.tsx +++ b/packages/wallet-ui/src/components/ui/molecule/AssetsList/AssetListItem/AssetListItem.stories.tsx @@ -12,7 +12,7 @@ export default { const asset: Erc20TokenBalance = { address: '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', amount: BigNumber.from('1000000000000000000'), - chainId: constants.StarknetChainId.TESTNET, + chainId: constants.StarknetChainId.SN_SEPOLIA, decimals: 18, name: 'Ether', symbol: 'ETH', diff --git a/packages/wallet-ui/src/utils/constants.ts b/packages/wallet-ui/src/utils/constants.ts index 19b89eff..41343aca 100644 --- a/packages/wallet-ui/src/utils/constants.ts +++ b/packages/wallet-ui/src/utils/constants.ts @@ -4,7 +4,7 @@ import { constants } from 'starknet'; export const SEPOLIA_CHAINID = '0x534e5f5345504f4c4941'; export const TOKENS: any = { - [constants.StarknetChainId.MAINNET]: { + [constants.StarknetChainId.SN_MAIN]: { '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': { coingeckoId: 'ethereum', }, diff --git a/packages/wallet-ui/src/utils/utils.ts b/packages/wallet-ui/src/utils/utils.ts index 116a23fb..eb431999 100644 --- a/packages/wallet-ui/src/utils/utils.ts +++ b/packages/wallet-ui/src/utils/utils.ts @@ -28,7 +28,7 @@ export const openExplorerTab = ( ) => { let explorerUrl = STARKNET_SEPOLIA_TESTNET_EXPLORER; switch (chainId) { - case constants.StarknetChainId.MAINNET: + case constants.StarknetChainId.SN_MAIN: explorerUrl = STARKNET_MAINNET_EXPLORER; break; case SEPOLIA_CHAINID: From 29a79453ea0f85f7e0f6ada8c4518fe69bea4bea Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Thu, 25 Jul 2024 15:04:44 +0200 Subject: [PATCH 07/17] revert: package.json starknet-snap lint scope --- packages/starknet-snap/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/starknet-snap/package.json b/packages/starknet-snap/package.json index eb780388..46cfd3cc 100644 --- a/packages/starknet-snap/package.json +++ b/packages/starknet-snap/package.json @@ -23,7 +23,7 @@ "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 'index.html' '**/*.ts' '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path .gitignore", + "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", From f89a700964a81d4cb8f8136faf648c7ad843bdbe Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Thu, 25 Jul 2024 15:05:58 +0200 Subject: [PATCH 08/17] fix: warning message when building wallet-ui --- packages/starknet-snap/snap.manifest.json | 2 +- packages/wallet-ui/craco.config.js | 20 ++++ packages/wallet-ui/package.json | 11 +- yarn.lock | 136 ++++++++++++++++------ 4 files changed, 125 insertions(+), 44 deletions(-) create mode 100644 packages/wallet-ui/craco.config.js diff --git a/packages/starknet-snap/snap.manifest.json b/packages/starknet-snap/snap.manifest.json index 89e1c0c6..8b5c0c28 100644 --- a/packages/starknet-snap/snap.manifest.json +++ b/packages/starknet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/ConsenSys/starknet-snap.git" }, "source": { - "shasum": "QTghmF19ZVAMHyKpyNlzjdwLvzrP6RHVWLfZzZHjynU=", + "shasum": "uG3NeaD7Ky06SZo9Hnx1KWn5EjavmUJC5VBSY/sqctM=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/wallet-ui/craco.config.js b/packages/wallet-ui/craco.config.js new file mode 100644 index 00000000..26370d58 --- /dev/null +++ b/packages/wallet-ui/craco.config.js @@ -0,0 +1,20 @@ +module.exports = { + webpack: { + configure: (webpackConfig) => { + // Find the rule that uses 'source-map-loader' + const sourceMapLoaderRule = webpackConfig.module.rules.find( + rule => rule.loader && rule.loader.includes('source-map-loader') + ); + + if (sourceMapLoaderRule) { + // Exclude the entire folder + sourceMapLoaderRule.exclude = [ + ...(Array.isArray(sourceMapLoaderRule.exclude) ? sourceMapLoaderRule.exclude : [sourceMapLoaderRule.exclude]), + /node_modules\/starknet-types-07\/dist/ + ]; + } + + return webpackConfig; + }, + }, +}; \ No newline at end of file diff --git a/packages/wallet-ui/package.json b/packages/wallet-ui/package.json index e31198f6..5c98db3e 100644 --- a/packages/wallet-ui/package.json +++ b/packages/wallet-ui/package.json @@ -6,19 +6,19 @@ "license": "(Apache-2.0 OR MIT)", "scripts": { "allow-scripts": "yarn workspace root allow-scripts", - "build": "react-scripts build", + "build": "craco build", "build-storybook": "build-storybook", "build:clean": "yarn clean && yarn build", "clean": "rimraf dist", - "eject": "react-scripts eject", + "eject": "craco eject", "lint": "yarn lint:eslint && yarn lint:misc --check", "lint:eslint": "eslint . --cache --ext js,ts,tsx", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:misc": "prettier '**/*.ts' '**/*.json' '**/*.tsx' '**/*.md' '!CHANGELOG.md' --ignore-path .gitignore", - "serve": "react-scripts serve", - "start": "react-scripts start", + "serve": "craco serve", + "start": "craco start", "storybook": "start-storybook -p 6006", - "test": "react-scripts test --coverage --passWithNoTests" + "test": "craco test --coverage --passWithNoTests" }, "browserslist": { "production": [ @@ -71,6 +71,7 @@ "web-vitals": "^2.1.4" }, "devDependencies": { + "@craco/craco": "^7.1.0", "@metamask/eslint-config": "^12.2.0", "@metamask/eslint-config-browser": "^12.1.0", "@metamask/eslint-config-jest": "^12.1.0", diff --git a/yarn.lock b/yarn.lock index c4ef48f0..f5efa9bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2077,16 +2077,16 @@ __metadata: "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": version: 2.9.0 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=4d9aa6&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=ca876a&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" dependencies: "@metamask/key-tree": 9.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: ^6.11.0 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: d8e8b23b3553a1c526205aa7ead79bbafa8274edd8c1a1624148bd6b126d002891816abc36c2639e5fbb02319fb58c97757773fdfb268524a8704d095df6ddf5 + checksum: 086202292978f8df348593b0f8a843a289d618801e6bf748a34be5e86b210311145d9db6f6830bdef00165bb5cd384487928f4d69454c7500723a4124af733ac languageName: node linkType: hard @@ -2130,13 +2130,32 @@ __metadata: rimraf: ^3.0.2 sinon: ^13.0.2 sinon-chai: ^3.7.0 - starknet: 6.7.0 + starknet: ^6.11.0 starknet_v4.22.0: "npm:starknet@4.22.0" ts-node: ^10.9.2 typescript: ^4.7.4 languageName: unknown linkType: soft +"@craco/craco@npm:^7.1.0": + version: 7.1.0 + resolution: "@craco/craco@npm:7.1.0" + dependencies: + autoprefixer: ^10.4.12 + cosmiconfig: ^7.0.1 + cosmiconfig-typescript-loader: ^1.0.0 + cross-spawn: ^7.0.3 + lodash: ^4.17.21 + semver: ^7.3.7 + webpack-merge: ^5.8.0 + peerDependencies: + react-scripts: ^5.0.0 + bin: + craco: dist/bin/craco.js + checksum: d534d1ea7814e7bd9f2e2aef17821fcdb1d9cac8308e8eb04809f8f3371180086b8f673dedce1ffbefba9ded566e91e4c9663464e488bf6291461091cbd95c4e + languageName: node + linkType: hard + "@cspotcode/source-map-support@npm:^0.8.0": version: 0.8.1 resolution: "@cspotcode/source-map-support@npm:0.8.1" @@ -4744,7 +4763,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.4.0, @noble/hashes@npm:^1.0.0, @noble/hashes@npm:^1.1.2, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:~1.4.0": +"@noble/hashes@npm:1.4.0, @noble/hashes@npm:^1.0.0, @noble/hashes@npm:^1.1.2, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:^1.4.0, @noble/hashes@npm:~1.4.0": version: 1.4.0 resolution: "@noble/hashes@npm:1.4.0" checksum: 8ba816ae26c90764b8c42493eea383716396096c5f7ba6bea559993194f49d80a73c081f315f4c367e51bd2d5891700bcdfa816b421d24ab45b41cb03e4f3342 @@ -5291,6 +5310,13 @@ __metadata: languageName: node linkType: hard +"@starknet-io/types-js@npm:^0.7.7, starknet-types-07@npm:@starknet-io/types-js@^0.7.7": + version: 0.7.7 + resolution: "@starknet-io/types-js@npm:0.7.7" + checksum: e5355042b06f96a19ee02a07cc12e321a636d0c7eaa605f85363775b036303a82896e6bcb2b244f97b125c83ae691f0fc162a5167e9866152a3b2108a9e28402 + languageName: node + linkType: hard + "@storybook/addon-actions@npm:6.5.16, @storybook/addon-actions@npm:^6.5.3": version: 6.5.16 resolution: "@storybook/addon-actions@npm:6.5.16" @@ -9350,7 +9376,7 @@ __metadata: languageName: node linkType: hard -"autoprefixer@npm:^10.4.13": +"autoprefixer@npm:^10.4.12, autoprefixer@npm:^10.4.13": version: 10.4.19 resolution: "autoprefixer@npm:10.4.19" dependencies: @@ -11437,6 +11463,20 @@ __metadata: languageName: node linkType: hard +"cosmiconfig-typescript-loader@npm:^1.0.0": + version: 1.0.9 + resolution: "cosmiconfig-typescript-loader@npm:1.0.9" + dependencies: + cosmiconfig: ^7 + ts-node: ^10.7.0 + peerDependencies: + "@types/node": "*" + cosmiconfig: ">=7" + typescript: ">=3" + checksum: 26a0198e03e81a9e7e1a6ce880d7309fdd056c7a3a23b587253e6d1d1224154d3f9edf727d9c0310628e89752353211b75de151b705298b4d0741fa1740c661e + languageName: node + linkType: hard + "cosmiconfig-typescript-loader@npm:^4.0.0": version: 4.4.0 resolution: "cosmiconfig-typescript-loader@npm:4.4.0" @@ -11462,7 +11502,7 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^7.0.0": +"cosmiconfig@npm:^7, cosmiconfig@npm:^7.0.0, cosmiconfig@npm:^7.0.1": version: 7.1.0 resolution: "cosmiconfig@npm:7.1.0" dependencies: @@ -12862,7 +12902,7 @@ __metadata: languageName: node linkType: hard -"elliptic@npm:^6.5.3, elliptic@npm:^6.5.4, elliptic@npm:^6.5.5": +"elliptic@npm:^6.5.3, elliptic@npm:^6.5.5": version: 6.5.5 resolution: "elliptic@npm:6.5.5" dependencies: @@ -12877,6 +12917,21 @@ __metadata: languageName: node linkType: hard +"elliptic@npm:^6.5.4": + version: 6.5.6 + resolution: "elliptic@npm:6.5.6" + dependencies: + bn.js: ^4.11.9 + brorand: ^1.1.0 + hash.js: ^1.0.0 + hmac-drbg: ^1.0.1 + inherits: ^2.0.4 + minimalistic-assert: ^1.0.1 + minimalistic-crypto-utils: ^1.0.1 + checksum: 213d778ccfe99ec8f0f871b1cc96a10ac3763d9175215d0a9dc026f291e5f50fea6f635e4e47b4506f9ada25aeb703bd807d8737b880dbb24d092a3001c6d97d + languageName: node + linkType: hard + "emittery@npm:^0.10.2": version: 0.10.2 resolution: "emittery@npm:0.10.2" @@ -14928,6 +14983,15 @@ __metadata: languageName: node linkType: hard +"get-starknet-core@npm:^4.0.0-next.3": + version: 4.0.0 + resolution: "get-starknet-core@npm:4.0.0" + dependencies: + "@starknet-io/types-js": ^0.7.7 + checksum: 06e4be1be945d8fb7ad3f0d77a5e92c2854ce43cae8091a9f9b5f3cc74d42cf7188de9e544d497f92c0cad316d6d0abc110520629987815be2aed26d0b9ab871 + languageName: node + linkType: hard + "get-stdin@npm:^4.0.1": version: 4.0.1 resolution: "get-stdin@npm:4.0.1" @@ -24406,33 +24470,45 @@ __metadata: languageName: unknown linkType: soft -"starknet-types@npm:^0.0.4": - version: 0.0.4 - resolution: "starknet-types@npm:0.0.4" - checksum: a83d306830696ea875b8b07541db47e515a4ddb7bfce0cf5555cce12c8ce0e697b984762720c7f27761dc4114b4e5d3f81006e82fc45e52b052afe8fc86240fa +"starknet@npm:^5.14.0": + version: 5.29.0 + resolution: "starknet@npm:5.29.0" + dependencies: + "@noble/curves": ~1.3.0 + "@scure/base": ~1.1.3 + "@scure/starknet": ~1.0.0 + abi-wan-kanabi-v1: "npm:abi-wan-kanabi@^1.0.3" + abi-wan-kanabi-v2: "npm:abi-wan-kanabi@^2.1.1" + isomorphic-fetch: ^3.0.0 + lossless-json: ^2.0.8 + pako: ^2.0.4 + url-join: ^4.0.1 + checksum: ea44bcc7f7db76ef878a557658e289bd25383b6fbcc9d59153dcf1bd0e014f41484fa5faa95e09ce0bd3c5933833fc867fb5be325f5b55ae1531a2cd29915594 languageName: node linkType: hard -"starknet@npm:6.7.0": - version: 6.7.0 - resolution: "starknet@npm:6.7.0" +"starknet@npm:^6.11.0": + version: 6.11.0 + resolution: "starknet@npm:6.11.0" dependencies: "@noble/curves": ~1.4.0 + "@noble/hashes": ^1.4.0 "@scure/base": ~1.1.3 "@scure/starknet": ~1.0.0 abi-wan-kanabi: ^2.2.2 fetch-cookie: ^3.0.0 + get-starknet-core: ^4.0.0-next.3 isomorphic-fetch: ^3.0.0 lossless-json: ^4.0.1 pako: ^2.0.4 - starknet-types: ^0.0.4 + starknet-types-07: "npm:@starknet-io/types-js@^0.7.7" ts-mixer: ^6.0.3 url-join: ^4.0.1 - checksum: 3c4abda7bab3008c8f98728c4b23a47a2dc97b876c6a33a824da77907b63611fde2df22298aa4c512e3c81e3fe005dd7e288969f18b00299e6eae450a147769d + checksum: 997c4a9efad53b0c25d0402c2dcd4e334b83865389ea29791f72ac757e0d9a216cf4634c6fbd5d33154e26389d499d39d893cf52302ec6b4eb9d7f04c034b579 languageName: node linkType: hard -"starknet@npm:^4.22.0, starknet_v4.22.0@npm:starknet@4.22.0": +"starknet_v4.22.0@npm:starknet@4.22.0": version: 4.22.0 resolution: "starknet@npm:4.22.0" dependencies: @@ -24451,23 +24527,6 @@ __metadata: languageName: node linkType: hard -"starknet@npm:^5.14.0": - version: 5.29.0 - resolution: "starknet@npm:5.29.0" - dependencies: - "@noble/curves": ~1.3.0 - "@scure/base": ~1.1.3 - "@scure/starknet": ~1.0.0 - abi-wan-kanabi-v1: "npm:abi-wan-kanabi@^1.0.3" - abi-wan-kanabi-v2: "npm:abi-wan-kanabi@^2.1.1" - isomorphic-fetch: ^3.0.0 - lossless-json: ^2.0.8 - pako: ^2.0.4 - url-join: ^4.0.1 - checksum: ea44bcc7f7db76ef878a557658e289bd25383b6fbcc9d59153dcf1bd0e014f41484fa5faa95e09ce0bd3c5933833fc867fb5be325f5b55ae1531a2cd29915594 - languageName: node - linkType: hard - "state-toggle@npm:^1.0.0": version: 1.0.3 resolution: "state-toggle@npm:1.0.3" @@ -25723,7 +25782,7 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:^10.8.1, ts-node@npm:^10.9.2": +"ts-node@npm:^10.7.0, ts-node@npm:^10.8.1, ts-node@npm:^10.9.2": version: 10.9.2 resolution: "ts-node@npm:10.9.2" dependencies: @@ -26690,6 +26749,7 @@ __metadata: resolution: "wallet-ui@workspace:packages/wallet-ui" dependencies: "@consensys/starknet-snap": "file:../starknet-snap" + "@craco/craco": ^7.1.0 "@emotion/react": ^11.9.0 "@emotion/styled": ^11.8.1 "@fortawesome/fontawesome-svg-core": ^6.1.1 @@ -26749,7 +26809,7 @@ __metadata: redux-persist: ^6.0.0 rimraf: ^3.0.2 semver: ^7.5.2 - starknet: ^4.22.0 + starknet: ^6.11.0 styled-components: ^5.3.5 toastr2: ^3.0.0-alpha.18 typescript: ^4.7.4 @@ -27110,7 +27170,7 @@ __metadata: languageName: node linkType: hard -"webpack-merge@npm:^5.7.3, webpack-merge@npm:^5.9.0": +"webpack-merge@npm:^5.7.3, webpack-merge@npm:^5.8.0, webpack-merge@npm:^5.9.0": version: 5.10.0 resolution: "webpack-merge@npm:5.10.0" dependencies: From 2b46d69be39a400c74c25ee12b1f6e4b387acbac Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Fri, 26 Jul 2024 10:51:17 +0200 Subject: [PATCH 09/17] feat: sarknet.js v6.11.0 on get-starknet --- packages/get-starknet/package.json | 2 +- packages/get-starknet/src/accounts.ts | 10 +++++++--- packages/get-starknet/src/snap.ts | 3 ++- packages/get-starknet/src/wallet.ts | 4 +--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/get-starknet/package.json b/packages/get-starknet/package.json index 27abb9b0..1b96989c 100644 --- a/packages/get-starknet/package.json +++ b/packages/get-starknet/package.json @@ -53,6 +53,6 @@ "registry": "https://registry.npmjs.org/" }, "dependencies": { - "starknet": "^5.14.0" + "starknet": "^6.11.0" } } diff --git a/packages/get-starknet/src/accounts.ts b/packages/get-starknet/src/accounts.ts index 96d52c47..e17f8cf7 100644 --- a/packages/get-starknet/src/accounts.ts +++ b/packages/get-starknet/src/accounts.ts @@ -12,6 +12,7 @@ import type { Signature, SignerInterface, TypedData, + UniversalDetails, } from 'starknet'; import { Account } from 'starknet'; @@ -36,10 +37,13 @@ export class MetaMaskAccount extends Account { async execute( calls: AllowArray, - abis?: Abi[] | undefined, - transactionsDetail?: InvocationsDetails, + abisOrTransactionsDetail?: Abi[] | UniversalDetails, + transactionsDetail?: UniversalDetails, ): Promise { - return this.#snap.execute(this.#address, calls, abis, transactionsDetail); + if (!transactionsDetail) { + return this.#snap.execute(this.#address, calls, undefined, abisOrTransactionsDetail as UniversalDetails); + } + return this.#snap.execute(this.#address, calls, abisOrTransactionsDetail as Abi[], transactionsDetail); } async signMessage(typedData: TypedData): Promise { diff --git a/packages/get-starknet/src/snap.ts b/packages/get-starknet/src/snap.ts index f85e367a..232f131e 100644 --- a/packages/get-starknet/src/snap.ts +++ b/packages/get-starknet/src/snap.ts @@ -11,6 +11,7 @@ import type { InvokeFunctionResponse, Signature, TypedData, + UniversalDetails, } from 'starknet'; import type { AccContract, MetaMaskProvider, Network, RequestSnapResponse } from './type'; @@ -109,7 +110,7 @@ export class MetaMaskSnap { senderAddress: string, txnInvocation: AllowArray, abis?: Abi[], - invocationsDetails?: InvocationsDetails, + invocationsDetails?: UniversalDetails, ): Promise { return (await this.#provider.request({ method: 'wallet_invokeSnap', diff --git a/packages/get-starknet/src/wallet.ts b/packages/get-starknet/src/wallet.ts index 0a86214a..a24c81ca 100644 --- a/packages/get-starknet/src/wallet.ts +++ b/packages/get-starknet/src/wallet.ts @@ -117,9 +117,7 @@ export class MetaMaskSnapWallet implements IStarknetWindowObject { async #getRPCProvider(network: { chainId: string; nodeUrl: string }) { return new Provider({ - rpc: { - nodeUrl: network.nodeUrl, - }, + nodeUrl: network.nodeUrl, }); } From b7cf1a229eb4fac3bb7c84d6a8906f286cf96a82 Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Fri, 26 Jul 2024 10:57:16 +0200 Subject: [PATCH 10/17] revert: starknet-snap/utils/keyPair.ts --- packages/starknet-snap/src/utils/keyPair.ts | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/starknet-snap/src/utils/keyPair.ts b/packages/starknet-snap/src/utils/keyPair.ts index cc731b0a..453e9b16 100644 --- a/packages/starknet-snap/src/utils/keyPair.ts +++ b/packages/starknet-snap/src/utils/keyPair.ts @@ -1,7 +1,7 @@ import type { BIP44AddressKeyDeriver } from '@metamask/key-tree'; import { getBIP44AddressKeyDeriver } from '@metamask/key-tree'; import { utils } from 'ethers'; -import { num as numUtils, ec } from 'starknet'; +import { number, ec } from 'starknet_v4.22.0'; /** * @@ -25,17 +25,17 @@ export async function getAddressKeyDeriver(wallet) { * @param keySeed * @param keyValueLimit */ -export function grindKey( - keySeed: string, - keyValueLimit: bigint | undefined | null = ec.starkCurve.CURVE.n, -): string { +export function grindKey(keySeed: string, keyValueLimit = ec.ec.n): string { if (!keyValueLimit) { return keySeed; } - const sha256EcMaxDigest = BigInt( - '0x10000000000000000000000000000000000000000000000000000000000000000', + const sha256EcMaxDigest = number.toBN( + '1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000', + 16, + ); + const maxAllowedVal = sha256EcMaxDigest.sub( + sha256EcMaxDigest.mod(keyValueLimit), ); - const maxAllowedVal = sha256EcMaxDigest - (sha256EcMaxDigest % keyValueLimit); // Make sure the produced key is derived by the Stark EC order, // and falls within the range [0, maxAllowedVal). @@ -44,9 +44,9 @@ export function grindKey( do { key = hashKeyWithIndex(keySeed, i); i += 1; - } while (key >= maxAllowedVal); + } while (!key.lt(maxAllowedVal)); // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - return `0x${(key % keyValueLimit).toString(16)}`; + return `0x${key.umod(keyValueLimit).toString('hex')}`; } /** @@ -57,7 +57,7 @@ export function grindKey( function hashKeyWithIndex(key: string, index: number) { const payload = utils.concat([utils.arrayify(key), utils.arrayify(index)]); const hash = utils.sha256(payload); - return numUtils.toBigInt(hash); + return number.toBN(hash); } /** From e99825946c578474281b5b42d1b479e3e6d60d41 Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Mon, 29 Jul 2024 10:32:06 +0200 Subject: [PATCH 11/17] revert: wallet-ui package.json remove craco --- packages/wallet-ui/package.json | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/wallet-ui/package.json b/packages/wallet-ui/package.json index 5c98db3e..e31198f6 100644 --- a/packages/wallet-ui/package.json +++ b/packages/wallet-ui/package.json @@ -6,19 +6,19 @@ "license": "(Apache-2.0 OR MIT)", "scripts": { "allow-scripts": "yarn workspace root allow-scripts", - "build": "craco build", + "build": "react-scripts build", "build-storybook": "build-storybook", "build:clean": "yarn clean && yarn build", "clean": "rimraf dist", - "eject": "craco eject", + "eject": "react-scripts eject", "lint": "yarn lint:eslint && yarn lint:misc --check", "lint:eslint": "eslint . --cache --ext js,ts,tsx", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:misc": "prettier '**/*.ts' '**/*.json' '**/*.tsx' '**/*.md' '!CHANGELOG.md' --ignore-path .gitignore", - "serve": "craco serve", - "start": "craco start", + "serve": "react-scripts serve", + "start": "react-scripts start", "storybook": "start-storybook -p 6006", - "test": "craco test --coverage --passWithNoTests" + "test": "react-scripts test --coverage --passWithNoTests" }, "browserslist": { "production": [ @@ -71,7 +71,6 @@ "web-vitals": "^2.1.4" }, "devDependencies": { - "@craco/craco": "^7.1.0", "@metamask/eslint-config": "^12.2.0", "@metamask/eslint-config-browser": "^12.1.0", "@metamask/eslint-config-jest": "^12.1.0", From 8babafab3a718d55acbf39644564c103f7f34523 Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Mon, 29 Jul 2024 12:17:30 +0200 Subject: [PATCH 12/17] revert: craco.config.js removed --- packages/wallet-ui/craco.config.js | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 packages/wallet-ui/craco.config.js diff --git a/packages/wallet-ui/craco.config.js b/packages/wallet-ui/craco.config.js deleted file mode 100644 index 26370d58..00000000 --- a/packages/wallet-ui/craco.config.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - webpack: { - configure: (webpackConfig) => { - // Find the rule that uses 'source-map-loader' - const sourceMapLoaderRule = webpackConfig.module.rules.find( - rule => rule.loader && rule.loader.includes('source-map-loader') - ); - - if (sourceMapLoaderRule) { - // Exclude the entire folder - sourceMapLoaderRule.exclude = [ - ...(Array.isArray(sourceMapLoaderRule.exclude) ? sourceMapLoaderRule.exclude : [sourceMapLoaderRule.exclude]), - /node_modules\/starknet-types-07\/dist/ - ]; - } - - return webpackConfig; - }, - }, -}; \ No newline at end of file From 8c2ccfd3bbc584754efddd307fd69f3a36e22ec6 Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Mon, 29 Jul 2024 12:20:48 +0200 Subject: [PATCH 13/17] chore: update yarn.lock --- yarn.lock | 164 ++++-------------------------------------------------- 1 file changed, 10 insertions(+), 154 deletions(-) diff --git a/yarn.lock b/yarn.lock index f5efa9bb..06f657d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2066,7 +2066,7 @@ __metadata: prettier: ^2.7.1 rimraf: ^3.0.2 serve: 14.2.1 - starknet: ^5.14.0 + starknet: ^6.11.0 ts-loader: ^9.5.1 typescript: ^4.6.3 webpack: ^5.91.0 @@ -2077,7 +2077,7 @@ __metadata: "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": version: 2.9.0 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=ca876a&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=09c368&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" dependencies: "@metamask/key-tree": 9.0.0 "@metamask/snaps-sdk": ^4.0.0 @@ -2086,7 +2086,7 @@ __metadata: ethers: ^5.5.1 starknet: ^6.11.0 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: 086202292978f8df348593b0f8a843a289d618801e6bf748a34be5e86b210311145d9db6f6830bdef00165bb5cd384487928f4d69454c7500723a4124af733ac + checksum: 4f9d1d6fb5df3d3e23aafed475bb3fac70f38cfbbb0fff15d5cecceb3a521c3cd7c61cb93cc99f5cc03c6fac51e63a2d9032c1c371d954097b9446968e18eaa9 languageName: node linkType: hard @@ -2137,25 +2137,6 @@ __metadata: languageName: unknown linkType: soft -"@craco/craco@npm:^7.1.0": - version: 7.1.0 - resolution: "@craco/craco@npm:7.1.0" - dependencies: - autoprefixer: ^10.4.12 - cosmiconfig: ^7.0.1 - cosmiconfig-typescript-loader: ^1.0.0 - cross-spawn: ^7.0.3 - lodash: ^4.17.21 - semver: ^7.3.7 - webpack-merge: ^5.8.0 - peerDependencies: - react-scripts: ^5.0.0 - bin: - craco: dist/bin/craco.js - checksum: d534d1ea7814e7bd9f2e2aef17821fcdb1d9cac8308e8eb04809f8f3371180086b8f673dedce1ffbefba9ded566e91e4c9663464e488bf6291461091cbd95c4e - languageName: node - linkType: hard - "@cspotcode/source-map-support@npm:^0.8.0": version: 0.8.1 resolution: "@cspotcode/source-map-support@npm:0.8.1" @@ -5104,48 +5085,6 @@ __metadata: languageName: node linkType: hard -"@rometools/cli-darwin-arm64@npm:12.1.3": - version: 12.1.3 - resolution: "@rometools/cli-darwin-arm64@npm:12.1.3" - conditions: os=darwin & cpu=arm64 - languageName: node - linkType: hard - -"@rometools/cli-darwin-x64@npm:12.1.3": - version: 12.1.3 - resolution: "@rometools/cli-darwin-x64@npm:12.1.3" - conditions: os=darwin & cpu=x64 - languageName: node - linkType: hard - -"@rometools/cli-linux-arm64@npm:12.1.3": - version: 12.1.3 - resolution: "@rometools/cli-linux-arm64@npm:12.1.3" - conditions: os=linux & cpu=arm64 - languageName: node - linkType: hard - -"@rometools/cli-linux-x64@npm:12.1.3": - version: 12.1.3 - resolution: "@rometools/cli-linux-x64@npm:12.1.3" - conditions: os=linux & cpu=x64 - languageName: node - linkType: hard - -"@rometools/cli-win32-arm64@npm:12.1.3": - version: 12.1.3 - resolution: "@rometools/cli-win32-arm64@npm:12.1.3" - conditions: os=win32 & cpu=arm64 - languageName: node - linkType: hard - -"@rometools/cli-win32-x64@npm:12.1.3": - version: 12.1.3 - resolution: "@rometools/cli-win32-x64@npm:12.1.3" - conditions: os=win32 & cpu=x64 - languageName: node - linkType: hard - "@rushstack/eslint-patch@npm:^1.1.0": version: 1.10.3 resolution: "@rushstack/eslint-patch@npm:1.10.3" @@ -8477,22 +8416,7 @@ __metadata: languageName: node linkType: hard -"abi-wan-kanabi-v1@npm:abi-wan-kanabi@^1.0.3, abi-wan-kanabi@npm:^1.0.1": - version: 1.0.3 - resolution: "abi-wan-kanabi@npm:1.0.3" - dependencies: - abi-wan-kanabi: ^1.0.1 - fs-extra: ^10.0.0 - rome: ^12.1.3 - typescript: ^4.9.5 - yargs: ^17.7.2 - bin: - generate: dist/generate.js - checksum: 03b03c507424f239a7832e310ffbb35568448f0eebbe19e8caf56b03962ad6c047db8c84c3e7487d1ff9c97b0b00733ac9579c3cc640179d2eeacc5558316237 - languageName: node - linkType: hard - -"abi-wan-kanabi-v2@npm:abi-wan-kanabi@^2.1.1, abi-wan-kanabi@npm:^2.2.2": +"abi-wan-kanabi@npm:^2.2.2": version: 2.2.2 resolution: "abi-wan-kanabi@npm:2.2.2" dependencies: @@ -9376,7 +9300,7 @@ __metadata: languageName: node linkType: hard -"autoprefixer@npm:^10.4.12, autoprefixer@npm:^10.4.13": +"autoprefixer@npm:^10.4.13": version: 10.4.19 resolution: "autoprefixer@npm:10.4.19" dependencies: @@ -11463,20 +11387,6 @@ __metadata: languageName: node linkType: hard -"cosmiconfig-typescript-loader@npm:^1.0.0": - version: 1.0.9 - resolution: "cosmiconfig-typescript-loader@npm:1.0.9" - dependencies: - cosmiconfig: ^7 - ts-node: ^10.7.0 - peerDependencies: - "@types/node": "*" - cosmiconfig: ">=7" - typescript: ">=3" - checksum: 26a0198e03e81a9e7e1a6ce880d7309fdd056c7a3a23b587253e6d1d1224154d3f9edf727d9c0310628e89752353211b75de151b705298b4d0741fa1740c661e - languageName: node - linkType: hard - "cosmiconfig-typescript-loader@npm:^4.0.0": version: 4.4.0 resolution: "cosmiconfig-typescript-loader@npm:4.4.0" @@ -11502,7 +11412,7 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^7, cosmiconfig@npm:^7.0.0, cosmiconfig@npm:^7.0.1": +"cosmiconfig@npm:^7.0.0": version: 7.1.0 resolution: "cosmiconfig@npm:7.1.0" dependencies: @@ -18609,13 +18519,6 @@ __metadata: languageName: node linkType: hard -"lossless-json@npm:^2.0.8": - version: 2.0.11 - resolution: "lossless-json@npm:2.0.11" - checksum: 0282cf40658c844c9c7983dad26b7134538ba30fd5a992c932790228e3c9131b48d2cc89d65b31ced247a4eeedf33676bf187849ba3635d659c7812f106b42a7 - languageName: node - linkType: hard - "lossless-json@npm:^4.0.1": version: 4.0.1 resolution: "lossless-json@npm:4.0.1" @@ -23401,35 +23304,6 @@ __metadata: languageName: node linkType: hard -"rome@npm:^12.1.3": - version: 12.1.3 - resolution: "rome@npm:12.1.3" - dependencies: - "@rometools/cli-darwin-arm64": 12.1.3 - "@rometools/cli-darwin-x64": 12.1.3 - "@rometools/cli-linux-arm64": 12.1.3 - "@rometools/cli-linux-x64": 12.1.3 - "@rometools/cli-win32-arm64": 12.1.3 - "@rometools/cli-win32-x64": 12.1.3 - dependenciesMeta: - "@rometools/cli-darwin-arm64": - optional: true - "@rometools/cli-darwin-x64": - optional: true - "@rometools/cli-linux-arm64": - optional: true - "@rometools/cli-linux-x64": - optional: true - "@rometools/cli-win32-arm64": - optional: true - "@rometools/cli-win32-x64": - optional: true - bin: - rome: bin/rome - checksum: 341e5520a23277bdc2571db279e72fe9427a95f4e3025cd215a989d381fe6690f6aa1c0fb9abbd318a8bfd85ff1cec2304e92b732329c8a46c69e259eeb080cc - languageName: node - linkType: hard - "rsvp@npm:^4.8.4": version: 4.8.5 resolution: "rsvp@npm:4.8.5" @@ -24470,23 +24344,6 @@ __metadata: languageName: unknown linkType: soft -"starknet@npm:^5.14.0": - version: 5.29.0 - resolution: "starknet@npm:5.29.0" - dependencies: - "@noble/curves": ~1.3.0 - "@scure/base": ~1.1.3 - "@scure/starknet": ~1.0.0 - abi-wan-kanabi-v1: "npm:abi-wan-kanabi@^1.0.3" - abi-wan-kanabi-v2: "npm:abi-wan-kanabi@^2.1.1" - isomorphic-fetch: ^3.0.0 - lossless-json: ^2.0.8 - pako: ^2.0.4 - url-join: ^4.0.1 - checksum: ea44bcc7f7db76ef878a557658e289bd25383b6fbcc9d59153dcf1bd0e014f41484fa5faa95e09ce0bd3c5933833fc867fb5be325f5b55ae1531a2cd29915594 - languageName: node - linkType: hard - "starknet@npm:^6.11.0": version: 6.11.0 resolution: "starknet@npm:6.11.0" @@ -25782,7 +25639,7 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:^10.7.0, ts-node@npm:^10.8.1, ts-node@npm:^10.9.2": +"ts-node@npm:^10.8.1, ts-node@npm:^10.9.2": version: 10.9.2 resolution: "ts-node@npm:10.9.2" dependencies: @@ -26065,7 +25922,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^4.6.3, typescript@npm:^4.7.4, typescript@npm:^4.9.5": +"typescript@npm:^4.6.3, typescript@npm:^4.7.4": version: 4.9.5 resolution: "typescript@npm:4.9.5" bin: @@ -26085,7 +25942,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@^4.6.3#~builtin, typescript@patch:typescript@^4.7.4#~builtin, typescript@patch:typescript@^4.9.5#~builtin": +"typescript@patch:typescript@^4.6.3#~builtin, typescript@patch:typescript@^4.7.4#~builtin": version: 4.9.5 resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin::version=4.9.5&hash=7ad353" bin: @@ -26749,7 +26606,6 @@ __metadata: resolution: "wallet-ui@workspace:packages/wallet-ui" dependencies: "@consensys/starknet-snap": "file:../starknet-snap" - "@craco/craco": ^7.1.0 "@emotion/react": ^11.9.0 "@emotion/styled": ^11.8.1 "@fortawesome/fontawesome-svg-core": ^6.1.1 @@ -27170,7 +27026,7 @@ __metadata: languageName: node linkType: hard -"webpack-merge@npm:^5.7.3, webpack-merge@npm:^5.8.0, webpack-merge@npm:^5.9.0": +"webpack-merge@npm:^5.7.3, webpack-merge@npm:^5.9.0": version: 5.10.0 resolution: "webpack-merge@npm:5.10.0" dependencies: From 61198248bc3a2e925b155ef61a131245b4daed4b Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Mon, 29 Jul 2024 13:54:02 +0200 Subject: [PATCH 14/17] chore: pin starknet version in snap --- packages/starknet-snap/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/starknet-snap/package.json b/packages/starknet-snap/package.json index 46cfd3cc..b53f7011 100644 --- a/packages/starknet-snap/package.json +++ b/packages/starknet-snap/package.json @@ -42,7 +42,7 @@ "async-mutex": "^0.3.2", "ethereum-unit-converter": "^0.0.17", "ethers": "^5.5.1", - "starknet": "^6.11.0", + "starknet": "6.11.0", "starknet_v4.22.0": "npm:starknet@4.22.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 06f657d6..9258e3dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2077,16 +2077,16 @@ __metadata: "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": version: 2.9.0 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=09c368&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=e05139&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" dependencies: "@metamask/key-tree": 9.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.11.0 + starknet: 6.11.0 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: 4f9d1d6fb5df3d3e23aafed475bb3fac70f38cfbbb0fff15d5cecceb3a521c3cd7c61cb93cc99f5cc03c6fac51e63a2d9032c1c371d954097b9446968e18eaa9 + checksum: 056434346cb9da9e7db9a41ee746e5e4bad8cdbb697bd606447c00fcc58f26a96331c9674d65a010d83ec0962d6e3a13d16842a5497e64db1ede5db1028db7a7 languageName: node linkType: hard @@ -2130,7 +2130,7 @@ __metadata: rimraf: ^3.0.2 sinon: ^13.0.2 sinon-chai: ^3.7.0 - starknet: ^6.11.0 + starknet: 6.11.0 starknet_v4.22.0: "npm:starknet@4.22.0" ts-node: ^10.9.2 typescript: ^4.7.4 @@ -24344,7 +24344,7 @@ __metadata: languageName: unknown linkType: soft -"starknet@npm:^6.11.0": +"starknet@npm:6.11.0, starknet@npm:^6.11.0": version: 6.11.0 resolution: "starknet@npm:6.11.0" dependencies: From ca5b53ec201f087de4a0b303cefe6461545d4d10 Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Mon, 29 Jul 2024 14:14:29 +0200 Subject: [PATCH 15/17] revert: get-starknet execute use invocationsDetails --- packages/get-starknet/src/accounts.ts | 7 +++---- packages/get-starknet/src/snap.ts | 3 +-- yarn.lock | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/get-starknet/src/accounts.ts b/packages/get-starknet/src/accounts.ts index e17f8cf7..f51558a5 100644 --- a/packages/get-starknet/src/accounts.ts +++ b/packages/get-starknet/src/accounts.ts @@ -12,7 +12,6 @@ import type { Signature, SignerInterface, TypedData, - UniversalDetails, } from 'starknet'; import { Account } from 'starknet'; @@ -37,11 +36,11 @@ export class MetaMaskAccount extends Account { async execute( calls: AllowArray, - abisOrTransactionsDetail?: Abi[] | UniversalDetails, - transactionsDetail?: UniversalDetails, + abisOrTransactionsDetail?: Abi[] | InvocationsDetails, + transactionsDetail?: InvocationsDetails, ): Promise { if (!transactionsDetail) { - return this.#snap.execute(this.#address, calls, undefined, abisOrTransactionsDetail as UniversalDetails); + return this.#snap.execute(this.#address, calls, undefined, abisOrTransactionsDetail as InvocationsDetails); } return this.#snap.execute(this.#address, calls, abisOrTransactionsDetail as Abi[], transactionsDetail); } diff --git a/packages/get-starknet/src/snap.ts b/packages/get-starknet/src/snap.ts index 232f131e..f85e367a 100644 --- a/packages/get-starknet/src/snap.ts +++ b/packages/get-starknet/src/snap.ts @@ -11,7 +11,6 @@ import type { InvokeFunctionResponse, Signature, TypedData, - UniversalDetails, } from 'starknet'; import type { AccContract, MetaMaskProvider, Network, RequestSnapResponse } from './type'; @@ -110,7 +109,7 @@ export class MetaMaskSnap { senderAddress: string, txnInvocation: AllowArray, abis?: Abi[], - invocationsDetails?: UniversalDetails, + invocationsDetails?: InvocationsDetails, ): Promise { return (await this.#provider.request({ method: 'wallet_invokeSnap', diff --git a/yarn.lock b/yarn.lock index 9258e3dc..3a2dfdca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2077,7 +2077,7 @@ __metadata: "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": version: 2.9.0 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=e05139&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=77e692&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" dependencies: "@metamask/key-tree": 9.0.0 "@metamask/snaps-sdk": ^4.0.0 @@ -2086,7 +2086,7 @@ __metadata: ethers: ^5.5.1 starknet: 6.11.0 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: 056434346cb9da9e7db9a41ee746e5e4bad8cdbb697bd606447c00fcc58f26a96331c9674d65a010d83ec0962d6e3a13d16842a5497e64db1ede5db1028db7a7 + checksum: e7113b81b09c23ee0ace9df98f3be1a16d77f9f552bb6f31e37b404dcdfde1eab19f9222c0e6093e9dadbb7821c842af0151a156c9245406dc1323419cdbc69f languageName: node linkType: hard From 0789f5e07c8daba9a724f2e25a6f86e8c3da512f Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Mon, 29 Jul 2024 15:52:08 +0200 Subject: [PATCH 16/17] chore: lint + prettier --- packages/starknet-snap/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/starknet-snap/src/index.ts b/packages/starknet-snap/src/index.ts index bf1f380e..dfaa4e4e 100644 --- a/packages/starknet-snap/src/index.ts +++ b/packages/starknet-snap/src/index.ts @@ -88,7 +88,6 @@ export const onRpcRequest: OnRpcRequestHandler = async ({ request }) => { logger.log(`${request.method}:\nrequestParams: ${toJson(requestParams)}`); try { - if (request.method === 'ping') { logger.log('pong'); return 'pong'; From 4f16a074c7c3e30ea49f38b9db6aaa4594899606 Mon Sep 17 00:00:00 2001 From: Florin Dzeladini Date: Tue, 30 Jul 2024 10:42:18 +0200 Subject: [PATCH 17/17] chore: pin starknet version in get-starknet and wallet-ui --- packages/get-starknet/package.json | 2 +- packages/wallet-ui/package.json | 2 +- yarn.lock | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/get-starknet/package.json b/packages/get-starknet/package.json index 1b96989c..c36f5b4e 100644 --- a/packages/get-starknet/package.json +++ b/packages/get-starknet/package.json @@ -53,6 +53,6 @@ "registry": "https://registry.npmjs.org/" }, "dependencies": { - "starknet": "^6.11.0" + "starknet": "6.11.0" } } diff --git a/packages/wallet-ui/package.json b/packages/wallet-ui/package.json index e31198f6..5837bb31 100644 --- a/packages/wallet-ui/package.json +++ b/packages/wallet-ui/package.json @@ -65,7 +65,7 @@ "react-redux": "^8.0.1", "redux-persist": "^6.0.0", "semver": "^7.5.2", - "starknet": "^6.11.0", + "starknet": "6.11.0", "styled-components": "^5.3.5", "toastr2": "^3.0.0-alpha.18", "web-vitals": "^2.1.4" diff --git a/yarn.lock b/yarn.lock index 3a2dfdca..f4a8f94c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2066,7 +2066,7 @@ __metadata: prettier: ^2.7.1 rimraf: ^3.0.2 serve: 14.2.1 - starknet: ^6.11.0 + starknet: 6.11.0 ts-loader: ^9.5.1 typescript: ^4.6.3 webpack: ^5.91.0 @@ -2077,7 +2077,7 @@ __metadata: "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": version: 2.9.0 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=77e692&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=53fbce&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" dependencies: "@metamask/key-tree": 9.0.0 "@metamask/snaps-sdk": ^4.0.0 @@ -2086,7 +2086,7 @@ __metadata: ethers: ^5.5.1 starknet: 6.11.0 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: e7113b81b09c23ee0ace9df98f3be1a16d77f9f552bb6f31e37b404dcdfde1eab19f9222c0e6093e9dadbb7821c842af0151a156c9245406dc1323419cdbc69f + checksum: 7983ea41668ddeba8733dd5bc53bfdd97cc3ad44b619c70d13a13466c2974894454befb26e7bb11adae3df723a51264d5ff9db14362ac0c0fe2b588b5535b2a7 languageName: node linkType: hard @@ -24344,7 +24344,7 @@ __metadata: languageName: unknown linkType: soft -"starknet@npm:6.11.0, starknet@npm:^6.11.0": +"starknet@npm:6.11.0": version: 6.11.0 resolution: "starknet@npm:6.11.0" dependencies: @@ -26665,7 +26665,7 @@ __metadata: redux-persist: ^6.0.0 rimraf: ^3.0.2 semver: ^7.5.2 - starknet: ^6.11.0 + starknet: 6.11.0 styled-components: ^5.3.5 toastr2: ^3.0.0-alpha.18 typescript: ^4.7.4