diff --git a/.github/workflows/api-kit-e2e-test.yml b/.github/workflows/api-kit-e2e-test.yml index 4c005b276..b1e12d337 100644 --- a/.github/workflows/api-kit-e2e-test.yml +++ b/.github/workflows/api-kit-e2e-test.yml @@ -24,12 +24,6 @@ jobs: - name: Build run: yarn build - - name: Make testing-kit.js executable - run: chmod +x packages/testing-kit/dist/bin/testing-kit.js - - - name: Add script directory to PATH - run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - - name: Test run: | cd packages/api-kit diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 8bd3b7490..0378f8127 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,10 +24,6 @@ jobs: - run: | yarn install --frozen-lockfile yarn build - - name: Make testing-kit.js executable - run: chmod +x packages/testing-kit/dist/bin/testing-kit.js - - name: Add script directory to PATH - run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit diff --git a/.github/workflows/sdk-test.yml b/.github/workflows/sdk-test.yml index d16eb9f17..cf1427e25 100644 --- a/.github/workflows/sdk-test.yml +++ b/.github/workflows/sdk-test.yml @@ -25,12 +25,6 @@ jobs: - name: Build run: yarn build - - name: Make testing-kit.js executable - run: chmod +x packages/testing-kit/dist/bin/testing-kit.js - - - name: Add script directory to PATH - run: echo "$(pwd)/packages/testing-kit/dist/bin" >> $GITHUB_PATH - - name: Test env: PRIVATE_KEY: ${{ secrets.TESTING_PRIVATE_KEY }} diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index fca620913..f29b2756e 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -12,13 +12,13 @@ "API" ], "scripts": { - "test:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", - "test:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", - "test:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit.js test 'tests/endpoint/*.test.*'", + "test:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", + "test:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", + "test:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit test 'tests/endpoint/*.test.*'", "test": "yarn test:viem", - "test:ci:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", - "test:ci:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", - "test:ci:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit.js test 'tests/e2e/*.test.*'", + "test:ci:web3": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=web3 && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", + "test:ci:ethers": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=ethers && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", + "test:ci:viem": "export HARDHAT_NETWORK=sepolia && export ETH_LIB=viem && nyc --reporter=lcov testing-kit test 'tests/e2e/*.test.*'", "test:ci": "yarn test:ci:viem", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", @@ -40,7 +40,7 @@ "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "devDependencies": { "@safe-global/relay-kit": "^3.1.0", - "@safe-global/testing-kit": "^0.0.1-alpha.0", + "@safe-global/testing-kit": "^0.0.1-alpha.1", "@types/chai": "^4.3.19", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.8", diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 57cddfcb9..7c05ed867 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -16,21 +16,21 @@ "update-safe-deployments": "ts-node scripts/safe-deployments/updateLocalNetworks.ts", "check-short-name-integrity": "ts-node scripts/safe-deployments/checkShortNameIntegrity.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit.js deploy && nyc testing-kit.js test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && testing-kit deploy && nyc testing-kit test 'tests/e2e/*.test.*'", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", @@ -52,7 +52,7 @@ "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "devDependencies": { "@safe-global/safe-passkey": "0.2.0-alpha.1", - "@safe-global/testing-kit": "^0.0.1-alpha.0", + "@safe-global/testing-kit": "^0.0.1-alpha.1", "@types/chai": "^4.3.19", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.8", diff --git a/packages/protocol-kit/src/utils/eip-712/encode.ts b/packages/protocol-kit/src/utils/eip-712/encode.ts index 88213ec13..49d1e4510 100644 --- a/packages/protocol-kit/src/utils/eip-712/encode.ts +++ b/packages/protocol-kit/src/utils/eip-712/encode.ts @@ -1,4 +1,4 @@ -import { EIP712TypedData, TypedDataTypes, TypedMessageTypes } from 'packages/types-kit/dist/src' +import { EIP712TypedData, TypedDataTypes, TypedMessageTypes } from '@safe-global/types-kit' import { keccak256, concat, diff --git a/packages/testing-kit/bin/testing-kit.ts b/packages/testing-kit/bin/testing-kit.js similarity index 78% rename from packages/testing-kit/bin/testing-kit.ts rename to packages/testing-kit/bin/testing-kit.js index 57a7b9445..bbc371e4c 100755 --- a/packages/testing-kit/bin/testing-kit.ts +++ b/packages/testing-kit/bin/testing-kit.js @@ -1,11 +1,12 @@ #!/usr/bin/env node +/* eslint-disable @typescript-eslint/no-var-requires */ -import { execSync } from 'child_process' -import path from 'path' -import fs from 'fs' +const { execSync } = require('child_process') +const path = require('path') +const fs = require('fs') // Resolve the root directory of the package -const packageRoot = path.resolve(__dirname, '../../') +const packageRoot = path.resolve(__dirname, '../') const projectRoot = process.cwd() // Capture the command and arguments @@ -42,6 +43,6 @@ try { execSync(`yarn ${command}`, { stdio: 'inherit' }) } } catch (error) { - console.error(`Failed to execute Hardhat command: ${(error as Error).message}`) + console.error(`Failed to execute Hardhat command: ${error.message}`) process.exit(1) } diff --git a/packages/testing-kit/package.json b/packages/testing-kit/package.json index ffe70e29a..e721587f5 100644 --- a/packages/testing-kit/package.json +++ b/packages/testing-kit/package.json @@ -1,6 +1,6 @@ { "name": "@safe-global/testing-kit", - "version": "0.0.1-alpha.0", + "version": "0.0.1-alpha.1", "description": "Helper package providing testing utilities", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -16,7 +16,7 @@ "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", "unbuild": "rimraf dist artifacts deployments cache .nyc_output *.tsbuildinfo", - "build": "yarn unbuild && hardhat compile && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && chmod +x dist/bin/testing-kit.js", + "build": "yarn unbuild && hardhat compile && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json", "deploy": "hardhat deploy", "compile": "hardhat compile", "test": "hardhat test" @@ -49,7 +49,7 @@ "semver": "^7.6.3" }, "bin": { - "testing-kit": "./dist/bin/testing-kit.js" + "testing-kit": "./bin/testing-kit.js" }, "peerDependencies": { "hardhat": "^2.19.3"