From 061c1b18422fb886fa2b854f0c531e545e94c134 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:30:22 +0100 Subject: [PATCH 01/11] build(deps-dev): bump @commitlint/config-conventional (#1633) Bumps [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/config-conventional) from 19.5.0 to 19.6.0. - [Release notes](https://github.com/conventional-changelog/commitlint/releases) - [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/CHANGELOG.md) - [Commits](https://github.com/conventional-changelog/commitlint/commits/v19.6.0/@commitlint/config-conventional) --- updated-dependencies: - dependency-name: "@commitlint/config-conventional" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index cb85c9cb7..8c0dba943 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "devDependencies": { "@changesets/cli": "^2.27.7", "@commitlint/cli": "^19.6.1", - "@commitlint/config-conventional": "^19.1.0", + "@commitlint/config-conventional": "^19.6.0", "@eslint/eslintrc": "^3.1.0", "@eslint/js": "^9.17.0", "@jest/globals": "^29.7.0", diff --git a/yarn.lock b/yarn.lock index 91383629a..f622bfc9b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1911,10 +1911,10 @@ tinyexec "^0.3.0" yargs "^17.0.0" -"@commitlint/config-conventional@^19.1.0": - version "19.5.0" - resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-19.5.0.tgz#f838cdaed0e0e223cdc2e865f055d474a49fe18c" - integrity sha512-OBhdtJyHNPryZKg0fFpZNOBM1ZDbntMvqMuSmpfyP86XSfwzGw4CaoYRG4RutUPg0BTK07VMRIkNJT6wi2zthg== +"@commitlint/config-conventional@^19.6.0": + version "19.6.0" + resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-19.6.0.tgz#badba72c8639ea79291e2941001bd7ea7fad3a2c" + integrity sha512-DJT40iMnTYtBtUfw9ApbsLZFke1zKh6llITVJ+x9mtpHD08gsNXaIRqHTmwTZL3dNX5+WoyK7pCN/5zswvkBCQ== dependencies: "@commitlint/types" "^19.5.0" conventional-changelog-conventionalcommits "^7.0.2" From 8e8d5b7fabd1e75aa1b1a4e722cacc166da731f1 Mon Sep 17 00:00:00 2001 From: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:39:53 +0100 Subject: [PATCH 02/11] fix: move license (#1638) --- .github/LICENSE.md => LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/LICENSE.md => LICENSE (97%) diff --git a/.github/LICENSE.md b/LICENSE similarity index 97% rename from .github/LICENSE.md rename to LICENSE index c2a79355a..10816bfa6 100644 --- a/.github/LICENSE.md +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 vechain +Copyright (c) 2025 VeChain Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 3d0571de4a48006a9b05f55ac56e48fa31576d9a Mon Sep 17 00:00:00 2001 From: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:24:49 +0100 Subject: [PATCH 03/11] chore: 2.0.0 release (#1639) --- apps/sdk-cloudflare-integration/package.json | 4 ++-- apps/sdk-hardhat-integration/package.json | 8 ++++---- apps/sdk-nextjs-integration/package.json | 6 +++--- apps/sdk-node-integration/package.json | 6 +++--- apps/sdk-vite-integration/package.json | 6 +++--- docs/package.json | 6 +++--- packages/aws-kms-adapter/package.json | 8 ++++---- packages/core/package.json | 6 +++--- packages/errors/package.json | 2 +- packages/ethers-adapter/package.json | 8 ++++---- packages/hardhat-plugin/package.json | 12 ++++++------ packages/logging/package.json | 4 ++-- packages/network/package.json | 8 ++++---- packages/rpc-proxy/package.json | 12 ++++++------ scripts/pre-release.ts | 2 +- 15 files changed, 49 insertions(+), 49 deletions(-) diff --git a/apps/sdk-cloudflare-integration/package.json b/apps/sdk-cloudflare-integration/package.json index 3dc418d28..b88f62953 100644 --- a/apps/sdk-cloudflare-integration/package.json +++ b/apps/sdk-cloudflare-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-cloudflare-integration", "description": "An example app of how to integrate the VeChain SDK with Cloudflare Workers", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "private": true, "author": "VeChain Foundation", "license": "MIT", @@ -16,6 +16,6 @@ "wrangler": "^3.72.3" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.5" + "@vechain/sdk-core": "2.0.0-beta.1" } } \ No newline at end of file diff --git a/apps/sdk-hardhat-integration/package.json b/apps/sdk-hardhat-integration/package.json index e24a21249..82c480e60 100644 --- a/apps/sdk-hardhat-integration/package.json +++ b/apps/sdk-hardhat-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-hardhat-integration", "description": "An example app of how to use the @vechain/sdk-hardhat-plugin to interact with the VeChainThor blockchain", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "private": true, "main": "index.js", "author": "VeChain Foundation", @@ -18,9 +18,9 @@ }, "dependencies": { "@openzeppelin/contracts": "^5.1.0", - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-hardhat-plugin": "1.0.0-rc.5", - "@vechain/sdk-logging": "1.0.0-rc.5" + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-hardhat-plugin": "2.0.0-beta.1", + "@vechain/sdk-logging": "2.0.0-beta.1" }, "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", diff --git a/apps/sdk-nextjs-integration/package.json b/apps/sdk-nextjs-integration/package.json index d5bf48d95..e1b1776d0 100644 --- a/apps/sdk-nextjs-integration/package.json +++ b/apps/sdk-nextjs-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-nextjs-integration", "description": "An example app of how to integrate the VeChain SDK with Next.js", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "private": true, "author": "VeChain Foundation", "license": "MIT", @@ -15,8 +15,8 @@ "test:e2e": "playwright test" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-network": "1.0.0-rc.5", + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-network": "2.0.0-beta.1", "install": "^0.13.0", "next": "15.1.2", "react": "^18", diff --git a/apps/sdk-node-integration/package.json b/apps/sdk-node-integration/package.json index d1c9219b4..51f13ebc8 100644 --- a/apps/sdk-node-integration/package.json +++ b/apps/sdk-node-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-node-integration", "description": "An example app of how to integrate the VeChain SDK with Node.js", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "private": true, "main": "dist/index.js", "types": "src/index.ts", @@ -13,7 +13,7 @@ "test": "jest" }, "dependencies": { - "@vechain/sdk-network": "1.0.0-rc.5" + "@vechain/sdk-network": "2.0.0-beta.1" }, "devDependencies": { "@jest/globals": "^29.7.0", @@ -22,4 +22,4 @@ "ts-node": "^10.9.2", "typescript": "^5.6.3" } -} +} \ No newline at end of file diff --git a/apps/sdk-vite-integration/package.json b/apps/sdk-vite-integration/package.json index 40932427d..b8fe03065 100644 --- a/apps/sdk-vite-integration/package.json +++ b/apps/sdk-vite-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-vite-integration", "private": true, - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "type": "module", "scripts": { "dev": "vite", @@ -12,8 +12,8 @@ "test:e2e": "playwright test" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-network": "1.0.0-rc.5", + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-network": "2.0.0-beta.1", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.27.0" diff --git a/docs/package.json b/docs/package.json index b843f45e2..c966ff64e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "private": true, "description": "Official documentation for the VeChain TypeScript SDK with examples", "author": "VeChain Foundation", @@ -17,8 +17,8 @@ "test:examples:solo": "(yarn start-thor-solo && yarn test:examples && yarn stop-thor-solo) || yarn stop-thor-solo" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-network": "1.0.0-rc.5" + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-network": "2.0.0-beta.1" }, "devDependencies": { "expect": "^29.7.0", diff --git a/packages/aws-kms-adapter/package.json b/packages/aws-kms-adapter/package.json index 694d262b7..aff1dac06 100644 --- a/packages/aws-kms-adapter/package.json +++ b/packages/aws-kms-adapter/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-aws-kms-adapter", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "description": "This module implements the VeChain abstract signer so it is integrated with AWS KMS", "author": "VeChain Foundation", "license": "MIT", @@ -40,9 +40,9 @@ "dependencies": { "@aws-sdk/client-kms": "^3.723.0", "@noble/curves": "^1.7.0", - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-errors": "1.0.0-rc.5", - "@vechain/sdk-network": "1.0.0-rc.5", + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-errors": "2.0.0-beta.1", + "@vechain/sdk-network": "2.0.0-beta.1", "asn1js": "^3.0.5", "ethers": "6.13.4", "viem": "^2.21.54" diff --git a/packages/core/package.json b/packages/core/package.json index c09942930..fa7c1ecf2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-core", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "description": "This module is crafted for dApp development and various blockchain operations that seamlessly unfold offline", "author": "VeChain Foundation", "license": "MIT", @@ -44,8 +44,8 @@ "@scure/base": "^1.2.1", "@scure/bip32": "^1.4.0", "@scure/bip39": "^1.4.0", - "@vechain/sdk-errors": "1.0.0-rc.5", - "@vechain/sdk-logging": "1.0.0-rc.5", + "@vechain/sdk-errors": "2.0.0-beta.1", + "@vechain/sdk-logging": "2.0.0-beta.1", "abitype": "^1.0.8", "ethers": "6.13.4", "fast-json-stable-stringify": "^2.1.0", diff --git a/packages/errors/package.json b/packages/errors/package.json index 2c1218c5f..62ea599bc 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-errors", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "description": "This module is dedicated to managing and customizing errors within the VeChain SDK", "author": "VeChain Foundation", "license": "MIT", diff --git a/packages/ethers-adapter/package.json b/packages/ethers-adapter/package.json index cbb4962a6..cc86a4799 100644 --- a/packages/ethers-adapter/package.json +++ b/packages/ethers-adapter/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-ethers-adapter", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "description": "This module serves as a crucial bridge between the standard Ethereum tooling provided by Hardhat and the unique features of the VeChainThor blockchain", "author": "VeChain Foundation", "license": "MIT", @@ -33,9 +33,9 @@ "test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-errors": "1.0.0-rc.5", - "@vechain/sdk-network": "1.0.0-rc.5", + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-errors": "2.0.0-beta.1", + "@vechain/sdk-network": "2.0.0-beta.1", "ethers": "6.13.4" } } \ No newline at end of file diff --git a/packages/hardhat-plugin/package.json b/packages/hardhat-plugin/package.json index ecea6c081..c9a1d9d45 100644 --- a/packages/hardhat-plugin/package.json +++ b/packages/hardhat-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-hardhat-plugin", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "description": "This module allows to create smart contracts and interact with them using the VeChain SDK and Hardhat", "author": "VeChain Foundation", "license": "MIT", @@ -38,11 +38,11 @@ }, "dependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.8", - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-errors": "1.0.0-rc.5", - "@vechain/sdk-ethers-adapter": "1.0.0-rc.5", - "@vechain/sdk-logging": "1.0.0-rc.5", - "@vechain/sdk-network": "1.0.0-rc.5", + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-errors": "2.0.0-beta.1", + "@vechain/sdk-ethers-adapter": "2.0.0-beta.1", + "@vechain/sdk-logging": "2.0.0-beta.1", + "@vechain/sdk-network": "2.0.0-beta.1", "ethers": "6.13.4", "hardhat": "^2.22.15" } diff --git a/packages/logging/package.json b/packages/logging/package.json index 05abc2f0a..3150275e2 100644 --- a/packages/logging/package.json +++ b/packages/logging/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-logging", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "description": "This module provides functionality to logging data for vechain-sdk", "author": "VeChain Foundation", "license": "MIT", @@ -34,6 +34,6 @@ "test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit" }, "dependencies": { - "@vechain/sdk-errors": "1.0.0-rc.5" + "@vechain/sdk-errors": "2.0.0-beta.1" } } \ No newline at end of file diff --git a/packages/network/package.json b/packages/network/package.json index 9d8517f6d..667370039 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-network", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "description": "This module serves as the standard interface connecting decentralized applications (dApps) and users to the VeChainThor blockchain", "author": "VeChain Foundation", "license": "MIT", @@ -42,9 +42,9 @@ }, "dependencies": { "@noble/curves": "^1.7.0", - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-errors": "1.0.0-rc.5", - "@vechain/sdk-logging": "1.0.0-rc.5", + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-errors": "2.0.0-beta.1", + "@vechain/sdk-logging": "2.0.0-beta.1", "@vechain/vebetterdao-contracts": "^4.1.0", "abitype": "^1.0.8", "ethers": "6.13.4", diff --git a/packages/rpc-proxy/package.json b/packages/rpc-proxy/package.json index e97791592..6c8f165d1 100644 --- a/packages/rpc-proxy/package.json +++ b/packages/rpc-proxy/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-rpc-proxy", - "version": "1.0.0-rc.5", + "version": "2.0.0-beta.1", "description": "Proxy Thor's RESTful API to Eth JSON-RPC", "author": "VeChain Foundation", "license": "MIT", @@ -39,10 +39,10 @@ "test:browser": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit --config ./jest.config.browser.js" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.5", - "@vechain/sdk-errors": "1.0.0-rc.5", - "@vechain/sdk-logging": "1.0.0-rc.5", - "@vechain/sdk-network": "1.0.0-rc.5", + "@vechain/sdk-core": "2.0.0-beta.1", + "@vechain/sdk-errors": "2.0.0-beta.1", + "@vechain/sdk-logging": "2.0.0-beta.1", + "@vechain/sdk-network": "2.0.0-beta.1", "commander": "^12.1.0", "cors": "^2.8.5", "express": "^4.21.2" @@ -54,4 +54,4 @@ "cross-env": "^7.0.3", "testcontainers": "^10.14.0" } -} +} \ No newline at end of file diff --git a/scripts/pre-release.ts b/scripts/pre-release.ts index 763af5ede..715910a2f 100644 --- a/scripts/pre-release.ts +++ b/scripts/pre-release.ts @@ -84,7 +84,7 @@ const preparePackages = async () => { const version = process.argv[2]; // NOTE: Remote the beta tag from the version in the future - if (!version?.match(/^\d+\.\d+\.\d+(-rc\.\d+)?$/)) { + if (!version?.match(/^\d+\.\d+\.\d+(-beta\.\d+)?$/)) { console.error( `🚨 You must specify a semantic version as the first argument 🚨` ); From ab6a8609c910d4e1275548e217b4d4e9cd29d75c Mon Sep 17 00:00:00 2001 From: Clayton Neal Date: Thu, 9 Jan 2025 14:33:44 +0000 Subject: [PATCH 04/11] chore: dependabot config (#1641) --- .github/dependabot.yml | 8 ++++++++ dependabot.yml | 21 --------------------- 2 files changed, 8 insertions(+), 21 deletions(-) delete mode 100644 dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 27d1e4fe0..86fe42153 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,3 +18,11 @@ updates: day: "wednesday" pull-request-branch-name: separator: "-" + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + day: "wednesday" + target-branch: "1.0.0" + pull-request-branch-name: + separator: "-" diff --git a/dependabot.yml b/dependabot.yml deleted file mode 100644 index d2bc2d882..000000000 --- a/dependabot.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: 2 -updates: - # For the `main` branch - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "weekly" - target-branch: "main" - dependency-type: "all" - pull-request-branch-name: - separator: "-" - - # For the `1.0.0` release branch - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "weekly" - target-branch: "1.0.0" - dependency-type: "all" - pull-request-branch-name: - separator: "-" \ No newline at end of file From 5771ed4b433df8595579fc56d0982d9226538061 Mon Sep 17 00:00:00 2001 From: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:52:10 +0100 Subject: [PATCH 05/11] feat(EIP712): deduce `primaryType` if not provided (#1632) * fix: make primaryType optional * fix: fix failing tests * fix: revert import * fix: fix failing tests * fix: deducing primary type --------- Co-authored-by: Miguel Angel Rojo Fernandez Co-authored-by: Miguel Angel Rojo --- .../aws-kms-adapter/src/KMSVeChainSigner.ts | 76 +----------- .../tests/KMSVeChainSigner.solo.test.ts | 21 +++- .../tests/KMSVeChainSigner.unit.test.ts | 13 +- .../eth_signTypedData_v4.ts | 11 +- .../network/src/signer/signers/types.d.ts | 16 ++- .../vechain-abstract-signer.ts | 114 ++++++++++++++++-- .../vechain-private-key-signer.ts | 104 ++-------------- .../vechain-private-key-signer.unit.test.ts | 40 +++--- 8 files changed, 192 insertions(+), 203 deletions(-) diff --git a/packages/aws-kms-adapter/src/KMSVeChainSigner.ts b/packages/aws-kms-adapter/src/KMSVeChainSigner.ts index 84904c663..611659136 100644 --- a/packages/aws-kms-adapter/src/KMSVeChainSigner.ts +++ b/packages/aws-kms-adapter/src/KMSVeChainSigner.ts @@ -1,7 +1,7 @@ import { bytesToHex, concatBytes } from '@noble/curves/abstract/utils'; import { type SignatureType } from '@noble/curves/abstract/weierstrass'; import { secp256k1 } from '@noble/curves/secp256k1'; -import { Address, Hex, Keccak256, Transaction, Txt } from '@vechain/sdk-core'; +import { Address, Hex, Transaction } from '@vechain/sdk-core'; import { JSONRPCInvalidParams, SignerMethodError } from '@vechain/sdk-errors'; import { type AvailableVeChainProviders, @@ -11,13 +11,7 @@ import { VeChainAbstractSigner } from '@vechain/sdk-network'; import { BitString, ObjectIdentifier, Sequence, verifySchema } from 'asn1js'; -import { - hashTypedData, - recoverPublicKey, - toHex, - type TypedDataDomain, - type TypedDataParameter -} from 'viem'; +import { recoverPublicKey, toHex } from 'viem'; import { KMSVeChainProvider } from './KMSVeChainProvider'; class KMSVeChainSigner extends VeChainAbstractSigner { @@ -157,7 +151,7 @@ class KMSVeChainSigner extends VeChainAbstractSigner { } /** - * It builds a VeChain signature from a bytes payload. + * It builds a VeChain signature from a bytes' payload. * @param {Uint8Array} payload to sign. * @param {KMSVeChainProvider} kmsProvider The provider to sign the payload. * @returns {Uint8Array} The signature following the VeChain format. @@ -188,12 +182,10 @@ class KMSVeChainSigner extends VeChainAbstractSigner { kmsProvider ); - const decodedSignature = concatBytes( + return concatBytes( decodedSignatureWithoutRecoveryBit.toCompactRawBytes(), new Uint8Array([recoveryBit]) ); - - return decodedSignature; } /** @@ -314,7 +306,7 @@ class KMSVeChainSigner extends VeChainAbstractSigner { /** * Submits a signed transaction to the network. - * @param transactionToSend Transaction to by signed and sent to the network. + * @param transactionToSend Transaction to be signed and sent to the network. * @returns {string} The transaction ID. */ public async sendTransaction( @@ -345,69 +337,13 @@ class KMSVeChainSigner extends VeChainAbstractSigner { * @param {Uint8Array} payload in bytes to sign. * @returns {string} The VeChain signature in hexadecimal format. */ - private async signPayload(payload: Uint8Array): Promise { + public async signPayload(payload: Uint8Array): Promise { const veChainSignature = await this.buildVeChainSignatureFromPayload(payload); // SCP256K1 encodes the recovery flag in the last byte. EIP-191 adds 27 to it. veChainSignature[veChainSignature.length - 1] += 27; return Hex.of(veChainSignature).toString(); } - - /** - * Signs a message returning the VeChain signature in hexadecimal format. - * @param {string | Uint8Array} message to sign. - * @returns {string} The VeChain signature in hexadecimal format. - */ - public async signMessage(message: string | Uint8Array): Promise { - try { - const payload = - typeof message === 'string' ? Txt.of(message).bytes : message; - const payloadHashed = Keccak256.of( - concatBytes( - this.MESSAGE_PREFIX, - Txt.of(payload.length).bytes, - payload - ) - ).bytes; - return await this.signPayload(payloadHashed); - } catch (error) { - throw new SignerMethodError( - 'KMSVeChainSigner.signMessage', - 'The message could not be signed.', - { message }, - error - ); - } - } - - /** - * Signs a typed data returning the VeChain signature in hexadecimal format. - * @param {TypedDataDomain} domain to hash as typed data. - * @param {Record} types to hash as typed data. - * @param {Record} value to hash as typed data. - * @returns {string} The VeChain signature in hexadecimal format. - */ - public async signTypedData( - domain: TypedDataDomain, - types: Record, - primaryType: string, - message: Record - ): Promise { - try { - const payload = Hex.of( - hashTypedData({ domain, types, primaryType, message }) - ).bytes; - - return await this.signPayload(payload); - } catch (error) { - throw new SignerMethodError( - 'KMSVeChainSigner.signTypedData', - 'The typed data could not be signed.', - { domain, types, primaryType, message }, - error - ); - } - } } export { KMSVeChainSigner }; diff --git a/packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts b/packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts index 6ad998f5b..cd4f33379 100644 --- a/packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts +++ b/packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts @@ -299,12 +299,27 @@ describe('KMSVeChainSigner - Thor Solo', () => { const signature = await signer.signTypedData( typedData.domain, typedData.types, - typedData.primaryType, - typedData.data + typedData.data, + typedData.primaryType ); expect(signature).toBeDefined(); // 64-bytes hex string - expect(signature.length).toBe(132); + expect(signature).toMatch(/^0x[A-Fa-f0-9]{130}$/); + + const signatureWithoutPrimaryType = await signer.signTypedData( + typedData.domain, + typedData.types, + typedData.data + ); + expect(signatureWithoutPrimaryType).toBeDefined(); + // 64-bytes hex string + expect(signatureWithoutPrimaryType).toMatch(/^0x[A-Fa-f0-9]{130}$/); + + // Not checking directly the signatures since there is an issue in LocalStack: + // https://github.com/localstack/localstack/issues/11678 + // Looks like, regardless the configuration, a new SECP256r1 key is generated + // meaning that the signature will be different every time. + // However both hashes have been checked and they match, + tests in the other implementation. }); }); }); diff --git a/packages/aws-kms-adapter/tests/KMSVeChainSigner.unit.test.ts b/packages/aws-kms-adapter/tests/KMSVeChainSigner.unit.test.ts index 90b76fa91..9dad5a409 100644 --- a/packages/aws-kms-adapter/tests/KMSVeChainSigner.unit.test.ts +++ b/packages/aws-kms-adapter/tests/KMSVeChainSigner.unit.test.ts @@ -3,9 +3,10 @@ import { JSONRPCInvalidParams, SignerMethodError } from '@vechain/sdk-errors'; import { VeChainProvider, type ThorClient, - type TransactionRequestInput + type TransactionRequestInput, + type TypedDataDomain, + type TypedDataParameter } from '@vechain/sdk-network'; -import { type TypedDataDomain, type TypedDataParameter } from 'viem'; import { KMSVeChainProvider, KMSVeChainSigner } from '../src'; import { EIP712_CONTRACT, EIP712_FROM, EIP712_TO } from './fixture'; jest.mock('asn1js', () => ({ @@ -136,7 +137,6 @@ describe('KMSVeChainSigner', () => { } ] }, - 'Mail', { from: { name: 'Cow', @@ -147,7 +147,8 @@ describe('KMSVeChainSigner', () => { wallet: EIP712_TO }, contents: 'Hello, Bob!' - } + }, + 'Mail' ) ).rejects.toThrow(SignerMethodError); }); @@ -161,8 +162,8 @@ describe('KMSVeChainSigner', () => { signer.signTypedData( {} as unknown as TypedDataDomain, {} as unknown as Record, - 'primaryType', - {} as unknown as Record + {} as unknown as Record, + 'primaryType' ) ).rejects.toThrow(SignerMethodError); }); diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.ts index b8ff51365..9ae31685b 100644 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.ts +++ b/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.ts @@ -4,8 +4,11 @@ import { JSONRPCInvalidParams, stringifyData } from '@vechain/sdk-errors'; -import type { TypedDataDomain, TypedDataParameter } from 'viem'; -import type { VeChainSigner } from '../../../../../signer/signers'; +import type { + TypedDataDomain, + TypedDataParameter, + VeChainSigner +} from '../../../../../signer/signers'; import type { ThorClient } from '../../../../../thor-client'; import type { VeChainProvider } from '../../../../providers/vechain-provider'; @@ -74,8 +77,8 @@ const ethSignTypedDataV4 = async ( return await signer.signTypedData( typedData.domain, typedData.types, - typedData.primaryType, - typedData.message + typedData.message, + typedData.primaryType ); } catch (error) { throw new JSONRPCInternalError( diff --git a/packages/network/src/signer/signers/types.d.ts b/packages/network/src/signer/signers/types.d.ts index eac69d4a3..cd320daa6 100644 --- a/packages/network/src/signer/signers/types.d.ts +++ b/packages/network/src/signer/signers/types.d.ts @@ -1,5 +1,8 @@ import { type TransactionClause } from '@vechain/sdk-core'; -import { type TypedDataDomain, type TypedDataParameter } from 'viem'; +import type { + TypedDataDomain as viemTypedDataDomain, + TypedDataParameter as viemTypedDataParameter +} from 'viem'; import { type HardhatVeChainProvider, type VeChainProvider @@ -13,6 +16,13 @@ import { */ type AvailableVeChainProviders = VeChainProvider | HardhatVeChainProvider; +/** + * EIP-712 types in case we change the provider (viem as of now) + */ + +type TypedDataDomain = viemTypedDataDomain; +type TypedDataParameter = viemTypedDataParameter; + /** * Type for transaction input * @@ -371,8 +381,8 @@ interface VeChainSigner { signTypedData: ( domain: TypedDataDomain, types: Record, - primaryType: string, message: Record, + primaryType?: string, options?: SignTypedDataOptions ) => Promise; @@ -384,6 +394,8 @@ interface VeChainSigner { export { type AvailableVeChainProviders, + type TypedDataDomain, + type TypedDataParameter, type SignTypedDataOptions, type TransactionRequestInput, type VeChainSigner diff --git a/packages/network/src/signer/signers/vechain-abstract-signer/vechain-abstract-signer.ts b/packages/network/src/signer/signers/vechain-abstract-signer/vechain-abstract-signer.ts index 60a869861..f8ccc943d 100644 --- a/packages/network/src/signer/signers/vechain-abstract-signer/vechain-abstract-signer.ts +++ b/packages/network/src/signer/signers/vechain-abstract-signer/vechain-abstract-signer.ts @@ -1,21 +1,28 @@ +import { concatBytes } from '@noble/curves/abstract/utils'; import { Address, Clause, Hex, HexUInt, + Keccak256, Txt, type TransactionBody, type TransactionClause } from '@vechain/sdk-core'; -import { InvalidDataType, JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { type TypedDataDomain, type TypedDataParameter } from 'viem'; +import { + InvalidDataType, + JSONRPCInvalidParams, + SignerMethodError +} from '@vechain/sdk-errors'; +import { hashTypedData } from 'viem'; import { RPC_METHODS } from '../../../provider/utils/const/rpc-mapper/rpc-methods'; import { type TransactionSimulationResult } from '../../../thor-client'; import { vnsUtils } from '../../../utils'; import { type AvailableVeChainProviders, - type SignTypedDataOptions, type TransactionRequestInput, + type TypedDataDomain, + type TypedDataParameter, type VeChainSigner } from '../types'; @@ -321,6 +328,13 @@ abstract class VeChainAbstractSigner implements VeChainSigner { transactionToSend: TransactionRequestInput ): Promise; + /** + * Signs a bytes payload returning the VeChain signature in hexadecimal format. + * @param {Uint8Array} payload in bytes to sign. + * @returns {string} The VeChain signature in hexadecimal format. + */ + abstract signPayload(payload: Uint8Array): Promise; + /** * Signs an [[link-eip-191]] prefixed a personal message. * @@ -330,25 +344,107 @@ abstract class VeChainAbstractSigner implements VeChainSigner { * so the string ``"0x1234"`` is signed as six characters, **not** two bytes. * @return {Promise} - A Promise that resolves to the signature as a string. */ - abstract signMessage(message: string | Uint8Array): Promise; + public async signMessage(message: string | Uint8Array): Promise { + try { + const payload = + typeof message === 'string' ? Txt.of(message).bytes : message; + const payloadHashed = Keccak256.of( + concatBytes( + this.MESSAGE_PREFIX, + Txt.of(payload.length).bytes, + payload + ) + ).bytes; + return await this.signPayload(payloadHashed); + } catch (error) { + throw new SignerMethodError( + 'VeChainAbstractSigner.signMessage', + 'The message could not be signed.', + { message }, + error + ); + } + } + + /** + * Deduces the primary from the types if not given. + * The primary type will be the only type that is not used in any other type. + * @param {Record} types - The types used for EIP712. + * @returns {string} The primary type. + */ + private deducePrimaryType( + types: Record + ): string { + const parents = new Map(); + + // Initialize parents map + Object.keys(types).forEach((type) => { + parents.set(type, []); + }); + + // Populate parents map + for (const name in types) { + for (const field of types[name]) { + // In case the type is an array, we get its prefix + const type = field.type.split('[')[0]; + if (parents.has(type)) { + parents.get(type)?.push(name); + } + } + } + + // Find primary types + const primaryTypes = Array.from(parents.keys()).filter( + (n) => parents.get(n)?.length === 0 + ); + + if (primaryTypes.length !== 1) { + throw new SignerMethodError( + 'VeChainAbstractSigner.deducePrimaryType', + 'Ambiguous primary types or unused types.', + { primaryTypes: primaryTypes.join(', ') } + ); + } + + return primaryTypes[0]; + } /** * Signs the [[link-eip-712]] typed data. * * @param {TypedDataDomain} domain - The domain parameters used for signing. * @param {Record} types - The types used for signing. - * @param {string} primaryType - The primary type used for signing. * @param {Record} message - The message data to be signed. + * @param {string} primaryType - The primary type used for signing. * * @return {Promise} - A promise that resolves with the signature string. */ - abstract signTypedData( + public async signTypedData( domain: TypedDataDomain, types: Record, - primaryType: string, message: Record, - options?: SignTypedDataOptions - ): Promise; + primaryType?: string + ): Promise { + try { + const payload = Hex.of( + hashTypedData({ + domain, + types, + primaryType: primaryType ?? this.deducePrimaryType(types), // Deduce the primary type if not provided + message + }) + ).bytes; + + return await this.signPayload(payload); + } catch (error) { + throw new SignerMethodError( + 'VeChainAbstractSigner.signTypedData', + 'The typed data could not be signed.', + { domain, types, message, primaryType }, + error + ); + } + } /** * Use vet.domains to resolve name to address diff --git a/packages/network/src/signer/signers/vechain-private-key-signer/vechain-private-key-signer.ts b/packages/network/src/signer/signers/vechain-private-key-signer/vechain-private-key-signer.ts index 069f53cee..c41a50ef8 100644 --- a/packages/network/src/signer/signers/vechain-private-key-signer/vechain-private-key-signer.ts +++ b/packages/network/src/signer/signers/vechain-private-key-signer/vechain-private-key-signer.ts @@ -1,24 +1,15 @@ -import * as n_utils from '@noble/curves/abstract/utils'; import { Address, Hex, HexUInt, - Keccak256, Secp256k1, Transaction, - type TransactionBody, - Txt + type TransactionBody } from '@vechain/sdk-core'; import { InvalidSecp256k1PrivateKey, - JSONRPCInvalidParams, - stringifyData + JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { - hashTypedData, - type TypedDataDomain, - type TypedDataParameter -} from 'viem'; import { RPC_METHODS } from '../../../provider/utils/const/rpc-mapper/rpc-methods'; import { DelegationHandler, @@ -156,93 +147,16 @@ class VeChainPrivateKeySigner extends VeChainAbstractSigner { } /** - * Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) prefixed a personal message. - * - * This function is a drop-in replacement for {@link ethers.BaseWallet.signMessage} function. + * Signs a payload. * - * @param {string|Uint8Array} message - The message to be signed. - * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. - * It is **not** interpreted as a [[BytesLike]]; - * so the string ``"0x1234"`` is signed as six characters, **not** two bytes. + * @param {Uint8Array} payload - The payload to be signed as a byte array * @return {Promise} - A Promise that resolves to the signature as a string. */ - async signMessage(message: string | Uint8Array): Promise { - return await new Promise((resolve, reject) => { - try { - const body = - typeof message === 'string' - ? Txt.of(message).bytes - : message; - const sign = Secp256k1.sign( - Keccak256.of( - n_utils.concatBytes( - this.MESSAGE_PREFIX, - Txt.of(body.length).bytes, - body - ) - ).bytes, - new Uint8Array(this.privateKey) - ); - // SCP256K1 encodes the recovery flag in the last byte. EIP-191 adds 27 to it. - sign[sign.length - 1] += 27; - resolve(Hex.of(sign).toString()); - } catch (e) { - const error = - e instanceof Error - ? e - : new Error( - e !== undefined - ? stringifyData(e) - : 'Error while signing the message' - ); - reject(error); - } - }); - } - - /** - * Signs the [[link-eip-712]] typed data. - * - * This function is a drop-in replacement for {@link ethers.BaseWallet.signTypedData} function, - * albeit Ethereum Name Services are not resolved because he resolution depends on **ethers** provider implementation. - * - * @param {TypedDataDomain} domain - The domain parameters used for signing. - * @param {Record} types - The types used for signing. - * @param {string} primaryType - The primary type used for signing. - * @param {Record} message - The value data to be signed. - * - * @return {Promise} - A promise that resolves with the signature string. - */ - async signTypedData( - domain: TypedDataDomain, - types: Record, - primaryType: string, - message: Record - ): Promise { - return await new Promise((resolve, reject) => { - try { - const hash = Hex.of( - hashTypedData({ domain, types, primaryType, message }) - ).bytes; - const sign = Secp256k1.sign( - hash, - new Uint8Array(this.privateKey) - ); - // SCP256K1 encodes the recovery flag in the last byte. EIP-712 adds 27 to it. - sign[sign.length - 1] += 27; - resolve(Hex.of(sign).toString()); - } catch (e) { - const error = - e instanceof Error - ? e - : new Error( - e !== undefined - ? stringifyData(e) - : 'Error while signing typed data' - ); - reject(error); - } - }); + async signPayload(payload: Uint8Array): Promise { + const sign = Secp256k1.sign(payload, new Uint8Array(this.privateKey)); + // SCP256K1 encodes the recovery flag in the last byte. EIP-191 adds 27 to it. + sign[sign.length - 1] += 27; + return await Promise.resolve(Hex.of(sign).toString()); } /** diff --git a/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.unit.test.ts b/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.unit.test.ts index 922ab973e..7aed3fa98 100644 --- a/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.unit.test.ts +++ b/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.unit.test.ts @@ -7,6 +7,7 @@ import { test } from '@jest/globals'; import { Address, Hex, HexUInt, Secp256k1, Txt } from '@vechain/sdk-core'; +import { SignerMethodError } from '@vechain/sdk-errors'; import { Wallet } from 'ethers'; import { TESTNET_URL, @@ -22,7 +23,6 @@ import { populateCallTestCases, populateCallTestCasesAccount } from './fixture'; -import { InvalidAbiEncodingTypeError } from 'viem'; /** * VeChain base signer tests @@ -254,7 +254,11 @@ describe('VeChain base signer tests', () => { await expect( signer.signMessage(EIP191_MESSAGE) - ).rejects.toThrowError('Error while signing the message'); + ).rejects.toThrowError( + `Method 'VeChainAbstractSigner.signMessage' failed.` + + `\n-Reason: 'The message could not be signed.'` + + `\n-Parameters: \n\t{\n "message": "Hello world! - γ“γ‚“γ«γ‘γ―δΈ–η•Œ - πŸ‘‹πŸ—ΊοΈ!"\n}` + ); }); test('signMessage - ethers compatible - string', async () => { @@ -291,10 +295,10 @@ describe('VeChain base signer tests', () => { signer.signTypedData( eip712TestCases.invalid.domain, eip712TestCases.invalid.types, - eip712TestCases.invalid.primaryType, - eip712TestCases.invalid.data + eip712TestCases.invalid.data, + eip712TestCases.invalid.primaryType ) - ).rejects.toThrowError(InvalidAbiEncodingTypeError); + ).rejects.toThrowError(SignerMethodError); }); test('signTypedData - exception when parsing to hex', async () => { @@ -315,8 +319,8 @@ describe('VeChain base signer tests', () => { signer.signTypedData( eip712TestCases.valid.domain, eip712TestCases.valid.types, - eip712TestCases.valid.primaryType, - eip712TestCases.valid.data + eip712TestCases.valid.data, + eip712TestCases.valid.primaryType ) ).rejects.toThrowError(expectedErrorString); @@ -324,10 +328,10 @@ describe('VeChain base signer tests', () => { signer.signTypedData( eip712TestCases.valid.domain, eip712TestCases.valid.types, - eip712TestCases.valid.primaryType, - eip712TestCases.valid.data + eip712TestCases.valid.data, + eip712TestCases.valid.primaryType ) - ).rejects.toThrowError('Error while signing typed data'); + ).rejects.toThrowError(SignerMethodError); }); test('signTypedData - ethers compatible', async () => { @@ -339,16 +343,24 @@ describe('VeChain base signer tests', () => { eip712TestCases.valid.data ); expect(expected).toBe(eip712TestCases.valid.signature); - const actual = await new VeChainPrivateKeySigner( + const privateKeySigner = new VeChainPrivateKeySigner( Hex.of(eip712TestCases.valid.privateKey).bytes, provider - ).signTypedData( + ); + const actual = await privateKeySigner.signTypedData( eip712TestCases.valid.domain, eip712TestCases.valid.types, - eip712TestCases.valid.primaryType, - eip712TestCases.valid.data + eip712TestCases.valid.data, + eip712TestCases.valid.primaryType ); expect(actual).toBe(expected); + const actualWithoutPrimaryType = + await privateKeySigner.signTypedData( + eip712TestCases.valid.domain, + eip712TestCases.valid.types, + eip712TestCases.valid.data + ); + expect(actualWithoutPrimaryType).toBe(expected); }); }); }); From 96f66aa38dae6063ff6a1d4c9abdd55ec8f304c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:54:52 +0000 Subject: [PATCH 06/11] build(deps): bump commander from 12.1.0 to 13.0.0 (#1636) * build(deps): bump commander from 12.1.0 to 13.0.0 Bumps [commander](https://github.com/tj/commander.js) from 12.1.0 to 13.0.0. - [Release notes](https://github.com/tj/commander.js/releases) - [Changelog](https://github.com/tj/commander.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/tj/commander.js/compare/v12.1.0...v13.0.0) --- updated-dependencies: - dependency-name: commander dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * fix: commander just supports short flags of 1 character --------- Signed-off-by: dependabot[bot] Signed-off-by: Miguel Angel Rojo Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> Co-authored-by: Miguel Angel Rojo Co-authored-by: Miguel Angel Rojo Fernandez --- packages/rpc-proxy/README.md | 14 +-- packages/rpc-proxy/package.json | 2 +- .../args-validator-and-getter.ts | 2 +- .../utils/args-validator/args-validator.ts | 8 +- .../rpc-proxy/src/utils/args/args-options.ts | 16 ++-- .../rpc-proxy/src/utils/args/env-to-args.ts | 12 ++- .../utils/args/args-options.unit.test.ts | 13 +-- .../tests/utils/args/args-parser.unit.test.ts | 86 ++++++++----------- .../env-to-args-positive-cases.unit.test.ts | 8 +- yarn.lock | 8 +- 10 files changed, 76 insertions(+), 93 deletions(-) diff --git a/packages/rpc-proxy/README.md b/packages/rpc-proxy/README.md index 8f61dd1a1..f85785ef5 100644 --- a/packages/rpc-proxy/README.md +++ b/packages/rpc-proxy/README.md @@ -78,21 +78,21 @@ So you can run the rpc-proxy with: OR `npx rpc-proxy --accounts "7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158"` - `-m, --mnemonic `: The mnemonic that the proxy server will use to sign transactions. -- `-mc, --mnemonicCount `: The number of accounts to derive from the mnemonic. -- `-mi, --mnemonicInitialIndex `: The index from which to start deriving accounts from the +- `--mnemonicCount `: The number of accounts to derive from the mnemonic. +- `--mnemonicInitialIndex `: The index from which to start deriving accounts from the mnemonic. - - -e.g.- `npx rpc-proxy -m "denial kitchen pet squirrel other broom bar gas better priority spoil cross" -mc 10 -mi 1` + - -e.g.- `npx rpc-proxy -m "denial kitchen pet squirrel other broom bar gas better priority spoil cross" --mnemonicCount 10 --mnemonicInitialIndex 1` OR `npx rpc-proxy --mnemonic "denial kitchen pet squirrel other broom bar gas better priority spoil cross" --mnemonicCount 10 --mnemonicInitialIndex 1` - **NOTE**: --mnemonic, --mnemonicCount, and --mnemonicInitialIndex MUST be used together. #### Use delegation - `-e, --enableDelegation`: Whether to enable delegation. -- `-dp, --delegatorPrivateKey `: The private key of the delegator. -- `-du, --delegatorUrl `: The URL of the delegator. - - -e.g.- `npx rpc-proxy -e -dp 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158` +- `--delegatorPrivateKey `: The private key of the delegator. +- `-d, --delegatorUrl `: The URL of the delegator. + - -e.g.- `npx rpc-proxy -e --delegatorPrivateKey 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158` OR `npx rpc-proxy --enableDelegation --delegatorPrivateKey 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158` - - -e.g.- `npx rpc-proxy -e -du https://sponsor-testnet.vechain.energy/by/...` + - -e.g.- `npx rpc-proxy -e -d https://sponsor-testnet.vechain.energy/by/...` OR `npx rpc-proxy --enableDelegation --delegatorUrl https://sponsor-testnet.vechain.energy/by/...` - **NOTE**: --delegatorPrivateKey and --delegatorUrl are mutually exclusive. - **NOTE**: if --enableDelegation is used, --delegatorPrivateKey OR --delegatorUrl MUST be used. diff --git a/packages/rpc-proxy/package.json b/packages/rpc-proxy/package.json index 6c8f165d1..632858671 100644 --- a/packages/rpc-proxy/package.json +++ b/packages/rpc-proxy/package.json @@ -43,7 +43,7 @@ "@vechain/sdk-errors": "2.0.0-beta.1", "@vechain/sdk-logging": "2.0.0-beta.1", "@vechain/sdk-network": "2.0.0-beta.1", - "commander": "^12.1.0", + "commander": "^13.0.0", "cors": "^2.8.5", "express": "^4.21.2" }, diff --git a/packages/rpc-proxy/src/utils/args-validator/args-validator-and-getter.ts b/packages/rpc-proxy/src/utils/args-validator/args-validator-and-getter.ts index 6f45e960f..d945ac251 100644 --- a/packages/rpc-proxy/src/utils/args-validator/args-validator-and-getter.ts +++ b/packages/rpc-proxy/src/utils/args-validator/args-validator-and-getter.ts @@ -154,7 +154,7 @@ const ArgsValidatorAndGetter = { 'ArgsValidatorAndGetter.delegation()', 'Both delegator private key and delegator URL are provided. Only one can be provided', { - flag: '{-dp , --delegatorPrivateKey}, {-du , --delegatorUrl}', + flag: '{--delegatorPrivateKey}, {-d , --delegatorUrl}', value: `{value not provided for security reason} , {${options.delegatorUrl as string}}` } ); diff --git a/packages/rpc-proxy/src/utils/args-validator/args-validator.ts b/packages/rpc-proxy/src/utils/args-validator/args-validator.ts index e41e6a28c..bc728ef16 100644 --- a/packages/rpc-proxy/src/utils/args-validator/args-validator.ts +++ b/packages/rpc-proxy/src/utils/args-validator/args-validator.ts @@ -226,7 +226,7 @@ const ArgsValidator = { 'ArgsValidator.mnemonicFields()', 'Invalid count provided. The parameter must be an integer', { - flag: '-mc , --mnemonicCount', + flag: '--mnemonicCount', value: String(mnemonicCount) } ); @@ -236,7 +236,7 @@ const ArgsValidator = { 'ArgsValidator.mnemonicFields()', 'Invalid initial index provided. The parameter must be an integer', { - flag: '-mi , --mnemonicInitialIndex', + flag: '--mnemonicInitialIndex', value: String(mnemonicInitialIndex) } ); @@ -266,7 +266,7 @@ const ArgsValidator = { 'ArgsValidator.delegatorPrivateKey()', 'An invalid delegator private key provided.', { - flag: '-dp , --delegatorPrivateKey', + flag: '--delegatorPrivateKey', value: 'Value will not be shown for security reasons' } ); @@ -290,7 +290,7 @@ const ArgsValidator = { 'ArgsValidator.delegatorUrl()', 'Invalid delegator url provided. The parameter must be a valid url', { - flag: '-du , --delegatorUrl', + flag: '-d , --delegatorUrl', value: delegatorUrl } ); diff --git a/packages/rpc-proxy/src/utils/args/args-options.ts b/packages/rpc-proxy/src/utils/args/args-options.ts index 03402196b..a8418ffdf 100644 --- a/packages/rpc-proxy/src/utils/args/args-options.ts +++ b/packages/rpc-proxy/src/utils/args/args-options.ts @@ -11,12 +11,12 @@ import { Command, Option, type OptionValues } from 'commander'; * * Where accounts is a space separated list of private keys (e.g. "PK1 PK2 PK3 ...") * * rpc-proxy {-m|--mnemonic} - Mnemonic to use for signing transactions - * rpc-proxy {-mc|--mnemonicCount} - Number of accounts to derive from the mnemonic - * rpc-proxy {-mi|--mnemonicInitialIndex} - Initial index to start deriving accounts from the mnemonic + * rpc-proxy {--mnemonicCount} - Number of accounts to derive from the mnemonic + * rpc-proxy {--mnemonicInitialIndex} - Initial index to start deriving accounts from the mnemonic * * rpc-proxy {-e|--enableDelegation} - Enable delegation - * rpc-proxy {-dp|--delegatorPrivateKey} - Delegator private key - * rpc-proxy {-du|--delegatorUrl} - Delegator URL + * rpc-proxy {--delegatorPrivateKey} - Delegator private key + * rpc-proxy {-d|--delegatorUrl} - Delegator URL * * rpc-proxy {-v|--verbose} - Enable verbose logging * @@ -63,13 +63,13 @@ function getOptionsFromCommandLine( ) .addOption( new Option( - '-mc, --mnemonicCount ', + '--mnemonicCount ', 'Number of accounts to derive from the mnemonic' ) ) .addOption( new Option( - '-mi, --mnemonicInitialIndex ', + '--mnemonicInitialIndex ', 'Initial index to start deriving accounts from the mnemonic' ) ) @@ -80,14 +80,14 @@ function getOptionsFromCommandLine( // Delegator configuration (private key) .addOption( new Option( - '-dp, --delegatorPrivateKey ', + '--delegatorPrivateKey ', 'Delegator private key' ) ) // Delegator configuration (url) .addOption( - new Option('-du, --delegatorUrl ', 'Delegator URL') + new Option('-d, --delegatorUrl ', 'Delegator URL') ) // Enable verbose logging diff --git a/packages/rpc-proxy/src/utils/args/env-to-args.ts b/packages/rpc-proxy/src/utils/args/env-to-args.ts index c3569d3a4..ef4b6bc12 100644 --- a/packages/rpc-proxy/src/utils/args/env-to-args.ts +++ b/packages/rpc-proxy/src/utils/args/env-to-args.ts @@ -33,9 +33,13 @@ function getArgsFromEnv(): string[] { getCliFieldFromEnv('-p', process.env.PORT, 'PORT'), getCliFieldFromEnv('-a', process.env.ACCOUNTS, 'ACCOUNTS'), getCliFieldFromEnv('-m', process.env.MNEMONIC, 'MNEMONIC'), - getCliFieldFromEnv('-mc', process.env.MNEMONIC_COUNT, 'MNEMONIC_COUNT'), getCliFieldFromEnv( - '-mi', + '--mnemonicCount', + process.env.MNEMONIC_COUNT, + 'MNEMONIC_COUNT' + ), + getCliFieldFromEnv( + '--mnemonicInitialIndex', process.env.MNEMONIC_INITIAL_INDEX, 'MNEMONIC_INITIAL_INDEX' ), @@ -45,11 +49,11 @@ function getArgsFromEnv(): string[] { 'ENABLE_DELEGATION' ), getCliFieldFromEnv( - '-dp', + '--delegatorPrivateKey', process.env.DELEGATOR_PRIVATE_KEY, 'DELEGATOR_PRIVATE_KEY' ), - getCliFieldFromEnv('-du', process.env.DELEGATOR_URL, 'DELEGATOR_URL'), + getCliFieldFromEnv('-d', process.env.DELEGATOR_URL, 'DELEGATOR_URL'), getCliFieldFromEnv('-v', process.env.VERBOSE, 'VERBOSE'), getCliFieldFromEnv( '-c', diff --git a/packages/rpc-proxy/tests/utils/args/args-options.unit.test.ts b/packages/rpc-proxy/tests/utils/args/args-options.unit.test.ts index 92e8bbfe8..3b03968c8 100644 --- a/packages/rpc-proxy/tests/utils/args/args-options.unit.test.ts +++ b/packages/rpc-proxy/tests/utils/args/args-options.unit.test.ts @@ -113,9 +113,9 @@ describe('Args options tests', () => { 'program', '-m', 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '-mi', + '--mnemonicInitialIndex', '1', - '-mc', + '--mnemonicCount', '2' ] ].forEach((args) => { @@ -161,13 +161,6 @@ describe('Args options tests', () => { 'program', '--delegatorPrivateKey', '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], - // Short syntax - [ - 'path', - 'program', - '-dp', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' ] ].forEach((args) => { const delegatorPrivateKeyOption = getOptionsFromCommandLine( @@ -190,7 +183,7 @@ describe('Args options tests', () => { // Normal syntax ['path', 'program', '--delegatorUrl', 'http://localhost:8080'], // Short syntax - ['path', 'program', '-du', 'http://localhost:8080'] + ['path', 'program', '-d', 'http://localhost:8080'] ].forEach((args) => { const delegatorUrlOption = getOptionsFromCommandLine( '1.0.0', diff --git a/packages/rpc-proxy/tests/utils/args/args-parser.unit.test.ts b/packages/rpc-proxy/tests/utils/args/args-parser.unit.test.ts index 86caf8ff2..ebf4860d9 100644 --- a/packages/rpc-proxy/tests/utils/args/args-parser.unit.test.ts +++ b/packages/rpc-proxy/tests/utils/args/args-parser.unit.test.ts @@ -166,9 +166,9 @@ describe('Args parser tests', () => { 'program', '-m', 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '-mi', + '--mnemonicInitialIndex', '1', - '-mc', + '--mnemonicCount', '2' ] ].forEach((args) => { @@ -203,7 +203,7 @@ describe('Args parser tests', () => { 'path', 'program', '-e', - '-dp', + '--delegatorPrivateKey', '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' ] ].forEach((args) => { @@ -233,20 +233,13 @@ describe('Args parser tests', () => { '--delegatorPrivateKey', '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' ], - // Short syntax - [ - 'path', - 'program', - '-dp', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], // Delegator URL // Normal syntax ['path', 'program', '--delegatorUrl', 'http://localhost:8080'], // Short syntax - ['path', 'program', '-du', 'http://localhost:8080'] + ['path', 'program', '-d', 'http://localhost:8080'] ].forEach((args) => { // Get options const options = getOptionsFromCommandLine('1.0.0', args); @@ -414,28 +407,9 @@ describe('Args parser tests', () => { 'program', '-m', 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '-mi', - '1' - ], - - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', '--mnemonicInitialIndex', '1' ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '-mi', - '1' - ], // Normal syntax [ @@ -454,8 +428,6 @@ describe('Args parser tests', () => { // Normal syntax ['path', 'program', '--mnemonicInitialIndex', '1'], - // Short syntax - ['path', 'program', '-mi', '1'], // Wrong format @@ -471,7 +443,16 @@ describe('Args parser tests', () => { '2' ], // Short syntax - ['path', 'program', '-m', 'INVALID', '-mi', '1', '-mc', '2'], + [ + 'path', + 'program', + '-m', + 'INVALID', + '--mnemonicInitialIndex', + '1', + '--mnemonicCount', + '2' + ], // Normal syntax [ @@ -490,9 +471,9 @@ describe('Args parser tests', () => { 'program', '-m', 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '-mi', + '--mnemonicInitialIndex', '-1', - '-mc', + '--mnemonicCount', '2' ], @@ -513,9 +494,9 @@ describe('Args parser tests', () => { 'program', '-m', 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '-mi', + '--mnemonicInitialIndex', '1', - '-mc', + '--mnemonicCount', '-2' ], @@ -533,7 +514,16 @@ describe('Args parser tests', () => { '2' ], // Short syntax - ['path', 'program', '-m', '', '-mi', '1', '-mc', '2'], + [ + 'path', + 'program', + '-m', + '', + '--mnemonicInitialIndex', + '1', + '--mnemonicCount', + '2' + ], // Normal syntax [ @@ -552,9 +542,9 @@ describe('Args parser tests', () => { 'program', '-m', 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '-mi', + '--mnemonicInitialIndex', '', - '-mc', + '--mnemonicCount', '2' ], @@ -575,9 +565,9 @@ describe('Args parser tests', () => { 'program', '-m', 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '-mi', + '--mnemonicInitialIndex', '1', - '-mc', + '--mnemonicCount', '' ] ].forEach((args) => { @@ -611,9 +601,9 @@ describe('Args parser tests', () => { [ 'path', 'program', - '-dp', + '--delegatorPrivateKey', '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - '-du', + '-d', 'http://localhost:8080' ], @@ -621,25 +611,21 @@ describe('Args parser tests', () => { // Normal syntax ['path', 'program', '--delegatorPrivateKey', 'INVALID'], - // Short syntax - ['path', 'program', '-dp', 'INVALID'], // Normal syntax ['path', 'program', '--delegatorUrl', 'INVALID'], // Short syntax - ['path', 'program', '-du', 'INVALID'], + ['path', 'program', '-d', 'INVALID'], // Empty fields // Normal syntax ['path', 'program', '--delegatorPrivateKey', ''], - // Short syntax - ['path', 'program', '-dp', ''], // Normal syntax ['path', 'program', '--delegatorUrl', ''], // Short syntax - ['path', 'program', '-du', ''], + ['path', 'program', '-d', ''], // Enable delegation without the delegator diff --git a/packages/rpc-proxy/tests/utils/args/env-to-args-positive-cases.unit.test.ts b/packages/rpc-proxy/tests/utils/args/env-to-args-positive-cases.unit.test.ts index 359a1171e..b0419b38a 100644 --- a/packages/rpc-proxy/tests/utils/args/env-to-args-positive-cases.unit.test.ts +++ b/packages/rpc-proxy/tests/utils/args/env-to-args-positive-cases.unit.test.ts @@ -44,15 +44,15 @@ describe('Environment variables to command line arguments positive cases', () => 'some accounts', '-m', 'some mnemonic', - '-mc', + '--mnemonicCount', '10', - '-mi', + '--mnemonicInitialIndex', '0', '-e', 'true', - '-dp', + '--delegatorPrivateKey', '0x1234567890abcdef', - '-du', + '-d', 'http://localhost:8669', '-v', 'true', diff --git a/yarn.lock b/yarn.lock index f622bfc9b..3ea9c2ac8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6818,10 +6818,10 @@ command-line-usage@^6.1.0: table-layout "^1.0.2" typical "^5.2.0" -commander@^12.1.0: - version "12.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" - integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== +commander@^13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-13.0.0.tgz#1b161f60ee3ceb8074583a0f95359a4f8701845c" + integrity sha512-oPYleIY8wmTVzkvQq10AEok6YcTC4sRUBl8F9gVuwchGVUCTbl/vhLTaQqutuuySYOsu8YTgV+OxKc/8Yvx+mQ== commander@^4.0.0: version "4.1.1" From f35dfc35d72197ff6f80bc6f0aa0446d3b861138 Mon Sep 17 00:00:00 2001 From: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:17:41 +0100 Subject: [PATCH 07/11] Fix URL issue (#1652) * fix: fix issue * chore: improve comment --- packages/network/src/http/SimpleHttpClient.ts | 6 +++++- .../tests/http/SimpleHttpClient.testnet.test.ts | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/network/src/http/SimpleHttpClient.ts b/packages/network/src/http/SimpleHttpClient.ts index 93009263d..39ec1c063 100644 --- a/packages/network/src/http/SimpleHttpClient.ts +++ b/packages/network/src/http/SimpleHttpClient.ts @@ -65,7 +65,7 @@ class SimpleHttpClient implements HttpClient { * Executes an HTTP request with the specified method, path, and optional parameters. * * @param {HttpMethod} method - The HTTP method to use for the request (e.g., GET, POST). - * @param {string} path - The URL path for the request. + * @param {string} path - The URL path for the request. Leading slashes will be automatically removed. * @param {HttpParams} [params] - Optional parameters for the request, * including query parameters, headers, body, and response validation. * {@link HttpParams.headers} override {@link SimpleHttpClient.headers}. @@ -82,6 +82,10 @@ class SimpleHttpClient implements HttpClient { controller.abort(); }, this.timeout); try { + // Remove leading slash from path + if (path.startsWith('/')) { + path = path.slice(1); + } const url = new URL(path, this.baseURL); if (params?.query != null) { Object.entries(params.query).forEach(([key, value]) => { diff --git a/packages/network/tests/http/SimpleHttpClient.testnet.test.ts b/packages/network/tests/http/SimpleHttpClient.testnet.test.ts index deeae37e7..be70cbeb8 100644 --- a/packages/network/tests/http/SimpleHttpClient.testnet.test.ts +++ b/packages/network/tests/http/SimpleHttpClient.testnet.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from '@jest/globals'; -import { SimpleHttpClient } from '../../src/http'; +import { HttpMethod, SimpleHttpClient } from '../../src/http'; import { TESTNET_URL } from '../../src'; import { ZERO_ADDRESS } from '../fixture'; import { stringifyData } from '@vechain/sdk-errors'; @@ -52,6 +52,18 @@ describe('SimpleHttpClient testnet tests', () => { TIMEOUT ); + test('Test http without leading slash', async () => { + const httpClient = new SimpleHttpClient(TESTNET_URL); + const resp = await httpClient.http(HttpMethod.GET, 'blocks/best'); + expect(resp).toBeDefined(); + }); + + test('Test http with leading slash', async () => { + const httpClient = new SimpleHttpClient(TESTNET_URL); + const resp = await httpClient.http(HttpMethod.GET, '/blocks/best'); + expect(resp).toBeDefined(); + }); + /* NOTE: this test doesn't succeed in CI/CD. Enable locally to challenge a real time-out calling testnet. From 554c6728cd90cd70ecb181457f2d8602b7baa637 Mon Sep 17 00:00:00 2001 From: Clayton Neal Date: Fri, 10 Jan 2025 11:00:09 +0000 Subject: [PATCH 08/11] chore: github workflows trigger branches (#1688) Co-authored-by: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> --- .github/workflows/gitleaks.yml | 5 ++++- .github/workflows/on-main.yml | 2 ++ .github/workflows/on-pr.yml | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index cca18858a..f7217d932 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -2,7 +2,10 @@ name: Check for leaks in secrets on: pull_request: branches: - - main + - 'main' + - 'main-*' + - 'supported-*' + - 'feature-*' permissions: contents: read # This is required for actions/checkout diff --git a/.github/workflows/on-main.yml b/.github/workflows/on-main.yml index ff100c6b2..e8614ca2e 100644 --- a/.github/workflows/on-main.yml +++ b/.github/workflows/on-main.yml @@ -5,6 +5,8 @@ on: branches: - 'main' - 'main-*' + - 'supported-*' + - 'feature-*' jobs: install-build: diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index b3ed09392..d2e0cffb1 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -3,7 +3,10 @@ name: PR Checks on: pull_request: branches: - - main + - 'main' + - 'main-*' + - 'supported-*' + - 'feature-*' jobs: doc-examples: From fcecafb590d4bf9db3206b9e21de1dac971f7932 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 12:03:00 +0100 Subject: [PATCH 09/11] build(deps): bump ethers from 6.13.4 to 6.13.5 (#1643) Bumps [ethers](https://github.com/ethers-io/ethers.js) from 6.13.4 to 6.13.5. - [Release notes](https://github.com/ethers-io/ethers.js/releases) - [Changelog](https://github.com/ethers-io/ethers.js/blob/main/CHANGELOG.md) - [Commits](https://github.com/ethers-io/ethers.js/compare/v6.13.4...v6.13.5) --- updated-dependencies: - dependency-name: ethers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> --- packages/aws-kms-adapter/package.json | 2 +- packages/core/package.json | 2 +- packages/ethers-adapter/package.json | 2 +- packages/hardhat-plugin/package.json | 2 +- packages/network/package.json | 2 +- yarn.lock | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/aws-kms-adapter/package.json b/packages/aws-kms-adapter/package.json index aff1dac06..612ecf6ba 100644 --- a/packages/aws-kms-adapter/package.json +++ b/packages/aws-kms-adapter/package.json @@ -44,7 +44,7 @@ "@vechain/sdk-errors": "2.0.0-beta.1", "@vechain/sdk-network": "2.0.0-beta.1", "asn1js": "^3.0.5", - "ethers": "6.13.4", + "ethers": "6.13.5", "viem": "^2.21.54" } } \ No newline at end of file diff --git a/packages/core/package.json b/packages/core/package.json index fa7c1ecf2..09b87c002 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -47,7 +47,7 @@ "@vechain/sdk-errors": "2.0.0-beta.1", "@vechain/sdk-logging": "2.0.0-beta.1", "abitype": "^1.0.8", - "ethers": "6.13.4", + "ethers": "6.13.5", "fast-json-stable-stringify": "^2.1.0", "viem": "^2.21.54" }, diff --git a/packages/ethers-adapter/package.json b/packages/ethers-adapter/package.json index cc86a4799..10188143d 100644 --- a/packages/ethers-adapter/package.json +++ b/packages/ethers-adapter/package.json @@ -36,6 +36,6 @@ "@vechain/sdk-core": "2.0.0-beta.1", "@vechain/sdk-errors": "2.0.0-beta.1", "@vechain/sdk-network": "2.0.0-beta.1", - "ethers": "6.13.4" + "ethers": "6.13.5" } } \ No newline at end of file diff --git a/packages/hardhat-plugin/package.json b/packages/hardhat-plugin/package.json index c9a1d9d45..856d4caae 100644 --- a/packages/hardhat-plugin/package.json +++ b/packages/hardhat-plugin/package.json @@ -43,7 +43,7 @@ "@vechain/sdk-ethers-adapter": "2.0.0-beta.1", "@vechain/sdk-logging": "2.0.0-beta.1", "@vechain/sdk-network": "2.0.0-beta.1", - "ethers": "6.13.4", + "ethers": "6.13.5", "hardhat": "^2.22.15" } } \ No newline at end of file diff --git a/packages/network/package.json b/packages/network/package.json index 667370039..678105433 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -47,7 +47,7 @@ "@vechain/sdk-logging": "2.0.0-beta.1", "@vechain/vebetterdao-contracts": "^4.1.0", "abitype": "^1.0.8", - "ethers": "6.13.4", + "ethers": "6.13.5", "isomorphic-ws": "^5.0.0", "viem": "^2.21.54", "ws": "^8.18.0" diff --git a/yarn.lock b/yarn.lock index 3ea9c2ac8..23dbfa046 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8378,10 +8378,10 @@ ethereumjs-util@^7.1.4: ethereum-cryptography "^0.1.3" rlp "^2.2.4" -ethers@6.13.4, ethers@^6.9.0: - version "6.13.4" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.4.tgz#bd3e1c3dc1e7dc8ce10f9ffb4ee40967a651b53c" - integrity sha512-21YtnZVg4/zKkCQPjrDj38B1r4nQvTZLopUGMLQ1ePU2zV/joCfDC3t3iKQjWRzjjjbzR+mdAIoikeBRNkdllA== +ethers@6.13.5, ethers@^6.9.0: + version "6.13.5" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.5.tgz#8c1d6ac988ac08abc3c1d8fabbd4b8b602851ac4" + integrity sha512-+knKNieu5EKRThQJWwqaJ10a6HE9sSehGeqWN65//wE7j47ZpFhKAnHB/JJFibwwg61I/koxaPsXbXpD/skNOQ== dependencies: "@adraffy/ens-normalize" "1.10.1" "@noble/curves" "1.2.0" From e71da21f6d90ba392db8dca4f9babfd3d5c4d00c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 12:26:42 +0100 Subject: [PATCH 10/11] build(deps-dev): bump @eslint/eslintrc from 3.1.0 to 3.2.0 (#1645) Bumps [@eslint/eslintrc](https://github.com/eslint/eslintrc) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/eslint/eslintrc/releases) - [Changelog](https://github.com/eslint/eslintrc/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslintrc/compare/v3.1.0...v3.2.0) --- updated-dependencies: - dependency-name: "@eslint/eslintrc" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 24 +++++------------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 8c0dba943..68182fb71 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "@changesets/cli": "^2.27.7", "@commitlint/cli": "^19.6.1", "@commitlint/config-conventional": "^19.6.0", - "@eslint/eslintrc": "^3.1.0", + "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", "@jest/globals": "^29.7.0", "@types/fs-extra": "^11.0.4", diff --git a/yarn.lock b/yarn.lock index 23dbfa046..1ed99737c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2468,10 +2468,10 @@ resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.7.0.tgz#a1bb4b6a4e742a5ff1894b7ee76fbf884ec72bd3" integrity sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw== -"@eslint/eslintrc@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.1.0.tgz#dbd3482bfd91efa663cbe7aa1f506839868207b6" - integrity sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ== +"@eslint/eslintrc@^3.1.0", "@eslint/eslintrc@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.2.0.tgz#57470ac4e2e283a6bf76044d63281196e370542c" + integrity sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w== dependencies: ajv "^6.12.4" debug "^4.3.2" @@ -5576,11 +5576,6 @@ acorn@^8.1.0, acorn@^8.11.0, acorn@^8.4.1, acorn@^8.8.0, acorn@^8.8.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== -acorn@^8.12.0: - version "8.13.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.13.0.tgz#2a30d670818ad16ddd6a35d3842dacec9e5d7ca3" - integrity sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w== - acorn@^8.14.0, acorn@^8.9.0: version "8.14.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" @@ -8191,16 +8186,7 @@ eslint@^9.14.0: optionator "^0.9.3" text-table "^0.2.0" -espree@^10.0.1, espree@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-10.2.0.tgz#f4bcead9e05b0615c968e85f83816bc386a45df6" - integrity sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g== - dependencies: - acorn "^8.12.0" - acorn-jsx "^5.3.2" - eslint-visitor-keys "^4.1.0" - -espree@^10.3.0: +espree@^10.0.1, espree@^10.2.0, espree@^10.3.0: version "10.3.0" resolved "https://registry.yarnpkg.com/espree/-/espree-10.3.0.tgz#29267cf5b0cb98735b65e64ba07e0ed49d1eed8a" integrity sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg== From 560f00f1268d0959a2991b9a1b35d985f5a59f40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 12:43:29 +0100 Subject: [PATCH 11/11] build(deps): bump @scure/bip39 from 1.5.0 to 1.5.1 (#1642) Bumps [@scure/bip39](https://github.com/paulmillr/scure-bip39) from 1.5.0 to 1.5.1. - [Release notes](https://github.com/paulmillr/scure-bip39/releases) - [Commits](https://github.com/paulmillr/scure-bip39/compare/1.5.0...1.5.1) --- updated-dependencies: - dependency-name: "@scure/bip39" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Fabio Rigamonti <73019897+fabiorigam@users.noreply.github.com> --- packages/core/package.json | 2 +- yarn.lock | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 09b87c002..19bae147f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -43,7 +43,7 @@ "@noble/hashes": "^1.5.0", "@scure/base": "^1.2.1", "@scure/bip32": "^1.4.0", - "@scure/bip39": "^1.4.0", + "@scure/bip39": "^1.5.1", "@vechain/sdk-errors": "2.0.0-beta.1", "@vechain/sdk-logging": "2.0.0-beta.1", "abitype": "^1.0.8", diff --git a/yarn.lock b/yarn.lock index 1ed99737c..366fc6839 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3473,11 +3473,16 @@ resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz#d4bfb516ad6e7b5111c216a5cc7075f4cf19e6c5" integrity sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ== -"@noble/hashes@1.6.1", "@noble/hashes@^1.4.0", "@noble/hashes@^1.5.0", "@noble/hashes@~1.6.0": +"@noble/hashes@1.6.1", "@noble/hashes@~1.6.0": version "1.6.1" resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.1.tgz#df6e5943edcea504bac61395926d6fd67869a0d5" integrity sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w== +"@noble/hashes@^1.4.0", "@noble/hashes@^1.5.0", "@noble/hashes@~1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.7.0.tgz#5d9e33af2c7d04fee35de1519b80c958b2e35e39" + integrity sha512-HXydb0DgzTpDPwbVeDGCG1gIu7X6+AuU6Zl6av/E/KG8LMsvPntvq+w17CHRpKBmN6Ybdrt1eP3k4cj8DJa78w== + "@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" @@ -3898,7 +3903,7 @@ "@noble/hashes" "~1.4.0" "@scure/base" "~1.1.6" -"@scure/bip39@1.5.0", "@scure/bip39@^1.4.0": +"@scure/bip39@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.5.0.tgz#c8f9533dbd787641b047984356531d84485f19be" integrity sha512-Dop+ASYhnrwm9+HA/HwXg7j2ZqM6yk2fyLWb5znexjctFY3+E+eU8cIWI0Pql0Qx4hPZCijlGq4OL71g+Uz30A== @@ -3906,6 +3911,14 @@ "@noble/hashes" "~1.6.0" "@scure/base" "~1.2.1" +"@scure/bip39@^1.4.0", "@scure/bip39@^1.5.1": + version "1.5.1" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.5.1.tgz#a056868d672c7203a6035c808893742a79e151f6" + integrity sha512-GnlufVSP9UdAo/H2Patfv22VTtpNTyfi+I3qCKpvuB5l1KWzEYx+l2TNpBy9Ksh4xTs3Rn06tBlpWCi/1Vz8gw== + dependencies: + "@noble/hashes" "~1.7.0" + "@scure/base" "~1.2.1" + "@sentry/core@5.30.0": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.30.0.tgz#6b203664f69e75106ee8b5a2fe1d717379b331f3"