diff --git a/.yarn/patches/starknet-npm-7.0.1-89bc8c73a3.patch b/.yarn/patches/starknet-npm-7.0.1-89bc8c73a3.patch new file mode 100644 index 000000000..e6d726cc3 --- /dev/null +++ b/.yarn/patches/starknet-npm-7.0.1-89bc8c73a3.patch @@ -0,0 +1,75 @@ +diff --git a/dist/index.global.js b/dist/index.global.js +index ba6de970f1397b589a1746e751a3ef1e86c91072..314e9b624569fe58eb56790429118f679c4f36ae 100644 +--- a/dist/index.global.js ++++ b/dist/index.global.js +@@ -11622,7 +11622,8 @@ ${indent}}` : "}"; + const maxUnitPrice = toHex(addPercent(estimate.gas_price, overhead.l1_gas.max_price_per_unit)); + return { + l2_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, +- l1_gas: { max_amount: maxUnits, max_price_per_unit: maxUnitPrice } ++ l1_gas: { max_amount: maxUnits, max_price_per_unit: maxUnitPrice }, ++ l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } + }; + } + +@@ -11734,9 +11735,7 @@ ${indent}}` : "}"; + return { + l2_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, + l1_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, +- ...specVersion === "0.8" && { +- l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } +- } ++ l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } + }; + } + if (isRPC08_FeeEstimate(estimate)) { +diff --git a/dist/index.js b/dist/index.js +index b0240d473fb715b40959ab02bb7c381cec6ba91f..759cbc966d743ea2cf41c58b18827ed9d312a042 100644 +--- a/dist/index.js ++++ b/dist/index.js +@@ -3563,7 +3563,8 @@ function estimateFeeToBounds(estimate, overhead) { + const maxUnitPrice = toHex(addPercent(estimate.gas_price, overhead.l1_gas.max_price_per_unit)); + return { + l2_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, +- l1_gas: { max_amount: maxUnits, max_price_per_unit: maxUnitPrice } ++ l1_gas: { max_amount: maxUnits, max_price_per_unit: maxUnitPrice }, ++ l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } + }; + } + +@@ -3675,9 +3676,7 @@ function estimateFeeToBounds3(estimate, overhead = config.get("feeMarginPercenta + return { + l2_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, + l1_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, +- ...specVersion === "0.8" && { +- l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } +- } ++ l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } + }; + } + if (isRPC08_FeeEstimate(estimate)) { +diff --git a/dist/index.mjs b/dist/index.mjs +index fa15ab8be19e4e0e121ba459c3d558e2eb701ee3..ba2e934c464127070261786b11e951f429d62380 100644 +--- a/dist/index.mjs ++++ b/dist/index.mjs +@@ -3433,7 +3433,8 @@ function estimateFeeToBounds(estimate, overhead) { + const maxUnitPrice = toHex(addPercent(estimate.gas_price, overhead.l1_gas.max_price_per_unit)); + return { + l2_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, +- l1_gas: { max_amount: maxUnits, max_price_per_unit: maxUnitPrice } ++ l1_gas: { max_amount: maxUnits, max_price_per_unit: maxUnitPrice }, ++ l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } + }; + } + +@@ -3545,9 +3546,7 @@ function estimateFeeToBounds3(estimate, overhead = config.get("feeMarginPercenta + return { + l2_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, + l1_gas: { max_amount: "0x0", max_price_per_unit: "0x0" }, +- ...specVersion === "0.8" && { +- l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } +- } ++ l1_data_gas: { max_amount: "0x0", max_price_per_unit: "0x0" } + }; + } + if (isRPC08_FeeEstimate(estimate)) { diff --git a/package.json b/package.json index d4d7497c1..636abf0b2 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,12 @@ "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "eslint": "eslint -f json -o eslint-report.json ./packages-ts || true", - "lint": "tsc -b ./tsconfig.json", + "lint": "node ./node_modules/typescript/bin/tsc -b ./tsconfig.json", "format": "yarn prettier --write .", "format:check": "yarn prettier --check .", - "clean": "tsc -b --clean ./tsconfig.json", - "build": "yarn clean && tsc -b ./tsconfig.json", + "clean": "node ./node_modules/typescript/bin/tsc -b --clean ./tsconfig.json", + "postinstall": "bash scripts/postinstall.sh", + "build": "yarn clean && node ./node_modules/typescript/bin/tsc -b ./tsconfig.json", "bundle": "yarn build && pkg . --no-native-build", "release": "yarn changeset publish" }, @@ -58,11 +59,12 @@ "typescript": "^5.4.5" }, "dependencies": { - "starknet": "7.0.1" + "starknet": "patch:starknet@npm%3A7.0.1#./.yarn/patches/starknet-npm-7.0.1-89bc8c73a3.patch" }, "resolutions": { "protobufjs": "6.11.4", - "elliptic": "6.6.1" + "elliptic": "6.6.1", + "starknet": "patch:starknet@npm%3A7.0.1#./.yarn/patches/starknet-npm-7.0.1-89bc8c73a3.patch" }, "packageManager": "yarn@4.5.3" } diff --git a/packages-ts/starknet-gauntlet-argent/package.json b/packages-ts/starknet-gauntlet-argent/package.json index ecc08a933..02d3a4415 100644 --- a/packages-ts/starknet-gauntlet-argent/package.json +++ b/packages-ts/starknet-gauntlet-argent/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-argent --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-bridge/package.json b/packages-ts/starknet-gauntlet-bridge/package.json index aed24aa26..95d7a0c04 100644 --- a/packages-ts/starknet-gauntlet-bridge/package.json +++ b/packages-ts/starknet-gauntlet-bridge/package.json @@ -14,11 +14,11 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-cli/networks/.env.ethereum-mainnet-starknet-1 b/packages-ts/starknet-gauntlet-cli/networks/.env.ethereum-mainnet-starknet-1 new file mode 100644 index 000000000..e939cbec4 --- /dev/null +++ b/packages-ts/starknet-gauntlet-cli/networks/.env.ethereum-mainnet-starknet-1 @@ -0,0 +1,8 @@ +ACCOUNT=0x078527b03dde3ad0c1f350bb8370294cc265ab850e818a7a55250a14ab987103 +LINK=0x68391c23f879505a07d4860eafc23461c4e815e48016f325a2fc0ed1906d2dc +MULTISIG=0x2a14fe941828a2c71b5d7e3ed8263066210160e7b436905005ab202388db2f1 +BILLING_ACCESS_CONTROLLER=0x1b91eb863272e93b8e115fecf56dcd87ffd5fdfbc2a0bf803d620984b7df2b0 +SECRET="gauntletocr museum cycle hawk exhibit school scan weekend accident kangaroo soccer asset dose" +RANDOM_SECRET="gauntletocr museum cycle hawk exhibit school scan weekend accident kangaroo soccer asset dose" +GAUNTLET_SECRET="paper train boat link doge bitcoin yellow green blue red okay engops" +NODE_URL=https://rpcs.cldev.sh/starknet/mainnet diff --git a/packages-ts/starknet-gauntlet-cli/package.json b/packages-ts/starknet-gauntlet-cli/package.json index f94532799..60ee41aaf 100644 --- a/packages-ts/starknet-gauntlet-cli/package.json +++ b/packages-ts/starknet-gauntlet-cli/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-cli --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b ../../tsconfig.json", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-emergency-protocol/package.json b/packages-ts/starknet-gauntlet-emergency-protocol/package.json index b289e243b..8d431b0f3 100644 --- a/packages-ts/starknet-gauntlet-emergency-protocol/package.json +++ b/packages-ts/starknet-gauntlet-emergency-protocol/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-emergency-protocol --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "lint:format": "yarn prettier --check ./src", "format": "yarn prettier --write ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-example/package.json b/packages-ts/starknet-gauntlet-example/package.json index db5419da5..675379a08 100644 --- a/packages-ts/starknet-gauntlet-example/package.json +++ b/packages-ts/starknet-gauntlet-example/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-example --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-ledger/package.json b/packages-ts/starknet-gauntlet-ledger/package.json index 72dcd74a2..cc370310b 100644 --- a/packages-ts/starknet-gauntlet-ledger/package.json +++ b/packages-ts/starknet-gauntlet-ledger/package.json @@ -14,13 +14,13 @@ "!dist/**/*.test.js" ], "scripts": { - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-ledger --passWithNoTests", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-multisig/package.json b/packages-ts/starknet-gauntlet-multisig/package.json index f3f129aaf..8b2f90ed7 100644 --- a/packages-ts/starknet-gauntlet-multisig/package.json +++ b/packages-ts/starknet-gauntlet-multisig/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-multisig --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-ocr2/package.json b/packages-ts/starknet-gauntlet-ocr2/package.json index e078f613d..025958702 100644 --- a/packages-ts/starknet-gauntlet-ocr2/package.json +++ b/packages-ts/starknet-gauntlet-ocr2/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-ocr2 --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-oz/package.json b/packages-ts/starknet-gauntlet-oz/package.json index b827224f1..4abb33c50 100644 --- a/packages-ts/starknet-gauntlet-oz/package.json +++ b/packages-ts/starknet-gauntlet-oz/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-oz --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet-token/package.json b/packages-ts/starknet-gauntlet-token/package.json index 2b2c4598e..fd6dcdc66 100644 --- a/packages-ts/starknet-gauntlet-token/package.json +++ b/packages-ts/starknet-gauntlet-token/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet-token --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet/package.json b/packages-ts/starknet-gauntlet/package.json index 270ad6d4a..cc5dea4e9 100644 --- a/packages-ts/starknet-gauntlet/package.json +++ b/packages-ts/starknet-gauntlet/package.json @@ -14,14 +14,14 @@ ], "scripts": { "gauntlet": "ts-node ./src/index.ts", - "lint": "tsc", + "lint": "node ../../node_modules/typescript/bin/tsc", "test": "SKIP_PROMPTS=true jest --runInBand --config ../../jest.config.ts --selectProjects starknet-gauntlet --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "format": "yarn prettier --write ./src", "format:check": "yarn prettier --check ./src", "clean": "rm -rf ./dist/ ./bin/", - "build": "yarn clean && tsc -b", + "build": "yarn clean && node ../../node_modules/typescript/bin/tsc -b", "bundle": "yarn build && pkg ." }, "dependencies": { diff --git a/packages-ts/starknet-gauntlet/src/provider/index.ts b/packages-ts/starknet-gauntlet/src/provider/index.ts index 82c3da1e9..6a26ad413 100644 --- a/packages-ts/starknet-gauntlet/src/provider/index.ts +++ b/packages-ts/starknet-gauntlet/src/provider/index.ts @@ -87,7 +87,7 @@ class Provider implements IStarknetProvider { account: Account constructor(nodeUrl: string, wallet?: IStarknetWallet) { - this.provider = new StarknetProvider({ nodeUrl }) + this.provider = new StarknetProvider({ nodeUrl, specVersion: '0.7' }) if (wallet) { this.account = new Account( this.provider, diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh new file mode 100755 index 000000000..e2c71fda7 --- /dev/null +++ b/scripts/postinstall.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Patches @chainlink/gauntlet-core to handle starknet.js RpcError which has +# a getter-only .code property. Without this, the catch block in cli.js throws +# "TypeError: Cannot set property code of Error which has only a getter" +# and masks the real underlying error. + +TARGET="node_modules/@chainlink/gauntlet-core/dist/cli.js" + +if [ -f "$TARGET" ]; then + if grep -q 'e.code = Error_1.GauntletError.GauntletErrorCode.UNKNOWN;' "$TARGET"; then + sed -i.bak 's/e\.code = Error_1\.GauntletError\.GauntletErrorCode\.UNKNOWN;/try { e.code = Error_1.GauntletError.GauntletErrorCode.UNKNOWN; } catch (_) {}/' "$TARGET" + rm -f "${TARGET}.bak" + echo "postinstall: patched gauntlet-core cli.js (.code assignment)" + else + echo "postinstall: gauntlet-core cli.js already patched or changed" + fi +else + echo "postinstall: gauntlet-core cli.js not found, skipping patch" +fi diff --git a/yarn.lock b/yarn.lock index 33e149010..e5a9f2927 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3819,7 +3819,7 @@ __metadata: jest: "npm:^30.0.0" pkg: "npm:^5.2.1" prettier: "npm:2.1.1" - starknet: "npm:7.0.1" + starknet: "patch:starknet@npm%3A7.0.1#./.yarn/patches/starknet-npm-7.0.1-89bc8c73a3.patch" ts-jest: "npm:^29.0.0" ts-node: "npm:^10.8.0" typescript: "npm:^5.4.5" @@ -8356,6 +8356,26 @@ __metadata: languageName: node linkType: hard +"starknet@patch:starknet@npm%3A7.0.1#./.yarn/patches/starknet-npm-7.0.1-89bc8c73a3.patch::locator=chainlink-starknet%40workspace%3A.": + version: 7.0.1 + resolution: "starknet@patch:starknet@npm%3A7.0.1#./.yarn/patches/starknet-npm-7.0.1-89bc8c73a3.patch::version=7.0.1&hash=6f2c0f&locator=chainlink-starknet%40workspace%3A." + dependencies: + "@noble/curves": "npm:1.7.0" + "@noble/hashes": "npm:1.6.0" + "@scure/base": "npm:1.2.1" + "@scure/starknet": "npm:1.1.0" + abi-wan-kanabi: "npm:2.2.4" + isows: "npm:^1.0.6" + lossless-json: "npm:^4.0.1" + pako: "npm:^2.0.4" + starknet-types-07: "npm:@starknet-io/types-js@^0.7.10" + starknet-types-08: "npm:@starknet-io/types-js@0.8.0-beta.10" + ts-mixer: "npm:^6.0.3" + ws: "npm:^8.18.0" + checksum: 10c0/d50f060b64099a05aaf2fc33c77ccac00c25570f6329d07b628d88d5ceda7ae76d2244e2067052d82c8054b4ab5b75bbc9400a6cb087811c2aab340190cf5728 + languageName: node + linkType: hard + "statuses@npm:~2.0.2": version: 2.0.2 resolution: "statuses@npm:2.0.2"