From 1f0088ce9832afc2ad33be63a319605e97414a1a Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Wed, 5 Mar 2025 16:21:07 +0000 Subject: [PATCH 01/15] feat: 1870 new VeChainSDKError.ts POC --- packages/core/src/core.ts | 1 + packages/core/src/errors/VeChainSDKError.ts | 54 +++++++++++++++++++++ packages/core/src/errors/index.ts | 1 + packages/core/src/errors/mermaid.ts | 53 ++++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 packages/core/src/errors/VeChainSDKError.ts create mode 100644 packages/core/src/errors/index.ts create mode 100644 packages/core/src/errors/mermaid.ts diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index 6deddfb79..3d1f397c6 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -1,5 +1,6 @@ // Our core library export * from './certificate'; +export * from './errors'; export * from './hdkey'; export * from './keystore'; export * from './secp256k1'; diff --git a/packages/core/src/errors/VeChainSDKError.ts b/packages/core/src/errors/VeChainSDKError.ts new file mode 100644 index 000000000..4b543c56a --- /dev/null +++ b/packages/core/src/errors/VeChainSDKError.ts @@ -0,0 +1,54 @@ +class VeChainSDKError extends Error { + static override readonly name = 'VeChainSDKError'; + + readonly args?: Record; + + /** + * Full Qualified Name of the element throwing the error. + */ + readonly fqn: string; + + /** + * Software Artifact Tag: name and version. + */ + readonly tag: string; + + constructor( + fqn: string, + message: string, + args?: Record, + cause?: Error, + tag: string = 'vechain-sdk-js:2.0' + ) { + super(message, cause); + this.args = args; + this.fqn = fqn; + this.tag = tag; + } + + toString( + joiner: string = ', ', + stringify: (obj: unknown) => string = (obj: unknown) => + JSON.stringify(obj) + ): string { + const txt = [ + `${this.constructor.name}: ${this.message}`, + `@${this.tag}:${this.fqn}` + ]; + if (this.args !== undefined && this.args !== null) { + txt.push(`args: ${stringify(this.args)}`); + } + if (this.cause !== undefined && this.cause !== null) { + txt.push(`cause: ${stringify(this.cause)}`); + } + return txt.join(joiner); + } +} + +const err = new VeChainSDKError( + 'packages/core/src/errors/VeChainSDKError.ts!28', + 'invalid data type', + { data: 'invalid' }, + new Error('invalid data type') +); +console.log(err.toString('\n\t')); diff --git a/packages/core/src/errors/index.ts b/packages/core/src/errors/index.ts new file mode 100644 index 000000000..eb9fb754b --- /dev/null +++ b/packages/core/src/errors/index.ts @@ -0,0 +1 @@ +export * from './VeChainSDKError'; diff --git a/packages/core/src/errors/mermaid.ts b/packages/core/src/errors/mermaid.ts new file mode 100644 index 000000000..5a2fa183c --- /dev/null +++ b/packages/core/src/errors/mermaid.ts @@ -0,0 +1,53 @@ +import * as ts from 'typescript'; + +function parseClass(fileName: string): string { + const sourceFile = ts.createSourceFile( + fileName, + ts.sys.readFile(fileName) ?? '', + ts.ScriptTarget.ES2015, + /* setParentNodes */ true + ); + + let mermaidOutput = 'classDiagram\n'; + + function visit(node: ts.Node): void { + if (ts.isClassDeclaration(node) && node.name != null) { + const className = node.name.text; + mermaidOutput += `class ${className} {\n`; + + // Get methods and properties + node.members.forEach((member) => { + if ( + ts.isPropertyDeclaration(member) && + ts.isIdentifier(member.name) + ) { + const propertyName = member.name.text; + const propertyType = + member.type !== null && member.type !== undefined + ? member.type.getText() + : 'any'; + mermaidOutput += ` +${propertyName}: ${propertyType}\n`; + } + + if ( + ts.isMethodDeclaration(member) && + ts.isIdentifier(member.name) + ) { + const methodName = member.name.text; + mermaidOutput += ` +${methodName}()\n`; + } + }); + + mermaidOutput += '}\n'; + } + + ts.forEachChild(node, visit); + } + + visit(sourceFile); + + return mermaidOutput; +} + +const fileName = './VeChainSDKError.ts'; // Replace with your TS file path +console.log(parseClass(fileName)); From d3439607fd4b437fca3f7932e7a409a89121fc7c Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 15:10:04 +0000 Subject: [PATCH 02/15] feat: 1870 new VeChainSDKError.ts POC --- .../core/src/errors/IllegalArgumentError.ts | 17 +++++ packages/core/src/errors/VeChainSDKError.ts | 62 +++++++++++++++---- packages/core/src/errors/index.ts | 1 + packages/core/src/errors/mermaid.ts | 1 + .../helpers/delegation-handler.ts | 2 +- 5 files changed, 69 insertions(+), 14 deletions(-) create mode 100644 packages/core/src/errors/IllegalArgumentError.ts diff --git a/packages/core/src/errors/IllegalArgumentError.ts b/packages/core/src/errors/IllegalArgumentError.ts new file mode 100644 index 000000000..5e11a0291 --- /dev/null +++ b/packages/core/src/errors/IllegalArgumentError.ts @@ -0,0 +1,17 @@ +import { VeChainSDKError } from './VeChainSDKError'; + +class IllegalArgumentError extends VeChainSDKError {} + +export { IllegalArgumentError }; + +const err = new IllegalArgumentError( + 'packages/core/src/errors/IllegalArgumentError.ts!28', + 'illegal argument error', + { data: 'invalid' }, + new VeChainSDKError( + 'packages/core/src/errors/VeChainSDKError.ts!101', + 'invalid data type', + { type: 'string' } + ) +); +console.log(err.toString()); diff --git a/packages/core/src/errors/VeChainSDKError.ts b/packages/core/src/errors/VeChainSDKError.ts index 4b543c56a..715992207 100644 --- a/packages/core/src/errors/VeChainSDKError.ts +++ b/packages/core/src/errors/VeChainSDKError.ts @@ -1,33 +1,75 @@ class VeChainSDKError extends Error { - static override readonly name = 'VeChainSDKError'; + /** + * Represents the software tag identifier expressing the **artifact and version coordinates** + * used for logging or debugging purposes. + * + * This constant value is used to facilitate filtering or grouping of log messages, + * helping developers to identify and trace operations or issues related to this specific SDK version in the application. + */ + static readonly TAG = 'vechain-sdk-js:2.0'; + /** + * Optional parameter to represent a set of key-value pairs representing the arguments originating the error. + * + * @param {Record} [args] - A record object where keys are strings and values can be of any type. + */ readonly args?: Record; /** - * Full Qualified Name of the element throwing the error. + * Represents the underlying error or reason for an operation failure. + * Optional property that can provide additional context or details + * about the cause of an encountered issue. + */ + override readonly cause?: Error; + + /** + * Fully qualified name of the element throwing this error, represented as a string in hierarchical form. + * + * For error generated in a method of a class, the format is + * + *
+     * !.
+     * 
+ * + * This variable is used to store the full name of a resource, + * entity, or identifier, typically in a hierarchical or + * namespaced format. It may include elements such as + * namespaces, modules, classes, or methods concatenated + * together to form a unique identifier. The specific format + * and components depend on the context in which it is used. */ readonly fqn: string; /** - * Software Artifact Tag: name and version. + * Represents the software tag identifier expressing the **software artifact and version coordinates** */ readonly tag: string; + /** + * Constructs a new instance of the class. + * + * @param {string} fqn - The fully qualified name of the element throwing this error. + * @param {string} message - The error message to be used. + * @param {Record} [args] - Optional arguments providing additional context or details. + * @param {Error} [cause] - Optional underlying cause of the error. + * @param {string} [tag] - An optional tag identifying the error, defaults to VeChainSDKError.TAG. + */ constructor( fqn: string, message: string, args?: Record, cause?: Error, - tag: string = 'vechain-sdk-js:2.0' + tag: string = VeChainSDKError.TAG ) { super(message, cause); this.args = args; + this.cause = cause; this.fqn = fqn; this.tag = tag; } toString( - joiner: string = ', ', + joiner: string = '\n\t', stringify: (obj: unknown) => string = (obj: unknown) => JSON.stringify(obj) ): string { @@ -39,16 +81,10 @@ class VeChainSDKError extends Error { txt.push(`args: ${stringify(this.args)}`); } if (this.cause !== undefined && this.cause !== null) { - txt.push(`cause: ${stringify(this.cause)}`); + txt.push(`cause: ${this.cause.toString()}`); } return txt.join(joiner); } } -const err = new VeChainSDKError( - 'packages/core/src/errors/VeChainSDKError.ts!28', - 'invalid data type', - { data: 'invalid' }, - new Error('invalid data type') -); -console.log(err.toString('\n\t')); +export { VeChainSDKError }; diff --git a/packages/core/src/errors/index.ts b/packages/core/src/errors/index.ts index eb9fb754b..3c805f11c 100644 --- a/packages/core/src/errors/index.ts +++ b/packages/core/src/errors/index.ts @@ -1 +1,2 @@ +export * from './IllegalArgumentError'; export * from './VeChainSDKError'; diff --git a/packages/core/src/errors/mermaid.ts b/packages/core/src/errors/mermaid.ts index 5a2fa183c..a9b1b79d8 100644 --- a/packages/core/src/errors/mermaid.ts +++ b/packages/core/src/errors/mermaid.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line import/no-extraneous-dependencies import * as ts from 'typescript'; function parseClass(fileName: string): string { diff --git a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts b/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts index cdce9e3b4..2f43d16c3 100644 --- a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts +++ b/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts @@ -48,7 +48,7 @@ const _getDelegationSignature = async ( '_getDelegationSignature()', 'Delegation failed: Cannot get signature from delegator.', { - delegatorUrl + gasPayerUrl: delegatorUrl }, error ); From cae110723d6ff8590ea44cab8d498527aadcf43f Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 15:30:13 +0000 Subject: [PATCH 03/15] fix: 1886 delegator-handle fix --- .../src/thor-client/transactions/helpers/delegation-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts b/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts index cdce9e3b4..2f43d16c3 100644 --- a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts +++ b/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts @@ -48,7 +48,7 @@ const _getDelegationSignature = async ( '_getDelegationSignature()', 'Delegation failed: Cannot get signature from delegator.', { - delegatorUrl + gasPayerUrl: delegatorUrl }, error ); From c3de680ef1862e2a7801200e49d02a26e78e5188 Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 15:37:00 +0000 Subject: [PATCH 04/15] fix: 1886 `app` module removed --- .github/workflows/on-pr.yml | 9 +- .github/workflows/test-apps.yml | 54 - .gitignore | 5 +- README.md | 4 - apps/sdk-cloudflare-integration/package.json | 21 - apps/sdk-cloudflare-integration/src/index.ts | 50 - .../test/index.spec.ts | 9 - apps/sdk-cloudflare-integration/tsconfig.json | 21 - .../vitest.config.ts | 16 - apps/sdk-cloudflare-integration/wrangler.toml | 4 - apps/sdk-hardhat-integration/.gitignore | 14 - apps/sdk-hardhat-integration/README.md | 27 - .../contracts/GLDToken.sol | 16 - .../contracts/GameItem.sol | 36 - .../contracts/VechainHelloWorld.sol | 26 - ...chainHelloWorldWithNonEmptyConstructor.sol | 31 - .../sdk-hardhat-integration/hardhat.config.ts | 171 - apps/sdk-hardhat-integration/package.json | 43 - .../sdk-hardhat-integration/scripts/deploy.ts | 25 - .../scripts/erc20/deploy.ts | 17 - .../scripts/erc20/interact.ts | 25 - .../scripts/erc721/deploy.ts | 17 - .../scripts/erc721/interact.ts | 29 - .../scripts/interact.ts | 23 - .../test/GLDToken.testnet.test.ts | 18 - .../test/VechainHelloWorld.testnet.test.ts | 17 - ...rldWithNonEmptyConstructor.testnet.test.ts | 67 - apps/sdk-hardhat-integration/tsconfig.json | 11 - apps/sdk-nextjs-integration/.env | 1 - apps/sdk-nextjs-integration/.gitignore | 40 - apps/sdk-nextjs-integration/README.md | 32 - .../__tests__/hash-page.unit.test.tsx | 86 - .../__tests__/transfer-logs.unit.test.tsx | 101 - apps/sdk-nextjs-integration/e2e/hash.spec.ts | 48 - .../e2e/lastblock.spec.ts | 24 - apps/sdk-nextjs-integration/e2e/logs.spec.ts | 29 - apps/sdk-nextjs-integration/eslint.config.mjs | 5 - .../jest-environment-jsdom.js | 18 - apps/sdk-nextjs-integration/jest.config.js | 24 - apps/sdk-nextjs-integration/jest.setup.js | 2 - apps/sdk-nextjs-integration/next.config.mjs | 14 - apps/sdk-nextjs-integration/package.json | 44 - .../playwright.config.ts | 44 - apps/sdk-nextjs-integration/postcss.config.js | 6 - apps/sdk-nextjs-integration/public/next.svg | 1 - apps/sdk-nextjs-integration/public/vercel.svg | 1 - .../src/app/favicon.ico | Bin 25931 -> 0 bytes .../src/app/get-last-block/page.tsx | 60 - .../src/app/globals.css | 3 - .../src/app/hash/page.tsx | 80 - .../sdk-nextjs-integration/src/app/layout.tsx | 22 - apps/sdk-nextjs-integration/src/app/page.tsx | 61 - .../src/app/transfer-logs/page.tsx | 197 - .../src/components/header/header.tsx | 33 - .../src/components/header/index.tsx | 1 - .../src/components/index.tsx | 1 - .../src/const/const.tsx | 13 - .../src/const/index.tsx | 1 - .../src/types/index.tsx | 1 - .../src/types/types.d.tsx | 29 - .../src/utils/index.tsx | 1 - .../src/utils/utils.tsx | 14 - .../sdk-nextjs-integration/tailwind.config.ts | 20 - apps/sdk-nextjs-integration/tsconfig.json | 36 - apps/sdk-node-integration/README.md | 29 - apps/sdk-node-integration/jest.config.ts | 8 - apps/sdk-node-integration/package.json | 25 - apps/sdk-node-integration/src/index.ts | 11 - .../src/vechain-transaction-logger.ts | 131 - .../vechain-transaction-logger.unit.test.ts | 51 - apps/sdk-node-integration/tsconfig.json | 12 - apps/sdk-vite-integration/.gitignore | 28 - apps/sdk-vite-integration/README.md | 50 - apps/sdk-vite-integration/e2e/hash.spec.ts | 48 - .../e2e/lastblock.spec.ts | 24 - apps/sdk-vite-integration/e2e/logs.spec.ts | 29 - apps/sdk-vite-integration/eslint.config.js | 28 - apps/sdk-vite-integration/index.html | 13 - apps/sdk-vite-integration/package.json | 37 - .../sdk-vite-integration/playwright.config.ts | 44 - apps/sdk-vite-integration/public/vite.svg | 1 - apps/sdk-vite-integration/src/App.css | 42 - apps/sdk-vite-integration/src/App.tsx | 63 - .../sdk-vite-integration/src/assets/react.svg | 1 - .../src/components/GetLastBlock.tsx | 33 - .../src/components/Hash.tsx | 77 - .../src/components/TransferLogs.tsx | 224 -- apps/sdk-vite-integration/src/const/const.tsx | 13 - apps/sdk-vite-integration/src/const/index.tsx | 2 - apps/sdk-vite-integration/src/index.css | 68 - apps/sdk-vite-integration/src/main.tsx | 10 - apps/sdk-vite-integration/src/types/index.tsx | 1 - .../src/types/types.d.tsx | 29 - apps/sdk-vite-integration/src/vite-env.d.ts | 1 - apps/sdk-vite-integration/tests/Hash.spec.tsx | 9 - apps/sdk-vite-integration/tsconfig.app.json | 25 - .../tsconfig.app.tsbuildinfo | 1 - apps/sdk-vite-integration/tsconfig.json | 15 - apps/sdk-vite-integration/tsconfig.node.json | 23 - .../tsconfig.node.tsbuildinfo | 1 - .../sdk-vite-integration/tsconfig.tsbuildinfo | 1 - apps/sdk-vite-integration/vite.config.ts | 7 - apps/sdk-vite-integration/vitest.workspace.ts | 34 - package.json | 5 +- packages/hardhat-plugin/README.md | 5 - scripts/pre-release.ts | 29 +- yarn.lock | 3531 +---------------- 107 files changed, 108 insertions(+), 6610 deletions(-) delete mode 100644 .github/workflows/test-apps.yml delete mode 100644 apps/sdk-cloudflare-integration/package.json delete mode 100644 apps/sdk-cloudflare-integration/src/index.ts delete mode 100644 apps/sdk-cloudflare-integration/test/index.spec.ts delete mode 100644 apps/sdk-cloudflare-integration/tsconfig.json delete mode 100644 apps/sdk-cloudflare-integration/vitest.config.ts delete mode 100644 apps/sdk-cloudflare-integration/wrangler.toml delete mode 100644 apps/sdk-hardhat-integration/.gitignore delete mode 100644 apps/sdk-hardhat-integration/README.md delete mode 100644 apps/sdk-hardhat-integration/contracts/GLDToken.sol delete mode 100644 apps/sdk-hardhat-integration/contracts/GameItem.sol delete mode 100644 apps/sdk-hardhat-integration/contracts/VechainHelloWorld.sol delete mode 100644 apps/sdk-hardhat-integration/contracts/VechainHelloWorldWithNonEmptyConstructor.sol delete mode 100644 apps/sdk-hardhat-integration/hardhat.config.ts delete mode 100644 apps/sdk-hardhat-integration/package.json delete mode 100644 apps/sdk-hardhat-integration/scripts/deploy.ts delete mode 100644 apps/sdk-hardhat-integration/scripts/erc20/deploy.ts delete mode 100644 apps/sdk-hardhat-integration/scripts/erc20/interact.ts delete mode 100644 apps/sdk-hardhat-integration/scripts/erc721/deploy.ts delete mode 100644 apps/sdk-hardhat-integration/scripts/erc721/interact.ts delete mode 100644 apps/sdk-hardhat-integration/scripts/interact.ts delete mode 100644 apps/sdk-hardhat-integration/test/GLDToken.testnet.test.ts delete mode 100644 apps/sdk-hardhat-integration/test/VechainHelloWorld.testnet.test.ts delete mode 100644 apps/sdk-hardhat-integration/test/VechainHelloWorldWithNonEmptyConstructor.testnet.test.ts delete mode 100644 apps/sdk-hardhat-integration/tsconfig.json delete mode 100644 apps/sdk-nextjs-integration/.env delete mode 100644 apps/sdk-nextjs-integration/.gitignore delete mode 100644 apps/sdk-nextjs-integration/README.md delete mode 100644 apps/sdk-nextjs-integration/__tests__/hash-page.unit.test.tsx delete mode 100644 apps/sdk-nextjs-integration/__tests__/transfer-logs.unit.test.tsx delete mode 100644 apps/sdk-nextjs-integration/e2e/hash.spec.ts delete mode 100644 apps/sdk-nextjs-integration/e2e/lastblock.spec.ts delete mode 100644 apps/sdk-nextjs-integration/e2e/logs.spec.ts delete mode 100644 apps/sdk-nextjs-integration/eslint.config.mjs delete mode 100644 apps/sdk-nextjs-integration/jest-environment-jsdom.js delete mode 100644 apps/sdk-nextjs-integration/jest.config.js delete mode 100644 apps/sdk-nextjs-integration/jest.setup.js delete mode 100644 apps/sdk-nextjs-integration/next.config.mjs delete mode 100644 apps/sdk-nextjs-integration/package.json delete mode 100644 apps/sdk-nextjs-integration/playwright.config.ts delete mode 100644 apps/sdk-nextjs-integration/postcss.config.js delete mode 100644 apps/sdk-nextjs-integration/public/next.svg delete mode 100644 apps/sdk-nextjs-integration/public/vercel.svg delete mode 100644 apps/sdk-nextjs-integration/src/app/favicon.ico delete mode 100644 apps/sdk-nextjs-integration/src/app/get-last-block/page.tsx delete mode 100644 apps/sdk-nextjs-integration/src/app/globals.css delete mode 100644 apps/sdk-nextjs-integration/src/app/hash/page.tsx delete mode 100644 apps/sdk-nextjs-integration/src/app/layout.tsx delete mode 100644 apps/sdk-nextjs-integration/src/app/page.tsx delete mode 100644 apps/sdk-nextjs-integration/src/app/transfer-logs/page.tsx delete mode 100644 apps/sdk-nextjs-integration/src/components/header/header.tsx delete mode 100644 apps/sdk-nextjs-integration/src/components/header/index.tsx delete mode 100644 apps/sdk-nextjs-integration/src/components/index.tsx delete mode 100644 apps/sdk-nextjs-integration/src/const/const.tsx delete mode 100644 apps/sdk-nextjs-integration/src/const/index.tsx delete mode 100644 apps/sdk-nextjs-integration/src/types/index.tsx delete mode 100644 apps/sdk-nextjs-integration/src/types/types.d.tsx delete mode 100644 apps/sdk-nextjs-integration/src/utils/index.tsx delete mode 100644 apps/sdk-nextjs-integration/src/utils/utils.tsx delete mode 100644 apps/sdk-nextjs-integration/tailwind.config.ts delete mode 100644 apps/sdk-nextjs-integration/tsconfig.json delete mode 100644 apps/sdk-node-integration/README.md delete mode 100644 apps/sdk-node-integration/jest.config.ts delete mode 100644 apps/sdk-node-integration/package.json delete mode 100644 apps/sdk-node-integration/src/index.ts delete mode 100644 apps/sdk-node-integration/src/vechain-transaction-logger.ts delete mode 100644 apps/sdk-node-integration/tests/vechain-transaction-logger.unit.test.ts delete mode 100644 apps/sdk-node-integration/tsconfig.json delete mode 100644 apps/sdk-vite-integration/.gitignore delete mode 100644 apps/sdk-vite-integration/README.md delete mode 100644 apps/sdk-vite-integration/e2e/hash.spec.ts delete mode 100644 apps/sdk-vite-integration/e2e/lastblock.spec.ts delete mode 100644 apps/sdk-vite-integration/e2e/logs.spec.ts delete mode 100644 apps/sdk-vite-integration/eslint.config.js delete mode 100644 apps/sdk-vite-integration/index.html delete mode 100644 apps/sdk-vite-integration/package.json delete mode 100644 apps/sdk-vite-integration/playwright.config.ts delete mode 100644 apps/sdk-vite-integration/public/vite.svg delete mode 100644 apps/sdk-vite-integration/src/App.css delete mode 100644 apps/sdk-vite-integration/src/App.tsx delete mode 100644 apps/sdk-vite-integration/src/assets/react.svg delete mode 100644 apps/sdk-vite-integration/src/components/GetLastBlock.tsx delete mode 100644 apps/sdk-vite-integration/src/components/Hash.tsx delete mode 100644 apps/sdk-vite-integration/src/components/TransferLogs.tsx delete mode 100644 apps/sdk-vite-integration/src/const/const.tsx delete mode 100644 apps/sdk-vite-integration/src/const/index.tsx delete mode 100644 apps/sdk-vite-integration/src/index.css delete mode 100644 apps/sdk-vite-integration/src/main.tsx delete mode 100644 apps/sdk-vite-integration/src/types/index.tsx delete mode 100644 apps/sdk-vite-integration/src/types/types.d.tsx delete mode 100644 apps/sdk-vite-integration/src/vite-env.d.ts delete mode 100644 apps/sdk-vite-integration/tests/Hash.spec.tsx delete mode 100644 apps/sdk-vite-integration/tsconfig.app.json delete mode 100644 apps/sdk-vite-integration/tsconfig.app.tsbuildinfo delete mode 100644 apps/sdk-vite-integration/tsconfig.json delete mode 100644 apps/sdk-vite-integration/tsconfig.node.json delete mode 100644 apps/sdk-vite-integration/tsconfig.node.tsbuildinfo delete mode 100644 apps/sdk-vite-integration/tsconfig.tsbuildinfo delete mode 100644 apps/sdk-vite-integration/vite.config.ts delete mode 100644 apps/sdk-vite-integration/vitest.workspace.ts diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index d2e0cffb1..48e68c99a 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -36,11 +36,7 @@ jobs: - name: Stop Thor solo node id: stop-solo run: yarn stop-thor-solo - - test-apps: - uses: ./.github/workflows/test-apps.yml - secrets: inherit - + rpc-proxy: uses: ./.github/workflows/rpc-proxy.yml secrets: inherit @@ -56,5 +52,4 @@ jobs: unit-integration-test-browser: uses: ./.github/workflows/unit-integration-test-browser.yml secrets: inherit - - \ No newline at end of file + diff --git a/.github/workflows/test-apps.yml b/.github/workflows/test-apps.yml deleted file mode 100644 index a796d71b0..000000000 --- a/.github/workflows/test-apps.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: E2E Tests for app examples - -on: - workflow_call: - -jobs: - build: - name: Install and test example apps - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: v20.11.0 - - - name: Install packages - run: yarn install - - - name: Install playwright browsers - run: yarn playwright install - - - name: Build packages - run: yarn build - - - name: Run sdk-vite-integration E2E tests - run: | - # set path - temp_dir="$(pwd)/apps/sdk-vite-integration" - - # log where we are - echo "Running yarn in $temp_dir" - - # change directory - cd "$temp_dir" - - # run e2e tests - yarn test:e2e - - - name: Run sdk-nextjs-integration E2E tests - run: | - # set path - temp_dir="$(pwd)/apps/sdk-nextjs-integration" - - # log where we are - echo "Running yarn in $temp_dir" - - # change directory - cd "$temp_dir" - - # run e2e tests - yarn test:e2e \ No newline at end of file diff --git a/.gitignore b/.gitignore index e525fee4f..9022f4453 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,6 @@ node_modules packages/**/dist packages/**/.turbo packages/**/node_modules -apps/**/dist -apps/**/.turbo -apps/**/node_modules docs/**/dist yarn-error.log @@ -24,4 +21,4 @@ index.html unit-tests.html # IDE -.idea \ No newline at end of file +.idea diff --git a/README.md b/README.md index 88703a90b..2663065f5 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Welcome to the VeChain SDK repository! Here's a breakdown of our organized structure: -- `./apps`: Explore a suite of sample applications that demonstrate the versatility and power of our SDK in real-world scenarios. From Next.js to Node.js, HardHat, and CloudFlare, these examples serve as practical guides to kickstart your development journey. - `./docker`: Streamline your development and deployment with our comprehensive Docker configurations. This directory offers Dockerfile setups designed to create consistent, reproducible environments. - `./docs`: Your go-to destination for comprehensive documentation. Explore demonstrative examples showcasing the prowess of our SDK. Knowledge is power, and our docs are here to enlighten your path. - `./packages`: A hub for our monorepo packages, each serving a distinct purpose: @@ -249,9 +248,6 @@ to define the runtime and the test framework to be compatible with the [ECMAScript 2020](https://262.ecma-international.org/11.0/) language specifications. -An example of **Next.js** [tsconfig.json](apps/sdk-nextjs-integration/tsconfig.json) is available in -the module [sdk-nextjs-integration](apps/sdk-nextjs-integration). - **Next.js** caches data types when dependencies are installed and the project is built. To be sure the options defined in `tsconfig.json` are effective when changed, delete the directories `.next`, `node_modules` and the file `next-env.d.ts` diff --git a/apps/sdk-cloudflare-integration/package.json b/apps/sdk-cloudflare-integration/package.json deleted file mode 100644 index b88f62953..000000000 --- a/apps/sdk-cloudflare-integration/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "sdk-cloudflare-integration", - "description": "An example app of how to integrate the VeChain SDK with Cloudflare Workers", - "version": "2.0.0-beta.1", - "private": true, - "author": "VeChain Foundation", - "license": "MIT", - "scripts": { - "dev": "wrangler dev", - "test": "vitest" - }, - "devDependencies": { - "@cloudflare/vitest-pool-workers": "^0.5.33", - "@cloudflare/workers-types": "^4.20241230.0", - "vitest": "2.1.4", - "wrangler": "^3.72.3" - }, - "dependencies": { - "@vechain/sdk-core": "2.0.0-beta.1" - } -} \ No newline at end of file diff --git a/apps/sdk-cloudflare-integration/src/index.ts b/apps/sdk-cloudflare-integration/src/index.ts deleted file mode 100644 index 27f949d67..000000000 --- a/apps/sdk-cloudflare-integration/src/index.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - Address, - Clause, - HexUInt, - networkInfo, - Secp256k1, - Transaction, - VET -} from '@vechain/sdk-core'; - -export default { - async fetch(): Promise { - const clauses = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(0) - ) - ]; - - // 2 - Calculate intrinsic gas of clauses - const gas = HexUInt.of( - Transaction.intrinsicGas(clauses).wei - ).toString(); - - // 3 - Body of transaction - const body = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses, - gasPriceCoef: 128, - gas, - dependsOn: null, - nonce: 12345678 - }; - - // Create private key - const privateKey = await Secp256k1.generatePrivateKey(); - - // 4 - Sign transaction - const signedTransaction = Transaction.of(body).sign(privateKey); - - // 5 - Encode transaction - const encodedRaw = signedTransaction.encoded; - - // 6 - Decode transaction - const decodedTx = Transaction.decode(encodedRaw, true); - return new Response(JSON.stringify(decodedTx)); - } -}; diff --git a/apps/sdk-cloudflare-integration/test/index.spec.ts b/apps/sdk-cloudflare-integration/test/index.spec.ts deleted file mode 100644 index f828b469c..000000000 --- a/apps/sdk-cloudflare-integration/test/index.spec.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { describe, expect, it } from 'vitest'; -import { SELF } from 'cloudflare:test'; - -describe('Worker', () => { - it('should sign a transaction)', async () => { - const response = await SELF.fetch('http://example.com'); - expect(await response.text()).contains('blockRef'); - }); -}) \ No newline at end of file diff --git a/apps/sdk-cloudflare-integration/tsconfig.json b/apps/sdk-cloudflare-integration/tsconfig.json deleted file mode 100644 index f6206be7a..000000000 --- a/apps/sdk-cloudflare-integration/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "module": "esnext", - "target": "esnext", - "lib": [ - "esnext" - ], - "moduleResolution": "bundler", - "noEmit": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "types": [ - "@cloudflare/workers-types/experimental", - "@cloudflare/vitest-pool-workers" - ], - "include": [ - "./**/*.ts" - ] - } -} \ No newline at end of file diff --git a/apps/sdk-cloudflare-integration/vitest.config.ts b/apps/sdk-cloudflare-integration/vitest.config.ts deleted file mode 100644 index d58a9cc3f..000000000 --- a/apps/sdk-cloudflare-integration/vitest.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config'; - -export default defineWorkersConfig({ - test: { - poolOptions: { - workers: { - wrangler: { configPath: './wrangler.toml' } - } - }, - server: { - deps: { - inline: ['crypto', 'ethers', '@vechain/sdk-core'] - } - } - } -}); diff --git a/apps/sdk-cloudflare-integration/wrangler.toml b/apps/sdk-cloudflare-integration/wrangler.toml deleted file mode 100644 index fab079d3b..000000000 --- a/apps/sdk-cloudflare-integration/wrangler.toml +++ /dev/null @@ -1,4 +0,0 @@ -name = "sdk-cloudflare-integration" -main = "src/index.ts" -compatibility_date = "2024-07-25" -compatibility_flags = [ "nodejs_compat" ] \ No newline at end of file diff --git a/apps/sdk-hardhat-integration/.gitignore b/apps/sdk-hardhat-integration/.gitignore deleted file mode 100644 index 9722dbfaf..000000000 --- a/apps/sdk-hardhat-integration/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -node_modules -.env - -# Hardhat files -/cache -/artifacts - -# TypeChain files -/typechain -/typechain-types - -# solidity-coverage files -/coverage -/coverage.json diff --git a/apps/sdk-hardhat-integration/README.md b/apps/sdk-hardhat-integration/README.md deleted file mode 100644 index 12a27bf20..000000000 --- a/apps/sdk-hardhat-integration/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Sample Hardhat project - -This is a sample project that showcases the usage of the VeChain SDK Hardhat plugin, specifically the hardhat-plugin package, with illustrative examples. - -## Introduction - -The hardhat-plugin package serves as a crucial link between Hardhat and the VeChain SDK, simplifying the process of creating, testing, and interacting with smart contracts on the VeChainThor blockchain network. Developers can utilize the functionalities provided by this plugin to seamlessly integrate vechain's blockchain infrastructure into their Hardhat projects. - -## Commands - -- **Install dependencies**: Execute `yarn install` to install the required dependencies. -- **Compile**: Execute `yarn compile` to compile the smart contracts in the `contracts` folder. -- **Testing**: Execute `yarn test` to test the smart contracts running the tests located on the `test` folder. -- **Deploy**: Execute `yarn deploy-solo` to deploy the smart contracts on the solo network, and `yarn deploy-testnet` to deploy on the VeChain testnet. - -## Usage - -The `hardhat.config.js` is the main configuration file. By specifying the desired network configurations, such as the network URL and the accounts to be used for signing transactions, developers can seamlessly switch between different networks and environments. Additionally, settings like enabling logging can also be configured to provide more detailed information during development and testing. -Note that: - -- The network name should contain `vechain`, otherwise, it may result in an error. -- In the network configuration, two additional fields can be added: `delegator` and `useDebug`. These fields allow for more customization and control over the network settings, catering to specific project requirements and preferences. - - **Debug Mode**: The `debug` field enables or disables debug mode. - - **Delegator**: The `delegator` field allows you to delegate the transaction to a delegator. It supports two optional parameters: - **Delegator**: The `delegator` field allows you to delegate the transaction to a delegator. It supports two optional parameters: `delegatorPrivateKey` and `delegatorUrl`. -- When configuring your Solidity compiler settings in hardhat.config.js, it's recommended to set the evmVersion to "Paris" for projects targeting the latest EVM functionalities. This setting ensures that the compiled bytecode is optimized for the most recent features and gas cost adjustments associated with the Paris EVM version. Using an EVM version other than "Paris" could potentially lead to issues with unsupported opcodes, especially if your contracts rely on newer EVM features introduced in or after the Paris update. - -This flexibility in the configuration file allows developers to tailor their development experience and adapt it to the requirements of their projects, ensuring a smooth and efficient development process. \ No newline at end of file diff --git a/apps/sdk-hardhat-integration/contracts/GLDToken.sol b/apps/sdk-hardhat-integration/contracts/GLDToken.sol deleted file mode 100644 index 0152a0e0f..000000000 --- a/apps/sdk-hardhat-integration/contracts/GLDToken.sol +++ /dev/null @@ -1,16 +0,0 @@ -// contracts/GLDToken.sol -// SPDX-License-Identifier: MIT -pragma solidity 0.8.20; - -// Importing the ERC20 contract from OpenZeppelin -import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; - -// Defining the GLDToken contract which inherits from ERC20 -contract GLDToken is ERC20 { - // Constructor to initialize the token with an initial supply - // `initialSupply` is the amount of tokens that will be created at deployment - constructor(uint256 initialSupply) ERC20("Gold", "GLD") { - // Mint the initial supply of tokens and assign them to the contract deployer - _mint(msg.sender, initialSupply); - } -} diff --git a/apps/sdk-hardhat-integration/contracts/GameItem.sol b/apps/sdk-hardhat-integration/contracts/GameItem.sol deleted file mode 100644 index 69ab588a3..000000000 --- a/apps/sdk-hardhat-integration/contracts/GameItem.sol +++ /dev/null @@ -1,36 +0,0 @@ -// contracts/GameItem.sol -// SPDX-License-Identifier: MIT -pragma solidity 0.8.20; - -// Importing necessary libraries from OpenZeppelin -import {ERC721URIStorage} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; -import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; - -// Defining the GameItem contract which inherits from ERC721URIStorage -contract GameItem is ERC721URIStorage { - // State variable to keep track of _nextTokenId - uint256 private _nextTokenId; - - // Constructor to initialize the ERC721 token with a name and symbol - constructor() ERC721("GameItem", "ITM") {} - - // Function to award an item (mint a new token) - // `player` is the address to receive the new token - // `tokenURI` is the metadata URI associated with the new token - function awardItem(address player, string memory tokenURI) - public - returns (uint256) - { - // Generate a new token ID and increment _nextTokenId counter - uint256 tokenId = _nextTokenId++; - - // Mint the new token and assign it to the `player` address - _mint(player, tokenId); - - // Set the token URI for the new token - _setTokenURI(tokenId, tokenURI); - - // Return the new token ID - return tokenId; - } -} diff --git a/apps/sdk-hardhat-integration/contracts/VechainHelloWorld.sol b/apps/sdk-hardhat-integration/contracts/VechainHelloWorld.sol deleted file mode 100644 index bfeb487f8..000000000 --- a/apps/sdk-hardhat-integration/contracts/VechainHelloWorld.sol +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.20; - -/** - * @title VechainHelloWorld - * @dev A simple contract that says hello - */ -contract VechainHelloWorld { - // State variable to store the owner's address - address payable public owner; - - /** - * @dev Constructor that sets the owner of the contract to the deployer's address - */ - constructor() payable { - owner = payable(msg.sender); - } - - /** - * @dev Function to return a hello message - * @return The hello message - */ - function sayHello() public pure returns (string memory) { - return "Hello world from Vechain!"; - } -} diff --git a/apps/sdk-hardhat-integration/contracts/VechainHelloWorldWithNonEmptyConstructor.sol b/apps/sdk-hardhat-integration/contracts/VechainHelloWorldWithNonEmptyConstructor.sol deleted file mode 100644 index 97419cff3..000000000 --- a/apps/sdk-hardhat-integration/contracts/VechainHelloWorldWithNonEmptyConstructor.sol +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.20; - -/** - * @title VechainHelloWorldWithNonEmptyConstructor - * @dev A simple contract that says hello and accepts a parameter in the constructor - */ -contract VechainHelloWorldWithNonEmptyConstructor { - // State variable to store the owner's address - address payable public owner; - - // State variable to store a simple parameter - uint8 public simpleParameter; - - /** - * @dev Constructor that sets the owner of the contract and initializes a simple parameter - * @param _simpleParameter An unsigned 8-bit integer to be stored in the contract - */ - constructor(uint8 _simpleParameter) payable { - owner = payable(msg.sender); - simpleParameter = _simpleParameter; - } - - /** - * @dev Function to return a hello message - * @return The hello message - */ - function sayHello() public pure returns (string memory) { - return "Hello world from Vechain!"; - } -} diff --git a/apps/sdk-hardhat-integration/hardhat.config.ts b/apps/sdk-hardhat-integration/hardhat.config.ts deleted file mode 100644 index ace8a7722..000000000 --- a/apps/sdk-hardhat-integration/hardhat.config.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { type HardhatUserConfig } from 'hardhat/config'; -import '@nomicfoundation/hardhat-toolbox'; -import '@vechain/sdk-hardhat-plugin'; - -import { VET_DERIVATION_PATH } from '@vechain/sdk-core'; -import { type HttpNetworkConfig } from 'hardhat/types'; - -/** - * Main hardhat configuration - * - * Here we have custom VeChain networks: 'vechain_mainnet', 'vechain_testnet' and 'vechain_solo' - * - * They have custom parameters: - * - debug: whether to enable debug mode - * - delegator: the delegator to use - * - enableDelegation: whether to enable fee delegation - */ -const config: HardhatUserConfig = { - solidity: { - compilers: [ - { - version: '0.8.20', // Specify the first Solidity version - settings: { - // Additional compiler settings for this version - optimizer: { - enabled: true, - runs: 200 - }, - evmVersion: 'paris' - } - } - ] - }, - networks: { - /** - * Mainnet configuration - */ - vechain_mainnet: { - // Mainnet - url: 'https://mainnet.vechain.org', - accounts: [ - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], - debug: false, - delegator: undefined, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - timeout: 20000, - httpHeaders: {} - } satisfies HttpNetworkConfig, - - /** - * Testnet configuration - */ - vechain_testnet: { - // Testnet - url: 'https://testnet.vechain.org', - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: VET_DERIVATION_PATH, - count: 3, - initialIndex: 0, - passphrase: 'vechainthor' - }, - debug: true, - delegator: undefined, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - timeout: 20000, - httpHeaders: {} - } satisfies HttpNetworkConfig, - - /** - * Testnet configuration - with delegator url - */ - vechain_testnet_delegator_url: { - // Testnet - url: 'https://testnet.vechain.org', - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: VET_DERIVATION_PATH, - count: 3, - initialIndex: 0, - passphrase: 'vechainthor' - }, - debug: true, - delegator: { - delegatorUrl: 'https://sponsor-testnet.vechain.energy/by/269' - }, - enableDelegation: true, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - timeout: 20000, - httpHeaders: {} - } satisfies HttpNetworkConfig, - - /** - * Testnet configuration - with delegator private key - */ - vechain_testnet_delegator_private_key: { - // Testnet - url: 'https://testnet.vechain.org', - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: VET_DERIVATION_PATH, - count: 3, - initialIndex: 0, - passphrase: 'vechainthor' - }, - debug: true, - delegator: { - delegatorPrivateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - }, - enableDelegation: true, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - timeout: 20000, - httpHeaders: {} - } satisfies HttpNetworkConfig, - - /** - * Thor solo network configuration - */ - vechain_solo: { - // Thor solo network - url: 'http://localhost:8669', - accounts: [ - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], - debug: false, - enableDelegation: false, - delegator: undefined, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - timeout: 20000, - httpHeaders: {} - } satisfies HttpNetworkConfig, - - /** - * Default hardhat network configuration - */ - hardhat: { - // Testnet - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: VET_DERIVATION_PATH, - count: 3, - initialIndex: 0 - }, - debug: true, - delegator: undefined, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - timeout: 20000, - httpHeaders: {} - } - } -}; - -export default config; diff --git a/apps/sdk-hardhat-integration/package.json b/apps/sdk-hardhat-integration/package.json deleted file mode 100644 index 82c480e60..000000000 --- a/apps/sdk-hardhat-integration/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "sdk-hardhat-integration", - "description": "An example app of how to use the @vechain/sdk-hardhat-plugin to interact with the VeChainThor blockchain", - "version": "2.0.0-beta.1", - "private": true, - "main": "index.js", - "author": "VeChain Foundation", - "license": "MIT", - "scripts": { - "compile": "npx hardhat compile", - "test": "npx hardhat test --network vechain_testnet", - "deploy-solo": "npx hardhat run scripts/deploy.ts --network vechain_solo", - "deploy-testnet": "npx hardhat run scripts/deploy.ts --network vechain_testnet", - "deploy-erc20": "npx hardhat run scripts/erc20/deploy.ts --network vechain_testnet", - "interact-erc20": "npx hardhat run scripts/erc20/interact.ts --network vechain_testnet", - "deploy-erc721": "npx hardhat run scripts/erc721/deploy.ts --network vechain_testnet", - "interact-erc721": "npx hardhat run scripts/erc721/interact.ts --network vechain_testnet" - }, - "dependencies": { - "@openzeppelin/contracts": "^5.1.0", - "@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", - "@nomicfoundation/hardhat-ethers": "^3.0.8", - "@nomicfoundation/hardhat-network-helpers": "^1.0.0", - "@nomicfoundation/hardhat-toolbox": "^4.0.0", - "@nomicfoundation/hardhat-verify": "^2.0.12", - "@typechain/ethers-v6": "^0.5.0", - "@typechain/hardhat": "^9.0.0", - "@types/chai": "^4.2.0", - "@types/mocha": ">=10.0.10", - "chai": "^4.2.0", - "hardhat": "^2.22.15", - "hardhat-gas-reporter": "^1.0.8", - "solidity-coverage": "^0.8.14", - "ts-node": "^10.9.2", - "typechain": "^8.3.0", - "typescript": "^5.6.3" - } -} \ No newline at end of file diff --git a/apps/sdk-hardhat-integration/scripts/deploy.ts b/apps/sdk-hardhat-integration/scripts/deploy.ts deleted file mode 100644 index 4a468ad1f..000000000 --- a/apps/sdk-hardhat-integration/scripts/deploy.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ethers } from 'hardhat'; -import { stringifyData } from '@vechain/sdk-errors'; - -async function main(): Promise { - const signer = (await ethers.getSigners())[0]; - - const vechainHelloWorldFactory = await ethers.getContractFactory( - 'VechainHelloWorld', - signer - ); - - const txResponse = await vechainHelloWorldFactory.deploy(); - - console.log( - 'Contract deployment with the following transaction:', - stringifyData(txResponse) - ); -} - -// We recommend this pattern to be able to use async/await everywhere -// and properly handle errors. -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/apps/sdk-hardhat-integration/scripts/erc20/deploy.ts b/apps/sdk-hardhat-integration/scripts/erc20/deploy.ts deleted file mode 100644 index 7f7950916..000000000 --- a/apps/sdk-hardhat-integration/scripts/erc20/deploy.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ethers } from 'hardhat'; - -async function main(): Promise { - const erc20Contract = await ethers.deployContract('GLDToken', [100000]); - await erc20Contract.waitForDeployment(); - - const address = await erc20Contract.getAddress(); - - console.log(`Gold contract deployed with address: ${address}`); -} - -// We recommend this pattern to be able to use async/await everywhere -// and properly handle errors. -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/apps/sdk-hardhat-integration/scripts/erc20/interact.ts b/apps/sdk-hardhat-integration/scripts/erc20/interact.ts deleted file mode 100644 index aaf6dde1d..000000000 --- a/apps/sdk-hardhat-integration/scripts/erc20/interact.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ethers } from 'hardhat'; - -async function main(): Promise { - const signer = (await ethers.getSigners())[0]; - - const GLDTokenContractFactory = await ethers.getContractFactory( - 'GLDToken', - signer - ); - - const goldTokenContract = await GLDTokenContractFactory.deploy(10000); - await goldTokenContract.waitForDeployment(); - const message = await goldTokenContract.balanceOf( - await signer.getAddress() - ); - - console.log(`${message}`); -} - -// We recommend this pattern to be able to use async/await everywhere -// and properly handle errors. -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/apps/sdk-hardhat-integration/scripts/erc721/deploy.ts b/apps/sdk-hardhat-integration/scripts/erc721/deploy.ts deleted file mode 100644 index 4a7a65560..000000000 --- a/apps/sdk-hardhat-integration/scripts/erc721/deploy.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ethers } from 'hardhat'; - -async function main(): Promise { - const erc721Contract = await ethers.deployContract('GameItem'); - await erc721Contract.waitForDeployment(); - - const address = await erc721Contract.getAddress(); - - console.log(`MyNFT contract deployed with address: ${address}`); -} - -// We recommend this pattern to be able to use async/await everywhere -// and properly handle errors. -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/apps/sdk-hardhat-integration/scripts/erc721/interact.ts b/apps/sdk-hardhat-integration/scripts/erc721/interact.ts deleted file mode 100644 index 1eadcd5e3..000000000 --- a/apps/sdk-hardhat-integration/scripts/erc721/interact.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { ethers } from 'hardhat'; - -async function main(): Promise { - const signer = (await ethers.getSigners())[0]; - - const gameItemFactory = await ethers.getContractFactory('GameItem', signer); - - const gameItemContract = await gameItemFactory.deploy(); - - await gameItemContract.waitForDeployment(); - - const tx = await gameItemContract.awardItem( - '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - 'URINotDefined' - ); - - const receipt = await tx.wait(); - - receipt?.logs?.forEach((log) => { - console.log(gameItemContract.interface.parseLog(log)); - }); -} - -// We recommend this pattern to be able to use async/await everywhere -// and properly handle errors. -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/apps/sdk-hardhat-integration/scripts/interact.ts b/apps/sdk-hardhat-integration/scripts/interact.ts deleted file mode 100644 index be55cb713..000000000 --- a/apps/sdk-hardhat-integration/scripts/interact.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ethers } from 'hardhat'; - -async function main(): Promise { - const signer = (await ethers.getSigners())[0]; - - const vechainHelloWorldFactory = await ethers.getContractFactory( - 'VechainHelloWorld', - signer - ); - - const vechainHelloWorld = await vechainHelloWorldFactory.deploy(); - - const message = await vechainHelloWorld.sayHello(); - - console.log(`${message}`); -} - -// We recommend this pattern to be able to use async/await everywhere -// and properly handle errors. -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/apps/sdk-hardhat-integration/test/GLDToken.testnet.test.ts b/apps/sdk-hardhat-integration/test/GLDToken.testnet.test.ts deleted file mode 100644 index 9e49919a0..000000000 --- a/apps/sdk-hardhat-integration/test/GLDToken.testnet.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ethers } from 'hardhat'; -import { expect } from 'chai'; - -/** - * Tests for the 'GLDToken' contract - */ -describe('GLDToken', function () { - it('should deploy with the correct initial supply', async function () { - const [owner] = await ethers.getSigners(); - const initialSupply = ethers.parseUnits('1000', 18); // 1000 tokens with 18 decimals - const GLDToken = await ethers.getContractFactory('GLDToken'); - const contract = await GLDToken.deploy(initialSupply); - - // Check the initial supply - const ownerBalance = await contract.balanceOf(owner.address); - expect(ownerBalance).to.equal(initialSupply); - }); -}); diff --git a/apps/sdk-hardhat-integration/test/VechainHelloWorld.testnet.test.ts b/apps/sdk-hardhat-integration/test/VechainHelloWorld.testnet.test.ts deleted file mode 100644 index 629db4e09..000000000 --- a/apps/sdk-hardhat-integration/test/VechainHelloWorld.testnet.test.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ethers } from 'hardhat'; -import { expect } from 'chai'; - -/** - * Tests for the 'VechainHelloWorld' contract - */ -describe('VechainHelloWorld', function () { - it('sayHello() should return the correct message', async function () { - const VechainHelloWorld = - await ethers.getContractFactory('VechainHelloWorld'); - const contract = await VechainHelloWorld.deploy(); - - // Call the sayHello function and check the return value - const helloMessage = await contract.sayHello(); - expect(helloMessage).to.equal('Hello world from Vechain!'); - }); -}); diff --git a/apps/sdk-hardhat-integration/test/VechainHelloWorldWithNonEmptyConstructor.testnet.test.ts b/apps/sdk-hardhat-integration/test/VechainHelloWorldWithNonEmptyConstructor.testnet.test.ts deleted file mode 100644 index 59693f903..000000000 --- a/apps/sdk-hardhat-integration/test/VechainHelloWorldWithNonEmptyConstructor.testnet.test.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { expect } from 'chai'; -import { ethers } from 'hardhat'; - -/** - * Tests for the 'VechainHelloWorldWithNonEmptyConstructor' contract - */ -describe('VechainHelloWorldWithNonEmptyConstructor', function () { - it('should set the correct owner and simpleParameter', async function () { - const [owner] = await ethers.getSigners(); - const simpleParameter = 42; - const VechainHelloWorldWithNonEmptyConstructor = - await ethers.getContractFactory( - 'VechainHelloWorldWithNonEmptyConstructor' - ); - const contract = await VechainHelloWorldWithNonEmptyConstructor.deploy( - simpleParameter, - { value: ethers.parseEther('1') } - ); - - // Check the owner and simpleParameter values - expect(await contract.owner()).to.equal(owner.address); - expect(await contract.simpleParameter()).to.equal(simpleParameter); - }); - - it('sayHello() should return the correct message', async function () { - const VechainHelloWorldWithNonEmptyConstructor = - await ethers.getContractFactory( - 'VechainHelloWorldWithNonEmptyConstructor' - ); - const contract = await VechainHelloWorldWithNonEmptyConstructor.deploy( - 42, - { value: ethers.parseEther('1') } - ); - - // Call the sayHello function and check the return value - const helloMessage = await contract.sayHello(); - expect(helloMessage).to.equal('Hello world from Vechain!'); - }); - - it('should break with a specific error due to insufficient VTHO', async function () { - const accountWithNoVTHO = await ethers.getSigner( - '0xB381e7da548601B1CCB05C66d415b20baE40d828' - ); - const VechainHelloWorldWithNonEmptyConstructor = - await ethers.getContractFactory( - 'VechainHelloWorldWithNonEmptyConstructor', - accountWithNoVTHO - ); - - try { - await VechainHelloWorldWithNonEmptyConstructor.deploy(42, { - value: ethers.parseEther('1'), - from: accountWithNoVTHO.address - }); - fail('should not get here'); - } catch (error) { - if (error instanceof Error) { - // eslint-disable-next-line @typescript-eslint/no-unused-expressions - expect( - error.message.startsWith( - "Error on request eth_sendTransaction: HardhatPluginError: Error on request eth_sendRawTransaction: Error: Method 'HttpClient.http()' failed." - ) - ).to.be.true; - } - } - }); -}); diff --git a/apps/sdk-hardhat-integration/tsconfig.json b/apps/sdk-hardhat-integration/tsconfig.json deleted file mode 100644 index 574e785c7..000000000 --- a/apps/sdk-hardhat-integration/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "target": "es2020", - "module": "commonjs", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "skipLibCheck": true, - "resolveJsonModule": true - } -} diff --git a/apps/sdk-nextjs-integration/.env b/apps/sdk-nextjs-integration/.env deleted file mode 100644 index 7fcbacf9d..000000000 --- a/apps/sdk-nextjs-integration/.env +++ /dev/null @@ -1 +0,0 @@ -NEXT_TELEMETRY_DISABLED = 1 \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/.gitignore b/apps/sdk-nextjs-integration/.gitignore deleted file mode 100644 index 650d1bb56..000000000 --- a/apps/sdk-nextjs-integration/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -.yarn/install-state.gz - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts - -# playwright -test-results/ -playwright-report/ \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/README.md b/apps/sdk-nextjs-integration/README.md deleted file mode 100644 index 210774b1d..000000000 --- a/apps/sdk-nextjs-integration/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# sdk-nextjs-integration - -This is a simple web application built with React and the VeChain SDK that allows users to view transaction history associated with a specific address on the VeChain blockchain. - -## Getting Started - -Install dependencies: - -```bash -yarn install -``` - -Run the development server: - -```bash -yarn dev -``` - -Open your browser and navigate to [http://localhost:3000](http://localhost:3000) to view the application. - -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. - -## Features - - - Retrieve and display transaction history for a given address. - - View details of each transaction, including timestamp, sender, recipient, amount, and transaction ID. - -## Usage - - - Enter the VeChain address you want to retrieve transaction history for in the input field. - - The application will fetch and display the transaction history associated with the provided address. - - Scroll horizontally to view all columns in the transaction history table. diff --git a/apps/sdk-nextjs-integration/__tests__/hash-page.unit.test.tsx b/apps/sdk-nextjs-integration/__tests__/hash-page.unit.test.tsx deleted file mode 100644 index f1de6b8fc..000000000 --- a/apps/sdk-nextjs-integration/__tests__/hash-page.unit.test.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import HashPage from '@/app/hash/page'; -import userEvent from '@testing-library/user-event'; -import '@testing-library/jest-dom'; - -/** - * Tests for the Hash Page component. - * - * Basically, we test @vechain-sdk-core functions integration. - */ -describe('Hash Page', () => { - /** - * Render the page and check if the components are rendered. - * We also check the default values. - */ - it('Should be able to render the page with default values', () => { - // Render the page - render(); - - // Get the heading - const heading = screen.getByText('sdk-nextjs-integration'); - expect(heading).toBeInTheDocument(); - - // Get the content input - const contentInput = screen.getByTestId('contentToHash'); - expect(contentInput).toBeInTheDocument(); - expect(contentInput).toHaveValue('Hello World!'); - - // Get the hash results - const blake2b256 = screen.getByTestId('blake2b256HashLabel'); - expect(blake2b256).toBeInTheDocument(); - expect(blake2b256).toHaveTextContent( - '0xbf56c0728fd4e9cf64bfaf6dabab81554103298cdee5cc4d580433aa25e98b00' - ); - - const keccak256 = screen.getByTestId('keccak256HashLabel'); - expect(keccak256).toBeInTheDocument(); - expect(keccak256).toHaveTextContent( - '0x3ea2f1d0abf3fc66cf29eebb70cbd4e7fe762ef8a09bcc06c8edf641230afec0' - ); - - const sha256 = screen.getByTestId('sha256HashLabel'); - expect(sha256).toBeInTheDocument(); - expect(sha256).toHaveTextContent( - '0x7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069' - ); - }); - - /** - * Render and customize the page with custom values. - * We also check the new values. - */ - it('Should be able to customize values and get results', async () => { - // Render the page - render(); - - // Init user event - const user = userEvent.setup(); - - // Get the content input - const contentInput = screen.getByTestId('contentToHash'); - await user.clear(contentInput); - await user.type(contentInput, 'New content!'); - expect(contentInput).toBeInTheDocument(); - expect(contentInput).toHaveValue('New content!'); - - // Get the hash results - const blake2b256 = screen.getByTestId('blake2b256HashLabel'); - expect(blake2b256).toBeInTheDocument(); - expect(blake2b256).toHaveTextContent( - '0x8875bac8be3b85852155b9d2a510fa0d7396e68c7b441ad550ffe2a3ef9172b4' - ); - - const keccak256 = screen.getByTestId('keccak256HashLabel'); - expect(keccak256).toBeInTheDocument(); - expect(keccak256).toHaveTextContent( - '0xa4b001183dd6ece107d5f3a87c5dc9ef2686bbf83455ebfc58ef6ae26dddf040' - ); - - const sha256 = screen.getByTestId('sha256HashLabel'); - expect(sha256).toBeInTheDocument(); - expect(sha256).toHaveTextContent( - '0x58d49f523fa8ba6187b1bf894281cf966322f65def3988e8069fb89815dffc8d' - ); - }); -}); diff --git a/apps/sdk-nextjs-integration/__tests__/transfer-logs.unit.test.tsx b/apps/sdk-nextjs-integration/__tests__/transfer-logs.unit.test.tsx deleted file mode 100644 index 2cc695034..000000000 --- a/apps/sdk-nextjs-integration/__tests__/transfer-logs.unit.test.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import { act, render, screen, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom'; -import TransferLogs from '@/app/transfer-logs/page'; -import userEvent from '@testing-library/user-event'; -import { thorClient } from '@/const'; - -// Create mock types -interface MockLogsModule { - filterTransferLogs: jest.Mock>; -} - -// Mock the thorClient -jest.mock('../src/const', () => ({ - thorClient: { - logs: { - filterTransferLogs: jest.fn() - } as MockLogsModule - }, - explorerUrl: 'https://testnet.vechain.org' -})); - -/** - * Tests for the Transfer logs Page component. - * - * Basically, we test @vechain-sdk-network functions integration. - */ -describe('Transfer logs Page', () => { - beforeEach(() => { - // Clear all mocks before each test - jest.clearAllMocks(); - - // Mock filterTransferLogs - (thorClient.logs.filterTransferLogs as jest.Mock).mockResolvedValue([ - { - sender: '0xSender1', - recipient: '0xRecipient1', - amount: '1000000000000000000', - meta: { - blockTimestamp: 1624658220, - txID: '0xTransaction1' - } - } - // Add more mock log entries as needed - ]); - }); - - afterEach(() => { - // Restore all mocks after each test - jest.restoreAllMocks(); - }); - - /** - * Render the page and check if the components are rendered. - * We also check the default values. - */ - it('Should be able to render the page with default values', async () => { - let heading; - await act(async () => { - // Render the page - render(); - }); - - // Get the heading - heading = await screen.findByTestId('title'); - - await waitFor(() => { - expect(heading).toBeInTheDocument(); - }); - - // Get the content input - const addressInput = screen.getByTestId('address'); - expect(addressInput).toBeInTheDocument(); - expect(addressInput).toHaveValue( - '0xc3bE339D3D20abc1B731B320959A96A08D479583' - ); - }); - - /** - * Render and customize the page with custom values. - * We also check the new values. - */ - it('Should be able to customize values and get results', async () => { - // Render the page - render(); - - // Init user event - const user = userEvent.setup(); - - // Get the content input - const addressInput = screen.getByTestId('address'); - await user.clear(addressInput); - await user.type( - addressInput, - '0x995711ADca070C8f6cC9ca98A5B9C5A99b8350b1' - ); - expect(addressInput).toBeInTheDocument(); - expect(addressInput).toHaveValue( - '0x995711ADca070C8f6cC9ca98A5B9C5A99b8350b1' - ); - }); -}); diff --git a/apps/sdk-nextjs-integration/e2e/hash.spec.ts b/apps/sdk-nextjs-integration/e2e/hash.spec.ts deleted file mode 100644 index ab13e7731..000000000 --- a/apps/sdk-nextjs-integration/e2e/hash.spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { test, expect } from '@playwright/test'; -import { - Blake2b256, - Keccak256, - Sha256, - Txt -} from '@vechain/sdk-core/dist/index.mjs'; - -test('Hash example', async ({ page }) => { - await page.goto("/"); - - const hashLink = page.getByTestId('hash-link'); - - // Expect link to be visible - await expect(hashLink).toBeVisible(); - - // Click on link - await hashLink.click(); - - // Enter content to hash - const content = "SDK is awesome! :)"; - const hashInput = page.getByTestId('contentToHash'); - await hashInput.clear(); - await hashInput.fill(content); - - // Expect hash component to be visible with expected text - const blake2bHash = page.getByTestId('blake2b256HashLabel'); - const keccak256Hash = page.getByTestId('keccak256HashLabel'); - const sha256Hash = page.getByTestId('sha256HashLabel'); - await expect(blake2bHash).toBeVisible(); - await expect(keccak256Hash).toBeVisible(); - await expect(sha256Hash).toBeVisible(); - - // Assert hash value for blake2b256 - const expectedBlake2b256Hash = Blake2b256.of(Txt.of(content).bytes) - await expect(blake2bHash).toContainText('Blake2b256'); - await expect(blake2bHash).toContainText(expectedBlake2b256Hash.toString()); - - // Assert hash value for keccak256 - const expectedKeccak256Hash = Keccak256.of(Txt.of(content).bytes) - await expect(keccak256Hash).toContainText('Keccak256'); - await expect(keccak256Hash).toContainText(expectedKeccak256Hash.toString()); - - // Assert hash value for sha256 - const expectedSha256Hash = Sha256.of(Txt.of(content).bytes) - await expect(sha256Hash).toContainText('Sha256'); - await expect(sha256Hash).toContainText(expectedSha256Hash.toString()); -}); \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/e2e/lastblock.spec.ts b/apps/sdk-nextjs-integration/e2e/lastblock.spec.ts deleted file mode 100644 index 360ede8cb..000000000 --- a/apps/sdk-nextjs-integration/e2e/lastblock.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Latest block example', async ({ page }) => { - await page.goto("/"); - - const latestBlockLink = page.getByTestId('latest-block-link'); - - // Expect link to be visible - await expect(latestBlockLink).toBeVisible(); - - // Click on link - await latestBlockLink.click(); - - // Click get last block button - const getLastBlockButton = page.getByTestId('getlastblock'); - await expect(getLastBlockButton).toBeVisible(); - await getLastBlockButton.click(); - - // Assert last block details - const lastBlockDetails = page.getByTestId('last-block-details'); - await expect(lastBlockDetails).toBeVisible(); - await expect(lastBlockDetails).toContainText('number'); - await expect(lastBlockDetails).toContainText('id'); -}); \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/e2e/logs.spec.ts b/apps/sdk-nextjs-integration/e2e/logs.spec.ts deleted file mode 100644 index 3a3a21d20..000000000 --- a/apps/sdk-nextjs-integration/e2e/logs.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Transfer logs example', async ({ page }) => { - await page.goto("/"); - - const logsLink = page.getByTestId('transfers-link'); - - // Expect link to be visible - await expect(logsLink).toBeVisible(); - - // Click on link - await logsLink.click(); - - // Enter details to get transfer logs - const addressInput = page.getByTestId('address'); - const fromBlockInput = page.getByTestId('fromblock'); - const toBlockInput = page.getByTestId('toblock'); - - await addressInput.clear(); - await addressInput.fill('0xc3bE339D3D20abc1B731B320959A96A08D479583'); - await fromBlockInput.clear(); - await fromBlockInput.fill('1'); - await toBlockInput.clear(); - await toBlockInput.fill('19251959'); - - // expect logs table to be populated - const tableRows = page.locator('css=[data-testid="logs-table"] tr'); - await expect(tableRows).toHaveCount(8); // 8 rows in the table, this is a retryable assertion -}); \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/eslint.config.mjs b/apps/sdk-nextjs-integration/eslint.config.mjs deleted file mode 100644 index 724052a2e..000000000 --- a/apps/sdk-nextjs-integration/eslint.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig -]; diff --git a/apps/sdk-nextjs-integration/jest-environment-jsdom.js b/apps/sdk-nextjs-integration/jest-environment-jsdom.js deleted file mode 100644 index dc850aa20..000000000 --- a/apps/sdk-nextjs-integration/jest-environment-jsdom.js +++ /dev/null @@ -1,18 +0,0 @@ -const { TextEncoder, TextDecoder } = require('node:util') -const { default: $JSDOMEnvironment, TestEnvironment } = require('jest-environment-jsdom') - -Object.defineProperty(exports, '__esModule', { - value: true, -}) - -class JSDOMEnvironment extends $JSDOMEnvironment { - constructor(...args) { - const { global } = super(...args) - global.TextEncoder = TextEncoder - global.TextDecoder = TextDecoder - global.Uint8Array = Uint8Array - } -} - -exports.default = JSDOMEnvironment -exports.TestEnvironment = TestEnvironment === $JSDOMEnvironment ? JSDOMEnvironment : TestEnvironment \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/jest.config.js b/apps/sdk-nextjs-integration/jest.config.js deleted file mode 100644 index ea7466acc..000000000 --- a/apps/sdk-nextjs-integration/jest.config.js +++ /dev/null @@ -1,24 +0,0 @@ -const nextJest = require('next/jest'); - -const createJestConfig = nextJest({ - // Provide the path to your Next.js app to load next.config.js and .env files in your test environment - dir: './', - coverageThreshold: { - global: { - branches: 100, - functions: 100, - lines: 100, - statements: 100 - } - } -}); - -// Add any custom config to be passed to Jest -const customJestConfig = { - setupFilesAfterEnv: ['/jest.setup.js'], - testEnvironment: './jest-environment-jsdom.js', - testPathIgnorePatterns: ['/e2e/'] -}; - -// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async -module.exports = createJestConfig(customJestConfig); diff --git a/apps/sdk-nextjs-integration/jest.setup.js b/apps/sdk-nextjs-integration/jest.setup.js deleted file mode 100644 index ee6ccea1a..000000000 --- a/apps/sdk-nextjs-integration/jest.setup.js +++ /dev/null @@ -1,2 +0,0 @@ -// Learn more: https://github.com/testing-library/jest-dom -import "@testing-library/jest-dom"; diff --git a/apps/sdk-nextjs-integration/next.config.mjs b/apps/sdk-nextjs-integration/next.config.mjs deleted file mode 100644 index 9e932ca2f..000000000 --- a/apps/sdk-nextjs-integration/next.config.mjs +++ /dev/null @@ -1,14 +0,0 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = { - env: { - NEXT_TELEMETRY_DISABLED: "1" - }, - webpack: function (config, options) { - if(!options.isServer) { - config.resolve.fallback = { ...config.resolve.fallback, net: false, tls: false }; - } - return config; - }, -}; - -export default nextConfig; diff --git a/apps/sdk-nextjs-integration/package.json b/apps/sdk-nextjs-integration/package.json deleted file mode 100644 index e1b1776d0..000000000 --- a/apps/sdk-nextjs-integration/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "sdk-nextjs-integration", - "description": "An example app of how to integrate the VeChain SDK with Next.js", - "version": "2.0.0-beta.1", - "private": true, - "author": "VeChain Foundation", - "license": "MIT", - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint", - "test": "jest", - "test:watch": "jest --watch", - "test:e2e": "playwright test" - }, - "dependencies": { - "@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", - "react-dom": "^18" - }, - "devDependencies": { - "@playwright/test": "^1.49.0", - "@testing-library/dom": "^10.1.0", - "@testing-library/jest-dom": "^6.6.3", - "@testing-library/react": "^16.1.0", - "@testing-library/user-event": "^14.5.2", - "@types/jest": "^29.5.14", - "@types/node": "^22", - "@types/react": "^18.3.5", - "@types/react-dom": "^18.3.1", - "autoprefixer": "^10.0.1", - "eslint": "^9.14.0", - "eslint-config-next": "15.0.2", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "postcss": "^8", - "tailwindcss": "^3.4.17", - "typescript": "^5" - } -} \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/playwright.config.ts b/apps/sdk-nextjs-integration/playwright.config.ts deleted file mode 100644 index 2f3886859..000000000 --- a/apps/sdk-nextjs-integration/playwright.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -// playwright.config.ts -import { defineConfig, devices } from '@playwright/test'; - -export default defineConfig({ - // Look for test files in the "tests" directory, relative to this configuration file. - testDir: 'e2e', - - // Run all tests in parallel. - fullyParallel: true, - - // Fail the build on CI if you accidentally left test.only in the source code. - forbidOnly: !!process.env.CI, - - // Retry on CI only. - retries: process.env.CI ? 2 : 0, - - // Opt out of parallel tests on CI. - workers: process.env.CI ? 1 : undefined, - - // Reporter to use, see https://playwright.dev/docs/test-reporters - reporter: 'html', - - use: { - // Base URL to use in actions like `await page.goto('/')`. - baseURL: 'http://localhost:3000', - - // Collect trace when retrying the failed test. - trace: 'on-first-retry' - }, - // Configure projects for major browsers. - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] } - } - ], - // Run your local dev server before starting the tests. - webServer: { - command: 'yarn dev', - url: 'http://localhost:3000', - timeout: 120 * 1000, - reuseExistingServer: !process.env.CI - } -}); diff --git a/apps/sdk-nextjs-integration/postcss.config.js b/apps/sdk-nextjs-integration/postcss.config.js deleted file mode 100644 index 12a703d90..000000000 --- a/apps/sdk-nextjs-integration/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -}; diff --git a/apps/sdk-nextjs-integration/public/next.svg b/apps/sdk-nextjs-integration/public/next.svg deleted file mode 100644 index 5174b28c5..000000000 --- a/apps/sdk-nextjs-integration/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/public/vercel.svg b/apps/sdk-nextjs-integration/public/vercel.svg deleted file mode 100644 index d2f842227..000000000 --- a/apps/sdk-nextjs-integration/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/src/app/favicon.ico b/apps/sdk-nextjs-integration/src/app/favicon.ico deleted file mode 100644 index 718d6fea4835ec2d246af9800eddb7ffb276240c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8Po~fxRJv}|0e(BPs|G`(TT%kKVJAdg5*Z|x0leQq0 zkdUBvb#>9F()jo|T~kx@OM8$9wzs~t2l;K=woNssA3l6|sx2r3+kdfVW@e^8e*E}v zA1y5{bRi+3Z`uD3{F7LgFJDdvm;nJilkzDku>BwXH(8ItVCXk*-lSJnR?-2UN%hJ){&rlvg`CDTj z)Bzo!3v7Ou#83zEDEFcKt(f1E0~=rqeEbTnMvWR#{+9pg%7G8y>u1OVRUSoox-ovF z2Ydma(;=YuBY(eI|04{hXzZD6_f(v~H;C~y5=DhAC{MMS>2fm~1H_t2$56pc$NH8( z5bH|<)71dV-_oCHIrzrT`2s-5w_+2CM0$95I6X8p^r!gHp+j_gd;9O<1~CEQQGS8) zS9Qh3#p&JM-G8rHekNmKVewU;pJRcTAog68KYo^dRo}(M>36U4Us zfgYWSiHZL3;lpWT=zNAW>Dh#mB!_@Lg%$ms8N-;aPqMn+C2HqZgz&9~Eu z4|Kp<`$q)Uw1R?y(~S>ePdonHxpV1#eSP1B;Ogo+-Pk}6#0GsZZ5!||ev2MGdh}_m z{DeR7?0-1^zVs&`AV6Vt;r3`I`OI_wgs*w=eO%_#7Kepl{B@xiyCANc(l zzIyd4y|c6PXWq9-|KM8(zIk8LPk(>a)zyFWjhT!$HJ$qX1vo@d25W<fvZQ2zUz5WRc(UnFMKHwe1| zWmlB1qdbiA(C0jmnV<}GfbKtmcu^2*P^O?MBLZKt|As~ge8&AAO~2K@zbXelK|4T<{|y4`raF{=72kC2Kn(L4YyenWgrPiv z@^mr$t{#X5VuIMeL!7Ab6_kG$&#&5p*Z{+?5U|TZ`B!7llpVmp@skYz&n^8QfPJzL z0G6K_OJM9x+Wu2gfN45phANGt{7=C>i34CV{Xqlx(fWpeAoj^N0Biu`w+MVcCUyU* zDZuzO0>4Z6fbu^T_arWW5n!E45vX8N=bxTVeFoep_G#VmNlQzAI_KTIc{6>c+04vr zx@W}zE5JNSU>!THJ{J=cqjz+4{L4A{Ob9$ZJ*S1?Ggg3klFp!+Y1@K+pK1DqI|_gq z5ZDXVpge8-cs!o|;K73#YXZ3AShj50wBvuq3NTOZ`M&qtjj#GOFfgExjg8Gn8>Vq5 z`85n+9|!iLCZF5$HJ$Iu($dm?8~-ofu}tEc+-pyke=3!im#6pk_Wo8IA|fJwD&~~F zc16osQ)EBo58U7XDuMexaPRjU@h8tXe%S{fA0NH3vGJFhuyyO!Uyl2^&EOpX{9As0 zWj+P>{@}jxH)8|r;2HdupP!vie{sJ28b&bo!8`D^x}TE$%zXNb^X1p@0PJ86`dZyj z%ce7*{^oo+6%&~I!8hQy-vQ7E)0t0ybH4l%KltWOo~8cO`T=157JqL(oq_rC%ea&4 z2NcTJe-HgFjNg-gZ$6!Y`SMHrlj}Etf7?r!zQTPPSv}{so2e>Fjs1{gzk~LGeesX%r(Lh6rbhSo_n)@@G-FTQy93;l#E)hgP@d_SGvyCp0~o(Y;Ee8{ zdVUDbHm5`2taPUOY^MAGOw*>=s7=Gst=D+p+2yON!0%Hk` zz5mAhyT4lS*T3LS^WSxUy86q&GnoHxzQ6vm8)VS}_zuqG?+3td68_x;etQAdu@sc6 zQJ&5|4(I?~3d-QOAODHpZ=hlSg(lBZ!JZWCtHHSj`0Wh93-Uk)_S%zsJ~aD>{`A0~ z9{AG(e|q3g5B%wYKRxiL2Y$8(4w6bzchKuloQW#e&S3n+P- z8!ds-%f;TJ1>)v)##>gd{PdS2Oc3VaR`fr=`O8QIO(6(N!A?pr5C#6fc~Ge@N%Vvu zaoAX2&(a6eWy_q&UwOhU)|P3J0Qc%OdhzW=F4D|pt0E4osw;%<%Dn58hAWD^XnZD= z>9~H(3bmLtxpF?a7su6J7M*x1By7YSUbxGi)Ot0P77`}P3{)&5Un{KD?`-e?r21!4vTTnN(4Y6Lin?UkSM z`MXCTC1@4A4~mvz%Rh2&EwY))LeoT=*`tMoqcEXI>TZU9WTP#l?uFv+@Dn~b(>xh2 z;>B?;Tz2SR&KVb>vGiBSB`@U7VIWFSo=LDSb9F{GF^DbmWAfpms8Sx9OX4CnBJca3 zlj9(x!dIjN?OG1X4l*imJNvRCk}F%!?SOfiOq5y^mZW)jFL@a|r-@d#f7 z2gmU8L3IZq0ynIws=}~m^#@&C%J6QFo~Mo4V`>v7MI-_!EBMMtb%_M&kvAaN)@ZVw z+`toz&WG#HkWDjnZE!6nk{e-oFdL^$YnbOCN}JC&{$#$O27@|Tn-skXr)2ml2~O!5 zX+gYoxhoc7qoU?C^3~&!U?kRFtnSEecWuH0B0OvLodgUAi}8p1 zrO6RSXHH}DMc$&|?D004DiOVMHV8kXCP@7NKB zgaZq^^O<7PoKEp72kby@W0Z!Y*Ay{&vfg#C&gG@YVR9g?FEocMUi1gSN$+V+ayF45{a zuDZDTN}mS|;BO%gEf}pjBfN2-gIrU#G5~cucA;dokXW89%>AyXJJI z9X4UlIWA|ZYHgbI z5?oFk@A=Ik7lrEQPDH!H+b`7_Y~aDb_qa=B2^Y&Ow41cU=4WDd40dp5(QS-WMN-=Y z9g;6_-JdNU;|6cPwf$ak*aJIcwL@1n$#l~zi{c{EW?T;DaW*E8DYq?Umtz{nJ&w-M zEMyTDrC&9K$d|kZe2#ws6)L=7K+{ zQw{XnV6UC$6-rW0emqm8wJoeZK)wJIcV?dST}Z;G0Arq{dVDu0&4kd%N!3F1*;*pW zR&qUiFzK=@44#QGw7k1`3t_d8&*kBV->O##t|tonFc2YWrL7_eqg+=+k;!F-`^b8> z#KWCE8%u4k@EprxqiV$VmmtiWxDLgnGu$Vs<8rppV5EajBXL4nyyZM$SWVm!wnCj-B!Wjqj5-5dNXukI2$$|Bu3Lrw}z65Lc=1G z^-#WuQOj$hwNGG?*CM_TO8Bg-1+qc>J7k5c51U8g?ZU5n?HYor;~JIjoWH-G>AoUP ztrWWLbRNqIjW#RT*WqZgPJXU7C)VaW5}MiijYbABmzoru6EmQ*N8cVK7a3|aOB#O& zBl8JY2WKfmj;h#Q!pN%9o@VNLv{OUL?rixHwOZuvX7{IJ{(EdPpuVFoQqIOa7giLVkBOKL@^smUA!tZ1CKRK}#SSM)iQHk)*R~?M!qkCruaS!#oIL1c z?J;U~&FfH#*98^G?i}pA{ z9Jg36t4=%6mhY(quYq*vSxptes9qy|7xSlH?G=S@>u>Ebe;|LVhs~@+06N<4CViBk zUiY$thvX;>Tby6z9Y1edAMQaiH zm^r3v#$Q#2T=X>bsY#D%s!bhs^M9PMAcHbCc0FMHV{u-dwlL;a1eJ63v5U*?Q_8JO zT#50!RD619#j_Uf))0ooADz~*9&lN!bBDRUgE>Vud-i5ck%vT=r^yD*^?Mp@Q^v+V zG#-?gKlr}Eeqifb{|So?HM&g91P8|av8hQoCmQXkd?7wIJwb z_^v8bbg`SAn{I*4bH$u(RZ6*xUhuA~hc=8czK8SHEKTzSxgbwi~9(OqJB&gwb^l4+m`k*Q;_?>Y-APi1{k zAHQ)P)G)f|AyjSgcCFps)Fh6Bca*Xznq36!pV6Az&m{O8$wGFD? zY&O*3*J0;_EqM#jh6^gMQKpXV?#1?>$ml1xvh8nSN>-?H=V;nJIwB07YX$e6vLxH( zqYwQ>qxwR(i4f)DLd)-$P>T-no_c!LsN@)8`e;W@)-Hj0>nJ-}Kla4-ZdPJzI&Mce zv)V_j;(3ERN3_@I$N<^|4Lf`B;8n+bX@bHbcZTopEmDI*Jfl)-pFDvo6svPRoo@(x z);_{lY<;);XzT`dBFpRmGrr}z5u1=pC^S-{ce6iXQlLGcItwJ^mZx{m$&DA_oEZ)B{_bYPq-HA zcH8WGoBG(aBU_j)vEy+_71T34@4dmSg!|M8Vf92Zj6WH7Q7t#OHQqWgFE3ARt+%!T z?oLovLVlnf?2c7pTc)~cc^($_8nyKwsN`RA-23ed3sdj(ys%pjjM+9JrctL;dy8a( z@en&CQmnV(()bu|Y%G1-4a(6x{aLytn$T-;(&{QIJB9vMox11U-1HpD@d(QkaJdEb zG{)+6Dos_L+O3NpWo^=gR?evp|CqEG?L&Ut#D*KLaRFOgOEK(Kq1@!EGcTfo+%A&I z=dLbB+d$u{sh?u)xP{PF8L%;YPPW53+@{>5W=Jt#wQpN;0_HYdw1{ksf_XhO4#2F= zyPx6Lx2<92L-;L5PD`zn6zwIH`Jk($?Qw({erA$^bC;q33hv!d!>%wRhj# zal^hk+WGNg;rJtb-EB(?czvOM=H7dl=vblBwAv>}%1@{}mnpUznfq1cE^sgsL0*4I zJ##!*B?=vI_OEVis5o+_IwMIRrpQyT_Sq~ZU%oY7c5JMIADzpD!Upz9h@iWg_>>~j zOLS;wp^i$-E?4<_cp?RiS%Rd?i;f*mOz=~(&3lo<=@(nR!_Rqiprh@weZlL!t#NCc zO!QTcInq|%#>OVgobj{~ixEUec`E25zJ~*DofsQdzIa@5^nOXj2T;8O`l--(QyU^$t?TGY^7#&FQ+2SS3B#qK*k3`ye?8jUYSajE5iBbJls75CCc(m3dk{t?- zopcER9{Z?TC)mk~gpi^kbbu>b-+a{m#8-y2^p$ka4n60w;Sc2}HMf<8JUvhCL0B&Btk)T`ctE$*qNW8L$`7!r^9T+>=<=2qaq-;ll2{`{Rg zc5a0ZUI$oG&j-qVOuKa=*v4aY#IsoM+1|c4Z)<}lEDvy;5huB@1RJPquU2U*U-;gu z=En2m+qjBzR#DEJDO`WU)hdd{Vj%^0V*KoyZ|5lzV87&g_j~NCjwv0uQVqXOb*QrQ zy|Qn`hxx(58c70$E;L(X0uZZ72M1!6oeg)(cdKO ze0gDaTz+ohR-#d)NbAH4x{I(21yjwvBQfmpLu$)|m{XolbgF!pmsqJ#D}(ylp6uC> z{bqtcI#hT#HW=wl7>p!38sKsJ`r8}lt-q%Keqy%u(xk=yiIJiUw6|5IvkS+#?JTBl z8H5(Q?l#wzazujH!8o>1xtn8#_w+397*_cy8!pQGP%K(Ga3pAjsaTbbXJlQF_+m+-UpUUent@xM zg%jqLUExj~o^vQ3Gl*>wh=_gOr2*|U64_iXb+-111aH}$TjeajM+I20xw(((>fej-@CIz4S1pi$(#}P7`4({6QS2CaQS4NPENDp>sAqD z$bH4KGzXGffkJ7R>V>)>tC)uax{UsN*dbeNC*v}#8Y#OWYwL4t$ePR?VTyIs!wea+ z5Urmc)X|^`MG~*dS6pGSbU+gPJoq*^a=_>$n4|P^w$sMBBy@f*Z^Jg6?n5?oId6f{ z$LW4M|4m502z0t7g<#Bx%X;9<=)smFolV&(V^(7Cv2-sxbxopQ!)*#ZRhTBpx1)Fc zNm1T%bONzv6@#|dz(w02AH8OXe>kQ#1FMCzO}2J_mST)+ExmBr9cva-@?;wnmWMOk z{3_~EX_xadgJGv&H@zK_8{(x84`}+c?oSBX*Ge3VdfTt&F}yCpFP?CpW+BE^cWY0^ zb&uBN!Ja3UzYHK-CTyA5=L zEMW{l3Usky#ly=7px648W31UNV@K)&Ub&zP1c7%)`{);I4b0Q<)B}3;NMG2JH=X$U zfIW4)4n9ZM`-yRj67I)YSLDK)qfUJ_ij}a#aZN~9EXrh8eZY2&=uY%2N0UFF7<~%M zsB8=erOWZ>Ct_#^tHZ|*q`H;A)5;ycw*IcmVxi8_0Xk}aJA^ath+E;xg!x+As(M#0=)3!NJR6H&9+zd#iP(m0PIW8$ z1Y^VX`>jm`W!=WpF*{ioM?C9`yOR>@0q=u7o>BP-eSHqCgMDj!2anwH?s%i2p+Q7D zzszIf5XJpE)IG4;d_(La-xenmF(tgAxK`Y4sQ}BSJEPs6N_U2vI{8=0C_F?@7<(G; zo$~G=8p+076G;`}>{MQ>t>7cm=zGtfbdDXm6||jUU|?X?CaE?(<6bKDYKeHlz}DA8 zXT={X=yp_R;HfJ9h%?eWvQ!dRgz&Su*JfNt!Wu>|XfU&68iRikRrHRW|ZxzRR^`eIGt zIeiDgVS>IeExKVRWW8-=A=yA`}`)ZkWBrZD`hpWIxBGkh&f#ijr449~m`j6{4jiJ*C!oVA8ZC?$1RM#K(_b zL9TW)kN*Y4%^-qPpMP7d4)o?Nk#>aoYHT(*g)qmRUb?**F@pnNiy6Fv9rEiUqD(^O zzyS?nBrX63BTRYduaG(0VVG2yJRe%o&rVrLjbxTaAFTd8s;<<@Qs>u(<193R8>}2_ zuwp{7;H2a*X7_jryzriZXMg?bTuegABb^87@SsKkr2)0Gyiax8KQWstw^v#ix45EVrcEhr>!NMhprl$InQMzjSFH54x5k9qHc`@9uKQzvL4ihcq{^B zPrVR=o_ic%Y>6&rMN)hTZsI7I<3&`#(nl+3y3ys9A~&^=4?PL&nd8)`OfG#n zwAMN$1&>K++c{^|7<4P=2y(B{jJsQ0a#U;HTo4ZmWZYvI{+s;Td{Yzem%0*k#)vjpB zia;J&>}ICate44SFYY3vEelqStQWFihx%^vQ@Do(sOy7yR2@WNv7Y9I^yL=nZr3mb zXKV5t@=?-Sk|b{XMhA7ZGB@2hqsx}4xwCW!in#C zI@}scZlr3-NFJ@NFaJlhyfcw{k^vvtGl`N9xSo**rDW4S}i zM9{fMPWo%4wYDG~BZ18BD+}h|GQKc-g^{++3MY>}W_uq7jGHx{mwE9fZiPCoxN$+7 zrODGGJrOkcPQUB(FD5aoS4g~7#6NR^ma7-!>mHuJfY5kTe6PpNNKC9GGRiu^L31uG z$7v`*JknQHsYB!Tm_W{a32TM099djW%5e+j0Ve_ct}IM>XLF1Ap+YvcrLV=|CKo6S zb+9Nl3_YdKP6%Cxy@6TxZ>;4&nTneadr z_ES90ydCev)LV!dN=#(*f}|ZORFdvkYBni^aLbUk>BajeWIOcmHP#8S)*2U~QKI%S zyrLmtPqb&TphJ;>yAxri#;{uyk`JJqODDw%(Z=2`1uc}br^V%>j!gS)D*q*f_-qf8&D;W1dJgQMlaH5er zN2U<%Smb7==vE}dDI8K7cKz!vs^73o9f>2sgiTzWcwY|BMYHH5%Vn7#kiw&eItCqa zIkR2~Q}>X=Ar8W|^Ms41Fm8o6IB2_j60eOeBB1Br!boW7JnoeX6Gs)?7rW0^5psc- zjS16yb>dFn>KPOF;imD}e!enuIniFzv}n$m2#gCCv4jM#ArwlzZ$7@9&XkFxZ4n!V zj3dyiwW4Ki2QG{@i>yuZXQizw_OkZI^-3otXC{!(lUpJF33gI60ak;Uqitp74|B6I zgg{b=Iz}WkhCGj1M=hu4#Aw173YxIVbISaoc z-nLZC*6Tgivd5V`K%GxhBsp@SUU60-rfc$=wb>zdJzXS&-5(NRRodFk;Kxk!S(O(a0e7oY=E( zAyS;Ow?6Q&XA+cnkCb{28_1N8H#?J!*$MmIwLq^*T_9-z^&UE@A(z9oGYtFy6EZef LrJugUA?W`A8`#=m diff --git a/apps/sdk-nextjs-integration/src/app/get-last-block/page.tsx b/apps/sdk-nextjs-integration/src/app/get-last-block/page.tsx deleted file mode 100644 index 5f7ee907e..000000000 --- a/apps/sdk-nextjs-integration/src/app/get-last-block/page.tsx +++ /dev/null @@ -1,60 +0,0 @@ -'use client'; - -import { type CompressedBlockDetail } from '@vechain/sdk-network'; -import { useState } from 'react'; -import { thorClient } from '@/const'; -import { Header } from '@/components'; - -export default function LastBlockPage(): JSX.Element { - const [block, setBlock] = useState(null); - - // Function to fetch the last block - const fetchLastBlock = async (): Promise => { - try { - const lastBlock = - await thorClient.blocks.getBlockCompressed('best'); - setBlock(lastBlock); - } catch (error) { - console.error('Error fetching the last block:', error); - } - }; - - return ( -
-
-
-

- Press button below to get last block details -

-
- - {block != null && ( -
-

Last Block Details:

-
-                                {JSON.stringify(block, null, 2)}
-                            
-
- )} -
-
-
- ); -} diff --git a/apps/sdk-nextjs-integration/src/app/globals.css b/apps/sdk-nextjs-integration/src/app/globals.css deleted file mode 100644 index bd6213e1d..000000000 --- a/apps/sdk-nextjs-integration/src/app/globals.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; \ No newline at end of file diff --git a/apps/sdk-nextjs-integration/src/app/hash/page.tsx b/apps/sdk-nextjs-integration/src/app/hash/page.tsx deleted file mode 100644 index 3e82e6d35..000000000 --- a/apps/sdk-nextjs-integration/src/app/hash/page.tsx +++ /dev/null @@ -1,80 +0,0 @@ -'use client'; - -import { useState, useEffect } from 'react'; - -import { Blake2b256, Keccak256, Sha256, Txt } from '@vechain/sdk-core'; -import { type HashedContent } from '@/types'; -import { Header } from '@/components'; - -export default function HashPage(): JSX.Element { - // State of content to hash - const [contentToHash, setContentToHash] = useState('Hello World!'); - - // State of Hashed content - const [hashedContent, setHashedContent] = useState({ - blake2b256: '', - keccak256: '', - sha256: '' - }); - - /** - * Function to get the history for the provided address - * @param content The address to get the history for - */ - function hashContent(content: string): void { - try { - setHashedContent({ - blake2b256: Blake2b256.of(Txt.of(content).bytes).toString(), - keccak256: Keccak256.of(Txt.of(content).bytes).toString(), - sha256: Sha256.of(Txt.of(content).bytes).toString() - }); - } catch (error) { - setHashedContent({ - blake2b256: - '0xbf56c0728fd4e9cf64bfaf6dabab81554103298cdee5cc4d580433aa25e98b00', - keccak256: - '0x3ea2f1d0abf3fc66cf29eebb70cbd4e7fe762ef8a09bcc06c8edf641230afec0', - sha256: '0x7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069' - }); - console.log(error); - } - } - - // Update the history when the address changes - useEffect(() => { - hashContent(contentToHash); - }, [contentToHash]); - - return ( -
-
-
-

- Insert some content to hash -

- { - setContentToHash(e.target.value); - }} - value={contentToHash} - className="block mx-auto w-full sm:max-w-md border-2 border-dark focus:border-purple-500 bg-transparent py-2 px-4 text-lg text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 outline-none rounded-md" - placeholder="0xc3bE339D3D20abc1B731B320959A96A08D479583" - /> -
-
-

- Blake2b256: {hashedContent.blake2b256} -

-

- Keccak256: {hashedContent.keccak256} -

-

- Sha256: {hashedContent.sha256} -

-
-
- ); -} diff --git a/apps/sdk-nextjs-integration/src/app/layout.tsx b/apps/sdk-nextjs-integration/src/app/layout.tsx deleted file mode 100644 index aacc245ca..000000000 --- a/apps/sdk-nextjs-integration/src/app/layout.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import type { Metadata } from 'next'; -import { Inter } from 'next/font/google'; -import './globals.css'; - -const inter = Inter({ subsets: ['latin'] }); - -export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app' -}; - -export default function RootLayout({ - children -}: Readonly<{ - children: React.ReactNode; -}>): JSX.Element { - return ( - - {children} - - ); -} diff --git a/apps/sdk-nextjs-integration/src/app/page.tsx b/apps/sdk-nextjs-integration/src/app/page.tsx deleted file mode 100644 index 409ef7d99..000000000 --- a/apps/sdk-nextjs-integration/src/app/page.tsx +++ /dev/null @@ -1,61 +0,0 @@ -'use client'; - -import { Header } from '@/components'; -import Link from 'next/link'; - -export default function Home(): JSX.Element { - return ( -
-
-
- {/* Title */} -
-

- Welcome to the SDK Next.js Integration! -

-
- {/* Subtitle */} -
-

- In this project you will find some cool examples of how - to integrate the Vechain SDK with Next.js -

-
- - {/* Links to examples */} -
-

- @vechain/sdk-core integration example:{' '} - - Hash - -

-

- @vechain/sdk-network integration example:{' '} - - Transfer logs - -

-

- @vechain/sdk-network integration example:{' '} - - Get last block - -

-
-
-
- ); -} diff --git a/apps/sdk-nextjs-integration/src/app/transfer-logs/page.tsx b/apps/sdk-nextjs-integration/src/app/transfer-logs/page.tsx deleted file mode 100644 index 46a0d779f..000000000 --- a/apps/sdk-nextjs-integration/src/app/transfer-logs/page.tsx +++ /dev/null @@ -1,197 +0,0 @@ -'use client'; - -import { Header } from '@/components'; -import { explorerUrl, thorClient } from '@/const'; -import { type Transfer } from '@/types'; -import { reduceHexStringSize } from '@/utils'; -import { Address, FixedPointNumber, Units } from '@vechain/sdk-core'; -import { type FilterTransferLogsOptions } from '@vechain/sdk-network'; -import Link from 'next/link'; -import { useEffect, useState } from 'react'; - -export default function TransferLogs(): JSX.Element { - // State to store the transfer history - const [transfers, setTransfers] = useState([]); - - // State to store the address - const [address, setAddress] = useState( - '0xc3bE339D3D20abc1B731B320959A96A08D479583' - ); - - // Add range for blocks - const [fromBlock, setFromBlock] = useState(1); - const [toBlock, setToBlock] = useState(19251959); - - /** - * Function to get the history for the provided address - * @param address The address to get the history for - */ - async function getHistoryFor(address: string): Promise { - try { - // Filter options for the transfer logs - const filterOptions: FilterTransferLogsOptions = { - criteriaSet: [ - { sender: address }, // Transactions sent by the address - { recipient: address } // Transactions received by the address - ], - order: 'desc', // Order logs by descending timestamp - range: { - unit: 'block', - from: fromBlock, - to: toBlock - } - }; - - // Get the transfer logs - const logs = - await thorClient.logs.filterTransferLogs(filterOptions); - - // Map the logs to the transfer interface - const transfers = logs.map((log) => { - return { - from: log.sender, - to: log.recipient, - amount: log.amount, - meta: log.meta - }; - }); - setTransfers(transfers); - } catch (error) { - setTransfers([]); - console.log(error); - } - } - - // Update the history when the address changes - useEffect(() => { - if (Address.isValid(address)) { - void getHistoryFor(address); - } - }, [address]); - - return ( -
-
-
-

- Insert an address to get the transfer history -

- { - setAddress(e.target.value); - }} - value={address} - className="block mx-auto w-full sm:max-w-md border-2 border-dark focus:border-purple-500 bg-transparent py-2 px-4 text-lg text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 outline-none rounded-md" - placeholder="0xc3bE339D3D20abc1B731B320959A96A08D479583" - /> -

- fromBlock -

- { - setFromBlock(parseInt(e.target.value)); - }} - value={fromBlock} - className="block mx-auto w-full sm:max-w-md border-2 border-dark focus:border-purple-500 bg-transparent py-2 px-4 text-lg text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 outline-none rounded-md" - placeholder="1" - /> -

toBlock

- { - setToBlock(parseInt(e.target.value)); - }} - value={toBlock} - className="block mx-auto w-full sm:max-w-md border-2 border-dark focus:border-purple-500 bg-transparent py-2 px-4 text-lg text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 outline-none rounded-md" - placeholder="19251959" - /> -
-
- - - - - - - - - - - - {transfers.map((transfer) => ( - - {/* Use txID as the unique key */} - - - - - - - ))} - -
TimeFromToAmountTransaction Id
-

- {new Date( - transfer.meta.blockTimestamp * 1000 - ).toISOString()} -

-
- -

- {reduceHexStringSize(transfer.from)} -

- -
- - {reduceHexStringSize(transfer.to)} - - -

- {Units.formatEther( - FixedPointNumber.of(transfer.amount) - )} -

-
- - {reduceHexStringSize( - transfer.meta.txID - )} - -
-
-
- ); -} diff --git a/apps/sdk-nextjs-integration/src/components/header/header.tsx b/apps/sdk-nextjs-integration/src/components/header/header.tsx deleted file mode 100644 index 5a3ab3828..000000000 --- a/apps/sdk-nextjs-integration/src/components/header/header.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Main header component. - */ -function Header(): JSX.Element { - return ( - <> - {/* Background gradient */} - - {/* Title */} -
-

- sdk-nextjs-integration -

-
- - ); -} - -export { Header }; diff --git a/apps/sdk-nextjs-integration/src/components/header/index.tsx b/apps/sdk-nextjs-integration/src/components/header/index.tsx deleted file mode 100644 index 677ca79d4..000000000 --- a/apps/sdk-nextjs-integration/src/components/header/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './header'; diff --git a/apps/sdk-nextjs-integration/src/components/index.tsx b/apps/sdk-nextjs-integration/src/components/index.tsx deleted file mode 100644 index 677ca79d4..000000000 --- a/apps/sdk-nextjs-integration/src/components/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './header'; diff --git a/apps/sdk-nextjs-integration/src/const/const.tsx b/apps/sdk-nextjs-integration/src/const/const.tsx deleted file mode 100644 index dcb4adb5b..000000000 --- a/apps/sdk-nextjs-integration/src/const/const.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { ThorClient } from '@vechain/sdk-network'; - -/** - * Thor client instance, using mainnet URL - */ -const thorClient = ThorClient.at('https://mainnet.vechain.org'); - -/** - * Explorer url - */ -const explorerUrl = 'https://explore.vechain.org'; - -export { thorClient, explorerUrl }; diff --git a/apps/sdk-nextjs-integration/src/const/index.tsx b/apps/sdk-nextjs-integration/src/const/index.tsx deleted file mode 100644 index e47ea3a46..000000000 --- a/apps/sdk-nextjs-integration/src/const/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './const'; diff --git a/apps/sdk-nextjs-integration/src/types/index.tsx b/apps/sdk-nextjs-integration/src/types/index.tsx deleted file mode 100644 index 8b2ee98ba..000000000 --- a/apps/sdk-nextjs-integration/src/types/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export type * from './types.d'; diff --git a/apps/sdk-nextjs-integration/src/types/types.d.tsx b/apps/sdk-nextjs-integration/src/types/types.d.tsx deleted file mode 100644 index fc2c16b58..000000000 --- a/apps/sdk-nextjs-integration/src/types/types.d.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Transfer interface definition. - * It is used to represent an element - * of the transfer history - */ -interface Transfer { - from: string; - to: string; - amount: string; - meta: { - blockID: string; // Block identifier associated with the entity - blockNumber: number; // Block number associated with the entity - blockTimestamp: number; // Timestamp of the block - txID: string; // Transaction ID associated with the entity - txOrigin: string; // Transaction origin information - clauseIndex: number; // Index of the clause - }; -} - -/** - * Hashed content example type. - */ -interface HashedContent { - blake2b256: string; - keccak256: string; - sha256: string; -} - -export { type Transfer, type HashedContent }; diff --git a/apps/sdk-nextjs-integration/src/utils/index.tsx b/apps/sdk-nextjs-integration/src/utils/index.tsx deleted file mode 100644 index 04bca77e0..000000000 --- a/apps/sdk-nextjs-integration/src/utils/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './utils'; diff --git a/apps/sdk-nextjs-integration/src/utils/utils.tsx b/apps/sdk-nextjs-integration/src/utils/utils.tsx deleted file mode 100644 index 0a551a2e1..000000000 --- a/apps/sdk-nextjs-integration/src/utils/utils.tsx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Reduce the size of a hex string - * - * @param hexString Hex string to reduce - */ -function reduceHexStringSize(hexString: string): string { - // Size to reduce the hex string - const size = 5; - - // Return the reduced hex string - return `${hexString.slice(0, size)}...${hexString.slice(-size)}`; -} - -export { reduceHexStringSize }; diff --git a/apps/sdk-nextjs-integration/tailwind.config.ts b/apps/sdk-nextjs-integration/tailwind.config.ts deleted file mode 100644 index f0ae9647c..000000000 --- a/apps/sdk-nextjs-integration/tailwind.config.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Config } from 'tailwindcss'; - -const config: Config = { - content: [ - './src/pages/**/*.{js,ts,jsx,tsx,mdx}', - './src/components/**/*.{js,ts,jsx,tsx,mdx}', - './src/app/**/*.{js,ts,jsx,tsx,mdx}' - ], - theme: { - extend: { - backgroundImage: { - 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', - 'gradient-conic': - 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))' - } - } - }, - plugins: [] -}; -export default config; diff --git a/apps/sdk-nextjs-integration/tsconfig.json b/apps/sdk-nextjs-integration/tsconfig.json deleted file mode 100644 index 99281f9cd..000000000 --- a/apps/sdk-nextjs-integration/tsconfig.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "compilerOptions": { - "target": "es2020", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "bundler", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "baseUrl": ".", - "types": ["@testing-library/jest-dom"], - "plugins": [ - { - "name": "next" - } - ], - "paths": { - "@/*": ["./src/*"] - } - }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - "types.d.ts", - ".next/types/**/*.ts", - "jest.config.js" ], - "exclude": ["node_modules"] -} diff --git a/apps/sdk-node-integration/README.md b/apps/sdk-node-integration/README.md deleted file mode 100644 index f86850030..000000000 --- a/apps/sdk-node-integration/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# sdk-node-integration: VeChain Transaction Logger - -The VeChain Transaction Logger is a TypeScript class that provides methods to monitor the transactions of a specific VeChain account and optionally send webhook notifications when new transactions occur. - -## Features - -- Monitors transactions sent to and from a specified VeChain account. -- Automatically filters out transactions that occurred before the latest timestamp. -- Optionally sends webhook notifications with transaction details when new transactions are detected. - -## Usage - -```typescript -// Initialize the VeChainTransactionLogger with VeChain node URL and optional webhook URL -const logger = new VeChainTransactionLogger('YOUR_VET_NODE_URL', 'YOUR_WEBHOOK_URL'); - -// Start monitoring transactions for a specific address -logger.startLogging('YOUR_VET_ACCOUNT_ADDRESS'); - -// Stop monitoring transactions -logger.stopLogging(); -``` -## Configuration - -- `new VeChainTransactionLogger(url: string, webhookUrl?: string)`: Constructor to initialize the logger. Requires the URL of the VeChain node. Optionally accepts the URL of the webhook endpoint. -- `startLogging(address: string)`: Method to start monitoring transactions for the specified VeChain account address. -- `stopLogging()`: Method to stop monitoring transactions. - -Webhook notifications: The logger can send webhook notifications with transaction details if a webhook URL is provided. diff --git a/apps/sdk-node-integration/jest.config.ts b/apps/sdk-node-integration/jest.config.ts deleted file mode 100644 index 000a1ed27..000000000 --- a/apps/sdk-node-integration/jest.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type {Config} from 'jest'; - -const config: Config = { - coverageProvider: "v8", - preset: "ts-jest", -}; - -export default config; diff --git a/apps/sdk-node-integration/package.json b/apps/sdk-node-integration/package.json deleted file mode 100644 index 51f13ebc8..000000000 --- a/apps/sdk-node-integration/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "sdk-node-integration", - "description": "An example app of how to integrate the VeChain SDK with Node.js", - "version": "2.0.0-beta.1", - "private": true, - "main": "dist/index.js", - "types": "src/index.ts", - "license": "MIT", - "author": "VeChain Foundation", - "scripts": { - "build": "rm -rf ./dist && tsup src/index.ts --format cjs,esm --dts", - "start": "yarn build && node dist/index.js", - "test": "jest" - }, - "dependencies": { - "@vechain/sdk-network": "2.0.0-beta.1" - }, - "devDependencies": { - "@jest/globals": "^29.7.0", - "jest": "^29.7.0", - "ts-jest": "^29.2.5", - "ts-node": "^10.9.2", - "typescript": "^5.6.3" - } -} \ No newline at end of file diff --git a/apps/sdk-node-integration/src/index.ts b/apps/sdk-node-integration/src/index.ts deleted file mode 100644 index c48ef729b..000000000 --- a/apps/sdk-node-integration/src/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { VechainTransactionLogger } from './vechain-transaction-logger'; - -// Create a new logger instance -const logger = new VechainTransactionLogger('https://testnet.vechain.org/'); -// Start logging transactions for the specified address -logger.startLogging('0xc3bE339D3D20abc1B731B320959A96A08D479583'); - -// Stop logging after one minute -setTimeout(() => { - logger.stopLogging(); -}, 60000); diff --git a/apps/sdk-node-integration/src/vechain-transaction-logger.ts b/apps/sdk-node-integration/src/vechain-transaction-logger.ts deleted file mode 100644 index f43d5eeeb..000000000 --- a/apps/sdk-node-integration/src/vechain-transaction-logger.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { - ThorClient, - Poll, - type EventPoll, - type FilterTransferLogsOptions, - type TransferLogs -} from '@vechain/sdk-network'; - -/** - * The `VeChainTransactionLogger` class provides methods to monitor the transactions of an account - */ -class VechainTransactionLogger { - private readonly thorClient: ThorClient; - private monitoringPoll?: EventPoll; - private latestTimestamp: number = 0; - private readonly webhookUrl?: string; - - constructor(url: string, webhookUrl?: string) { - this.thorClient = ThorClient.fromUrl(url); - this.webhookUrl = webhookUrl; - } - - /** - * Start monitoring the transactions of an account - * @param address The address to monitor - */ - public startLogging(address: string): TransferLogs[] | void { - this.monitoringPoll = Poll.createEventPoll( - // Get details about the account every time a transaction is made - async () => { - try { - // Get the latest block - const bestBlock = - await this.thorClient.blocks.getBestBlockCompressed(); - // Filter the transactions based on the address - const filterOptions: FilterTransferLogsOptions = { - criteriaSet: [ - { sender: address }, // Transactions sent by the address - { recipient: address } // Transactions received by the address - ], - order: 'desc', // Order logs by descending timestamp - range: { - unit: 'block', - from: bestBlock != null ? bestBlock.number : 0, - to: bestBlock != null ? bestBlock.number + 100 : 100 - } - }; - - // Get the transfer logs - const logs = - await this.thorClient.logs.filterTransferLogs( - filterOptions - ); - - // Filter out transactions that occurred before the latest timestamp - const newLogs = logs.filter( - (log) => log.meta.blockTimestamp > this.latestTimestamp - ); - - // Update the latest timestamp - if (newLogs.length > 0) { - this.latestTimestamp = newLogs[0].meta.blockTimestamp; - - // Notify webhook if URL is provided - if (this.webhookUrl != null) { - await this.notifyWebhook(newLogs); - } - } - - return newLogs; - } catch (error) { - console.error('Error while fetching transfer logs:', error); - throw error; // Propagate the error to stop the polling - } - }, - 1000 - ) - .onStart(() => { - console.log(`Start monitoring account ${address}`); - }) - .onStop(() => { - console.log(`Stop monitoring account ${address}`); - }) - .onData((logs) => { - logs.forEach((log) => { - console.log('Transaction details:', log); - }); - }) - .onError((error) => { - console.log('Error:', error); - }); - - this.monitoringPoll.startListen(); - } - - /** - * Stop monitoring the transactions - */ - public stopLogging(): void { - if (this.monitoringPoll != null) { - this.monitoringPoll.stopListen(); - } - } - - /** - * Send a notification to the webhook - * @param newLogs Logs to be sent to the webhook - */ - private async notifyWebhook(newLogs: TransferLogs[]): Promise { - try { - // Make an HTTP POST request to the webhook URL with the new transaction data - const response = await fetch(this.webhookUrl as string, { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(newLogs) - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - console.log('Webhook notification sent successfully'); - } catch (error) { - console.error('Error sending webhook notification:', error); - } - } -} - -export { VechainTransactionLogger }; diff --git a/apps/sdk-node-integration/tests/vechain-transaction-logger.unit.test.ts b/apps/sdk-node-integration/tests/vechain-transaction-logger.unit.test.ts deleted file mode 100644 index 240c838cf..000000000 --- a/apps/sdk-node-integration/tests/vechain-transaction-logger.unit.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - afterEach, - beforeEach, - describe, - expect, - jest, - test -} from '@jest/globals'; -import { type SpiedFunction } from 'jest-mock'; -import { VechainTransactionLogger } from '../src/vechain-transaction-logger'; - -/** - * VechainTransactionLogger Tests - * - * @group integration/apps/vechain-transaction-logger - */ -describe('VechainTransactionLogger - Tests', () => { - let logSpy: SpiedFunction<{ - (...data: never[]): void; - (message?: never, ...optionalParams: never[]): void; - }>; - - // Mock the console.log function to prevent logging before tests - beforeEach(() => { - logSpy = jest.spyOn(console, 'log'); - logSpy.mockImplementation(() => {}); - }); - - // Restore the console.log function after tests - afterEach(() => { - logSpy.mockRestore(); - }); - - test('Should be able to start and stop a logger instance', (done) => { - // Create a new logger instance - const logger = new VechainTransactionLogger( - 'https://testnet.vechain.org/' - ); - // Start logging transactions for the specified address - logger.startLogging('0xc3bE339D3D20abc1B731B320959A96A08D479583'); - - // Check if the logger has started and stop it - setTimeout(() => { - expect(logSpy).toHaveBeenCalledWith( - 'Start monitoring account 0xc3bE339D3D20abc1B731B320959A96A08D479583' - ); - logger.stopLogging(); - done(); - }, 2000); - }, 6000); -}); diff --git a/apps/sdk-node-integration/tsconfig.json b/apps/sdk-node-integration/tsconfig.json deleted file mode 100644 index c2e0c31ae..000000000 --- a/apps/sdk-node-integration/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - }, - "include": [ - "./src/**/*.ts", - "./tests/**/*.ts", - ] -} \ No newline at end of file diff --git a/apps/sdk-vite-integration/.gitignore b/apps/sdk-vite-integration/.gitignore deleted file mode 100644 index 322211ef3..000000000 --- a/apps/sdk-vite-integration/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? - -# playwright -test-results/ -playwright-report/ diff --git a/apps/sdk-vite-integration/README.md b/apps/sdk-vite-integration/README.md deleted file mode 100644 index 74872fd4a..000000000 --- a/apps/sdk-vite-integration/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: - -- Configure the top-level `parserOptions` property like this: - -```js -export default tseslint.config({ - languageOptions: { - // other options... - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - }, -}) -``` - -- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` -- Optionally add `...tseslint.configs.stylisticTypeChecked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: - -```js -// eslint.config.js -import react from 'eslint-plugin-react' - -export default tseslint.config({ - // Set the react version - settings: { react: { version: '18.3' } }, - plugins: { - // Add the react plugin - react, - }, - rules: { - // other rules... - // Enable its recommended rules - ...react.configs.recommended.rules, - ...react.configs['jsx-runtime'].rules, - }, -}) -``` diff --git a/apps/sdk-vite-integration/e2e/hash.spec.ts b/apps/sdk-vite-integration/e2e/hash.spec.ts deleted file mode 100644 index 42ee1e684..000000000 --- a/apps/sdk-vite-integration/e2e/hash.spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { test, expect } from '@playwright/test'; -import { - Blake2b256, - Keccak256, - Sha256, - Txt -} from '@vechain/sdk-core/dist/index.mjs'; - -test('Hash example', async ({ page }) => { - await page.goto("/"); - - const hashLink = page.getByTestId('hash-link'); - - // Expect link to be visible - await expect(hashLink).toBeVisible(); - - // Click on link - await hashLink.click(); - - // Enter content to hash - const content = "SDK is awesome!"; - const hashInput = page.getByTestId('contentToHash'); - await hashInput.clear(); - await hashInput.fill(content); - - // Expect hash component to be visible with expected text - const blake2bHash = page.getByTestId('blake2b256HashLabel'); - const keccak256Hash = page.getByTestId('keccak256HashLabel'); - const sha256Hash = page.getByTestId('sha256HashLabel'); - await expect(blake2bHash).toBeVisible(); - await expect(keccak256Hash).toBeVisible(); - await expect(sha256Hash).toBeVisible(); - - // Assert hash value for blake2b256 - const expectedBlake2b256Hash = Blake2b256.of(Txt.of(content).bytes) - await expect(blake2bHash).toContainText('Blake2b256'); - await expect(blake2bHash).toContainText(expectedBlake2b256Hash.toString()); - - // Assert hash value for keccak256 - const expectedKeccak256Hash = Keccak256.of(Txt.of(content).bytes) - await expect(keccak256Hash).toContainText('Keccak256'); - await expect(keccak256Hash).toContainText(expectedKeccak256Hash.toString()); - - // Assert hash value for sha256 - const expectedSha256Hash = Sha256.of(Txt.of(content).bytes) - await expect(sha256Hash).toContainText('Sha256'); - await expect(sha256Hash).toContainText(expectedSha256Hash.toString()); -}); \ No newline at end of file diff --git a/apps/sdk-vite-integration/e2e/lastblock.spec.ts b/apps/sdk-vite-integration/e2e/lastblock.spec.ts deleted file mode 100644 index 360ede8cb..000000000 --- a/apps/sdk-vite-integration/e2e/lastblock.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Latest block example', async ({ page }) => { - await page.goto("/"); - - const latestBlockLink = page.getByTestId('latest-block-link'); - - // Expect link to be visible - await expect(latestBlockLink).toBeVisible(); - - // Click on link - await latestBlockLink.click(); - - // Click get last block button - const getLastBlockButton = page.getByTestId('getlastblock'); - await expect(getLastBlockButton).toBeVisible(); - await getLastBlockButton.click(); - - // Assert last block details - const lastBlockDetails = page.getByTestId('last-block-details'); - await expect(lastBlockDetails).toBeVisible(); - await expect(lastBlockDetails).toContainText('number'); - await expect(lastBlockDetails).toContainText('id'); -}); \ No newline at end of file diff --git a/apps/sdk-vite-integration/e2e/logs.spec.ts b/apps/sdk-vite-integration/e2e/logs.spec.ts deleted file mode 100644 index 3a3a21d20..000000000 --- a/apps/sdk-vite-integration/e2e/logs.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Transfer logs example', async ({ page }) => { - await page.goto("/"); - - const logsLink = page.getByTestId('transfers-link'); - - // Expect link to be visible - await expect(logsLink).toBeVisible(); - - // Click on link - await logsLink.click(); - - // Enter details to get transfer logs - const addressInput = page.getByTestId('address'); - const fromBlockInput = page.getByTestId('fromblock'); - const toBlockInput = page.getByTestId('toblock'); - - await addressInput.clear(); - await addressInput.fill('0xc3bE339D3D20abc1B731B320959A96A08D479583'); - await fromBlockInput.clear(); - await fromBlockInput.fill('1'); - await toBlockInput.clear(); - await toBlockInput.fill('19251959'); - - // expect logs table to be populated - const tableRows = page.locator('css=[data-testid="logs-table"] tr'); - await expect(tableRows).toHaveCount(8); // 8 rows in the table, this is a retryable assertion -}); \ No newline at end of file diff --git a/apps/sdk-vite-integration/eslint.config.js b/apps/sdk-vite-integration/eslint.config.js deleted file mode 100644 index 092408a9f..000000000 --- a/apps/sdk-vite-integration/eslint.config.js +++ /dev/null @@ -1,28 +0,0 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' - -export default tseslint.config( - { ignores: ['dist'] }, - { - extends: [js.configs.recommended, ...tseslint.configs.recommended], - files: ['**/*.{ts,tsx}'], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - }, - plugins: { - 'react-hooks': reactHooks, - 'react-refresh': reactRefresh, - }, - rules: { - ...reactHooks.configs.recommended.rules, - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, - }, -) diff --git a/apps/sdk-vite-integration/index.html b/apps/sdk-vite-integration/index.html deleted file mode 100644 index e4b78eae1..000000000 --- a/apps/sdk-vite-integration/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - Vite + React + TS - - -
- - - diff --git a/apps/sdk-vite-integration/package.json b/apps/sdk-vite-integration/package.json deleted file mode 100644 index b8fe03065..000000000 --- a/apps/sdk-vite-integration/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "sdk-vite-integration", - "private": true, - "version": "2.0.0-beta.1", - "type": "module", - "scripts": { - "dev": "vite", - "build": "tsc -b && vite build", - "lint": "eslint .", - "preview": "vite preview", - "test": "vitest", - "test:e2e": "playwright test" - }, - "dependencies": { - "@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" - }, - "devDependencies": { - "@eslint/js": "^9.17.0", - "@playwright/test": "^1.49.0", - "@types/react": "^18.3.11", - "@types/react-dom": "^18.3.1", - "@vitejs/plugin-react": "^4.3.4", - "@vitest/browser": "^2.1.6", - "eslint": "^9.13.0", - "eslint-plugin-react-hooks": "^5.0.0", - "eslint-plugin-react-refresh": "^0.4.16", - "globals": "^15.14.0", - "typescript": "~5.6.2", - "vite": "^6.0.2", - "vitest": "^2.1.6", - "vitest-browser-react": "^0.0.3" - } -} \ No newline at end of file diff --git a/apps/sdk-vite-integration/playwright.config.ts b/apps/sdk-vite-integration/playwright.config.ts deleted file mode 100644 index a53a50ce2..000000000 --- a/apps/sdk-vite-integration/playwright.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -// playwright.config.ts -import { defineConfig, devices } from '@playwright/test'; - -export default defineConfig({ - // Look for test files in the "tests" directory, relative to this configuration file. - testDir: 'e2e', - - // Run all tests in parallel. - fullyParallel: true, - - // Fail the build on CI if you accidentally left test.only in the source code. - forbidOnly: !!process.env.CI, - - // Retry on CI only. - retries: process.env.CI ? 2 : 0, - - // Opt out of parallel tests on CI. - workers: process.env.CI ? 1 : undefined, - - // Reporter to use, see https://playwright.dev/docs/test-reporters - reporter: 'html', - - use: { - // Base URL to use in actions like `await page.goto('/')`. - baseURL: 'http://localhost:5173', - - // Collect trace when retrying the failed test. - trace: 'on-first-retry', - }, - // Configure projects for major browsers. - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], - // Run your local dev server before starting the tests. - webServer: { - command: 'yarn dev', - url: 'http://localhost:5173', - timeout: 120 * 1000, - reuseExistingServer: !process.env.CI, - }, -}); \ No newline at end of file diff --git a/apps/sdk-vite-integration/public/vite.svg b/apps/sdk-vite-integration/public/vite.svg deleted file mode 100644 index e7b8dfb1b..000000000 --- a/apps/sdk-vite-integration/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/sdk-vite-integration/src/App.css b/apps/sdk-vite-integration/src/App.css deleted file mode 100644 index b9d355df2..000000000 --- a/apps/sdk-vite-integration/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/apps/sdk-vite-integration/src/App.tsx b/apps/sdk-vite-integration/src/App.tsx deleted file mode 100644 index 9b11abeea..000000000 --- a/apps/sdk-vite-integration/src/App.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { BrowserRouter as Router, Route, Routes, Link } from 'react-router-dom'; -import reactLogo from './assets/react.svg'; -import viteLogo from '/vite.svg'; -import './App.css'; -import Hash from './components/Hash'; -import TransferLogs from './components/TransferLogs'; -import GetLastBlock from './components/GetLastBlock'; - -function App() { - return ( - -
- -

Welcome to the SDK Vite Integration!

-
-

- @vechain/sdk-core integration example:{' '} - - Hash - -

-

- @vechain/sdk-network integration example:{' '} - - Transfer logs - -

-

- @vechain/sdk-network integration example:{' '} - - Get last block - -

-
-
- - {/* Define Routes */} - - } /> - } /> - } /> - -
- ); -} - -export default App; diff --git a/apps/sdk-vite-integration/src/assets/react.svg b/apps/sdk-vite-integration/src/assets/react.svg deleted file mode 100644 index 6c87de9bb..000000000 --- a/apps/sdk-vite-integration/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/sdk-vite-integration/src/components/GetLastBlock.tsx b/apps/sdk-vite-integration/src/components/GetLastBlock.tsx deleted file mode 100644 index 0f238d33d..000000000 --- a/apps/sdk-vite-integration/src/components/GetLastBlock.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { type CompressedBlockDetail } from "@vechain/sdk-network"; -import { useState } from "react"; -import { thorClient } from "../const"; - -const GetLastBlock = () => { - const [block, setBlock] = useState(null); - - // Function to fetch the last block - const fetchLastBlock = async () => { - try { - const lastBlock = await thorClient.blocks.getBlockCompressed("best"); - setBlock(lastBlock); - } catch (error) { - console.error("Error fetching the last block:", error); - } - }; - - return ( -
- - {block && ( -
-

Last Block Details:

-
{JSON.stringify(block, null, 2)}
-
- )} -
- ); -}; - -export default GetLastBlock; diff --git a/apps/sdk-vite-integration/src/components/Hash.tsx b/apps/sdk-vite-integration/src/components/Hash.tsx deleted file mode 100644 index cd216b37d..000000000 --- a/apps/sdk-vite-integration/src/components/Hash.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { Blake2b256, Keccak256, Sha256, Txt } from '@vechain/sdk-core'; -import { useEffect, useState } from 'react'; -import { HashedContent } from '../types'; - -const Hash = () => { - // State of content to hash - const [contentToHash, setContentToHash] = useState('Hello World!'); - - // State of Hashed content - const [hashedContent, setHashedContent] = useState({ - blake2b256: '', - keccak256: '', - sha256: '' - }); - - /** - * Function to get the history for the provided address - * @param content The address to get the history for - */ - function hashContent(content: string): void { - try { - setHashedContent({ - blake2b256: Blake2b256.of(Txt.of(content).bytes).toString(), - keccak256: Keccak256.of(Txt.of(content).bytes).toString(), - sha256: Sha256.of(Txt.of(content).bytes).toString() - }); - } catch (error) { - setHashedContent({ - blake2b256: - '0xbf56c0728fd4e9cf64bfaf6dabab81554103298cdee5cc4d580433aa25e98b00', - keccak256: - '0x3ea2f1d0abf3fc66cf29eebb70cbd4e7fe762ef8a09bcc06c8edf641230afec0', - sha256: '0x7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069' - }); - console.log(error); - } - } - - // Update hash when the content changes - useEffect(() => { - hashContent(contentToHash); - }, [contentToHash]); - - return ( -
-
-

- Insert some content to hash -

- { - setContentToHash(e.target.value); - }} - value={contentToHash} - className="block mx-auto w-full sm:max-w-md border-2 border-dark focus:border-purple-500 bg-transparent py-2 px-4 text-lg text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 outline-none rounded-md" - placeholder="hello" - /> -
-
-

- Blake2b256: {hashedContent.blake2b256} -

-

- Keccak256: {hashedContent.keccak256} -

-

- Sha256: {hashedContent.sha256} -

-
-
- ); -}; - -export default Hash; diff --git a/apps/sdk-vite-integration/src/components/TransferLogs.tsx b/apps/sdk-vite-integration/src/components/TransferLogs.tsx deleted file mode 100644 index 89df83990..000000000 --- a/apps/sdk-vite-integration/src/components/TransferLogs.tsx +++ /dev/null @@ -1,224 +0,0 @@ -import { useEffect, useState, useCallback } from "react"; -import { Address, FixedPointNumber, Units } from '@vechain/sdk-core'; -import { - FilterTransferLogsOptions -} from '@vechain/sdk-network'; -import { Link } from 'react-router-dom'; -import { Transfer } from "../types"; -import { explorerUrl, thorClient } from "../const"; - -/** - * Reduce the size of a hex string - * - * @param hexString Hex string to reduce - */ -function reduceHexStringSize(hexString: string): string { - // Size to reduce the hex string - const size = 5; - - // Return the reduced hex string - return `${hexString.slice(0, size)}...${hexString.slice(-size)}`; -} - -const TransferLogs = () => { - // State to store the transfer history - const [transfers, setTransfers] = useState([]); - - // State to store the address - const [address, setAddress] = useState( - '0xc3bE339D3D20abc1B731B320959A96A08D479583' - ); - - const [fromBlock, setFromBlock] = useState(1); - const [toBlock, setToBlock] = useState(19251959); - - /** - * Function to get the history for the provided address - * @param address The address to get the history for - */ - const getHistoryFor = useCallback(async (address: string) => { - try { - // Filter options for the transfer logs - const filterOptions: FilterTransferLogsOptions = { - criteriaSet: [ - { sender: address }, // Transactions sent by the address - { recipient: address } // Transactions received by the address - ], - order: 'desc', // Order logs by descending timestamp - range: { - unit: 'block', - from: fromBlock, - to: toBlock - } - }; - - // Get the transfer logs - const logs = await thorClient.logs.filterTransferLogs(filterOptions); - - // Map the logs to the transfer interface - const transfers = logs.map((log) => ({ - from: log.sender, - to: log.recipient, - amount: log.amount, - meta: log.meta - })); - setTransfers(transfers); - } catch (error) { - setTransfers([]); - console.error(error); - } - }, [fromBlock, toBlock]); - - // Update the history when the address changes - useEffect(() => { - if (Address.isValid(address) && fromBlock) { - void getHistoryFor(address); - } - }, [address, fromBlock, toBlock, getHistoryFor]); - - return ( -
-
-

- Insert an address, fromBlock and ToBlock number to get the transfer logs -

-
- - { - setAddress(e.target.value); - }} - value={address} - className="block mx-auto w-full sm:max-w-md border-2 border-dark focus:border-purple-500 bg-transparent py-2 px-4 text-lg text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 outline-none rounded-md" - placeholder="0xc3bE339D3D20abc1B731B320959A96A08D479583" - /> -
-
- - { - setFromBlock(parseInt(e.target.value)); - }} - value={fromBlock} - className="block mx-auto w-full sm:max-w-md border-2 border-dark focus:border-purple-500 bg-transparent py-2 px-4 text-lg text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 outline-none rounded-md" - placeholder="1" - /> -
-
- - { - setToBlock(parseInt(e.target.value)); - }} - value={toBlock} - className="block mx-auto w-full sm:max-w-md border-2 border-dark focus:border-purple-500 bg-transparent py-2 px-4 text-lg text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 outline-none rounded-md" - placeholder="19251959" - /> -
-
-
- - - - - - - - - - - - {transfers.map((transfer, index) => ( - - - - - - - - ))} - -
TimeFromToAmountTransaction Id
-

- {new Date( - transfer.meta.blockTimestamp * 1000 - ).toISOString()} -

-
- -

- {reduceHexStringSize(transfer.from)} -

- -
- - {reduceHexStringSize(transfer.to)} - - -

- {Units.formatEther( - FixedPointNumber.of(transfer.amount) - )} -

-
- - {reduceHexStringSize( - transfer.meta.txID - )} - -
-
-
- ); -} - -export default TransferLogs; diff --git a/apps/sdk-vite-integration/src/const/const.tsx b/apps/sdk-vite-integration/src/const/const.tsx deleted file mode 100644 index dcb4adb5b..000000000 --- a/apps/sdk-vite-integration/src/const/const.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { ThorClient } from '@vechain/sdk-network'; - -/** - * Thor client instance, using mainnet URL - */ -const thorClient = ThorClient.at('https://mainnet.vechain.org'); - -/** - * Explorer url - */ -const explorerUrl = 'https://explore.vechain.org'; - -export { thorClient, explorerUrl }; diff --git a/apps/sdk-vite-integration/src/const/index.tsx b/apps/sdk-vite-integration/src/const/index.tsx deleted file mode 100644 index f56fb0c46..000000000 --- a/apps/sdk-vite-integration/src/const/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line react-refresh/only-export-components -export * from './const'; diff --git a/apps/sdk-vite-integration/src/index.css b/apps/sdk-vite-integration/src/index.css deleted file mode 100644 index 6119ad9a8..000000000 --- a/apps/sdk-vite-integration/src/index.css +++ /dev/null @@ -1,68 +0,0 @@ -:root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} diff --git a/apps/sdk-vite-integration/src/main.tsx b/apps/sdk-vite-integration/src/main.tsx deleted file mode 100644 index db032b748..000000000 --- a/apps/sdk-vite-integration/src/main.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import './index.css' -import App from './App' - -createRoot(document.getElementById('root')!).render( - - - , -) diff --git a/apps/sdk-vite-integration/src/types/index.tsx b/apps/sdk-vite-integration/src/types/index.tsx deleted file mode 100644 index 8b2ee98ba..000000000 --- a/apps/sdk-vite-integration/src/types/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export type * from './types.d'; diff --git a/apps/sdk-vite-integration/src/types/types.d.tsx b/apps/sdk-vite-integration/src/types/types.d.tsx deleted file mode 100644 index fc2c16b58..000000000 --- a/apps/sdk-vite-integration/src/types/types.d.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Transfer interface definition. - * It is used to represent an element - * of the transfer history - */ -interface Transfer { - from: string; - to: string; - amount: string; - meta: { - blockID: string; // Block identifier associated with the entity - blockNumber: number; // Block number associated with the entity - blockTimestamp: number; // Timestamp of the block - txID: string; // Transaction ID associated with the entity - txOrigin: string; // Transaction origin information - clauseIndex: number; // Index of the clause - }; -} - -/** - * Hashed content example type. - */ -interface HashedContent { - blake2b256: string; - keccak256: string; - sha256: string; -} - -export { type Transfer, type HashedContent }; diff --git a/apps/sdk-vite-integration/src/vite-env.d.ts b/apps/sdk-vite-integration/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a..000000000 --- a/apps/sdk-vite-integration/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/apps/sdk-vite-integration/tests/Hash.spec.tsx b/apps/sdk-vite-integration/tests/Hash.spec.tsx deleted file mode 100644 index 01b1f6864..000000000 --- a/apps/sdk-vite-integration/tests/Hash.spec.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { expect, test } from 'vitest' -import { render } from 'vitest-browser-react' -import Hash from '../src/components/Hash' - -test('renders name', async () => { - const { getByText } = render() - - await expect.element(getByText('0xbf56c0728fd4e9cf64bfaf6dabab81554103298cdee5cc4d580433aa25e98b00')).toBeInTheDocument() -}) \ No newline at end of file diff --git a/apps/sdk-vite-integration/tsconfig.app.json b/apps/sdk-vite-integration/tsconfig.app.json deleted file mode 100644 index 5a2def4b7..000000000 --- a/apps/sdk-vite-integration/tsconfig.app.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "module": "ESNext", - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "Bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - "jsx": "react-jsx", - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": ["src"] -} diff --git a/apps/sdk-vite-integration/tsconfig.app.tsbuildinfo b/apps/sdk-vite-integration/tsconfig.app.tsbuildinfo deleted file mode 100644 index 7af553b52..000000000 --- a/apps/sdk-vite-integration/tsconfig.app.tsbuildinfo +++ /dev/null @@ -1 +0,0 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/getlastblock.tsx","./src/components/hash.tsx","./src/components/transferlogs.tsx","./src/const/const.tsx","./src/const/index.tsx","./src/types/index.tsx","./src/types/types.d.tsx"],"version":"5.6.3"} \ No newline at end of file diff --git a/apps/sdk-vite-integration/tsconfig.json b/apps/sdk-vite-integration/tsconfig.json deleted file mode 100644 index a1c490262..000000000 --- a/apps/sdk-vite-integration/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "lib": ["esnext", "dom"], - "module": "ESNext", - "moduleResolution": "Bundler", - "jsx": "react-jsx", - "types": ["@vitest/browser/providers/playwright"], - "strict": true, - "declaration": true, - "noEmit": true, - "esModuleInterop": true, - "skipLibCheck": true - } -} \ No newline at end of file diff --git a/apps/sdk-vite-integration/tsconfig.node.json b/apps/sdk-vite-integration/tsconfig.node.json deleted file mode 100644 index 9dad70185..000000000 --- a/apps/sdk-vite-integration/tsconfig.node.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "lib": ["ES2023"], - "module": "ESNext", - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "Bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": ["vite.config.ts"] -} diff --git a/apps/sdk-vite-integration/tsconfig.node.tsbuildinfo b/apps/sdk-vite-integration/tsconfig.node.tsbuildinfo deleted file mode 100644 index 75ea0011d..000000000 --- a/apps/sdk-vite-integration/tsconfig.node.tsbuildinfo +++ /dev/null @@ -1 +0,0 @@ -{"root":["./vite.config.ts"],"version":"5.6.3"} \ No newline at end of file diff --git a/apps/sdk-vite-integration/tsconfig.tsbuildinfo b/apps/sdk-vite-integration/tsconfig.tsbuildinfo deleted file mode 100644 index 18f076386..000000000 --- a/apps/sdk-vite-integration/tsconfig.tsbuildinfo +++ /dev/null @@ -1 +0,0 @@ -{"root":["./playwright.config.ts","./vite.config.ts","./vitest.workspace.ts","./e2e/hash.spec.ts","./e2e/lastblock.spec.ts","./e2e/logs.spec.ts","./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/getlastblock.tsx","./src/components/hash.tsx","./src/components/transferlogs.tsx","./src/const/const.tsx","./src/const/index.tsx","./src/types/index.tsx","./src/types/types.d.tsx","./tests/hash.spec.tsx"],"version":"5.6.3"} \ No newline at end of file diff --git a/apps/sdk-vite-integration/vite.config.ts b/apps/sdk-vite-integration/vite.config.ts deleted file mode 100644 index a231402ed..000000000 --- a/apps/sdk-vite-integration/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' - -// https://vite.dev/config/ -export default defineConfig({ - plugins: [react()] -}) diff --git a/apps/sdk-vite-integration/vitest.workspace.ts b/apps/sdk-vite-integration/vitest.workspace.ts deleted file mode 100644 index 89cb10c9e..000000000 --- a/apps/sdk-vite-integration/vitest.workspace.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineWorkspace, ViteUserConfig } from 'vitest/config'; -import react from '@vitejs/plugin-react' - -export default defineWorkspace([ - 'packages/*', - { - plugins: [react()] as ViteUserConfig["plugins"], - test: { - browser: { - enabled: true, - name: 'chromium', - provider: 'playwright' - }, - name: 'node-env', - environment: 'node', - include: ['tests/*.spec.tsx'], - exclude: ['e2e/*.spec.ts'], - }, - }, - { - plugins: [react()] as ViteUserConfig["plugins"], - test: { - browser: { - enabled: true, - name: 'chromium', - provider: 'playwright', - }, - name: 'jsdom-env', - environment: 'jsdom', - include: ['tests/*.spec.tsx'], - exclude: ['e2e/*.spec.ts'], - }, - } -]) \ No newline at end of file diff --git a/package.json b/package.json index 16ba570c1..170a2c81f 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,7 @@ "private": true, "workspaces": [ "packages/*", - "docs", - "apps/*" + "docs" ], "packageManager": "yarn@1.22.22", "scripts": { @@ -93,4 +92,4 @@ "undici": "^5.28.5" }, "version": "1.22.22" -} \ No newline at end of file +} diff --git a/packages/hardhat-plugin/README.md b/packages/hardhat-plugin/README.md index 40b9285a8..cfbbaef6b 100644 --- a/packages/hardhat-plugin/README.md +++ b/packages/hardhat-plugin/README.md @@ -73,8 +73,3 @@ const config: HardhatUserConfig = { } }; ``` - -## Example - -For a comprehensive example of using the Hardhat plugin with the VeChain SDK, visit [`apps/sdk-hardhat-integration`](https://github.com/vechain/vechain-sdk-js/tree/main/apps/sdk-hardhat-integration). This directory contains a fully configured example that demonstrates how to integrate the VeChain SDK with Hardhat, providing a practical setup you can follow and replicate in your projects. - diff --git a/scripts/pre-release.ts b/scripts/pre-release.ts index 715910a2f..0d0129d1a 100644 --- a/scripts/pre-release.ts +++ b/scripts/pre-release.ts @@ -53,31 +53,6 @@ const updatePackageVersions = (version: string): void => { } fs.writeFileSync(docsJsonPath, JSON.stringify(docsJson, null, 2)); - - // Update versions on sample apps - const appsPath = path.resolve(__dirname, '../apps'); - const appPackages = fs.readdirSync(appsPath); - - for (const app of appPackages) { - const appPath = path.resolve(appsPath, app); - const appPackageJsonPath = path.resolve(appPath, './package.json'); - const appPackageJson = JSON.parse( - fs.readFileSync(appPackageJsonPath, 'utf8') - ); - appPackageJson.version = version; - fs.writeFileSync(appPackageJsonPath, JSON.stringify(appPackageJson, null, 2)); - - for (const dep of Object.keys(appPackageJson.dependencies)) { - if (packageNames.includes(dep)) { - appPackageJson.dependencies[dep] = version; - } - } - - fs.writeFileSync( - appPackageJsonPath, - JSON.stringify(appPackageJson, null, 2) - ); - } }; const preparePackages = async () => { @@ -112,7 +87,9 @@ const preparePackages = async () => { console.log('\n______________________________________________________\n\n'); console.log(' Publish:'); - console.log(`\t- Run 'yarn changeset publish' to publish the packages, then release also on GitHub.`); + console.log( + `\t- Run 'yarn changeset publish' to publish the packages, then release also on GitHub.` + ); console.log('\n______________________________________________________\n\n'); }; diff --git a/yarn.lock b/yarn.lock index 008bf1a3b..80f984190 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,11 +2,6 @@ # yarn lockfile v1 -"@adobe/css-tools@^4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.4.0.tgz#728c484f4e10df03d5a3acd0d8adcbbebff8ad63" - integrity sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ== - "@adraffy/ens-normalize@1.10.1": version "1.10.1" resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" @@ -17,11 +12,6 @@ resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz#42cc67c5baa407ac25059fcd7d405cc5ecdb0c33" integrity sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg== -"@alloc/quick-lru@^5.2.0": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@alloc/quick-lru/-/quick-lru-5.2.0.tgz#7bf68b20c0a350f936915fcae06f58e32007ce30" - integrity sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw== - "@ampproject/remapping@^2.2.0": version "2.3.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" @@ -478,7 +468,7 @@ "@smithy/types" "^4.0.0" tslib "^2.6.2" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.25.7": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.25.7": version "7.25.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.25.7.tgz#438f2c524071531d643c6f0188e1e28f130cebc7" integrity sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g== @@ -526,7 +516,7 @@ json5 "^2.2.3" semver "^6.3.1" -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9", "@babel/core@^7.26.0": +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": version "7.26.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.0.tgz#d78b6023cc8f3114ccf049eb219613f74a747b40" integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg== @@ -1325,20 +1315,6 @@ dependencies: "@babel/plugin-transform-react-jsx" "^7.25.9" -"@babel/plugin-transform-react-jsx-self@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.25.9.tgz#c0b6cae9c1b73967f7f9eb2fca9536ba2fad2858" - integrity sha512-y8quW6p0WHkEhmErnfe58r7x0A70uKphQm8Sp8cV7tjNQwK56sNVK0M73LK3WuYmsuyrftut4xAkjjgU0twaMg== - dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - -"@babel/plugin-transform-react-jsx-source@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.25.9.tgz#4c6b8daa520b5f155b5fb55547d7c9fa91417503" - integrity sha512-+iqjT8xmXhhYv4/uiYd8FNQsraMFZIfxVSqxxVSZP0WbbSAWvBXAul0m/zu+7Vv4O/3WtApy9pmaTMiumEZgfg== - dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/plugin-transform-react-jsx@^7.23.4", "@babel/plugin-transform-react-jsx@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.25.9.tgz#06367940d8325b36edff5e2b9cbe782947ca4166" @@ -1556,7 +1532,7 @@ "@babel/plugin-transform-react-jsx-development" "^7.22.5" "@babel/plugin-transform-react-pure-annotations" "^7.24.1" -"@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4": version "7.26.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1" integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw== @@ -1621,28 +1597,6 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bundled-es-modules/cookie@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@bundled-es-modules/cookie/-/cookie-2.0.1.tgz#b41376af6a06b3e32a15241d927b840a9b4de507" - integrity sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw== - dependencies: - cookie "^0.7.2" - -"@bundled-es-modules/statuses@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@bundled-es-modules/statuses/-/statuses-1.0.1.tgz#761d10f44e51a94902c4da48675b71a76cc98872" - integrity sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg== - dependencies: - statuses "^2.0.1" - -"@bundled-es-modules/tough-cookie@^0.1.6": - version "0.1.6" - resolved "https://registry.yarnpkg.com/@bundled-es-modules/tough-cookie/-/tough-cookie-0.1.6.tgz#fa9cd3cedfeecd6783e8b0d378b4a99e52bde5d3" - integrity sha512-dvMHbL464C0zI+Yqxbz6kZ5TOEp7GLW+pry/RWndAR8MJQAXZ2rPmIs8tziTZjeIyhSNZgZbCePtfSbdWqStJw== - dependencies: - "@types/tough-cookie" "^4.0.5" - tough-cookie "^4.1.4" - "@changesets/apply-release-plan@^7.0.5": version "7.0.5" resolved "https://registry.yarnpkg.com/@changesets/apply-release-plan/-/apply-release-plan-7.0.5.tgz#3323c97afc08abc15e5136488f9c7cf1a864832e" @@ -1839,65 +1793,6 @@ human-id "^1.0.2" prettier "^2.7.1" -"@cloudflare/kv-asset-handler@0.3.4": - version "0.3.4" - resolved "https://registry.yarnpkg.com/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.4.tgz#5cc152847c8ae4d280ec5d7f4f6ba8c976b585c3" - integrity sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q== - dependencies: - mime "^3.0.0" - -"@cloudflare/vitest-pool-workers@^0.5.33": - version "0.5.33" - resolved "https://registry.yarnpkg.com/@cloudflare/vitest-pool-workers/-/vitest-pool-workers-0.5.33.tgz#2eacf1a0d5274c346d1f536edac0e89a2e2d8dcb" - integrity sha512-gsMArZ7fN9WB8blVIK8kVPXV8zI7JuoQN6n4grBYMmJgqfLrWE5N8NnEz0O5qagyLQJvD9TxD16WZOzVT/fbzw== - dependencies: - birpc "0.2.14" - cjs-module-lexer "^1.2.3" - devalue "^4.3.0" - esbuild "0.17.19" - miniflare "3.20241106.2" - semver "^7.5.1" - wrangler "3.92.0" - zod "^3.22.3" - -"@cloudflare/workerd-darwin-64@1.20241106.2": - version "1.20241106.2" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241106.2.tgz#77bc6ca1887eb6f2e632d4dbad12db8728b88543" - integrity sha512-p3PzgiMBp9xKo4dMINM1RkrC+miUtz65IuuMCEdCa5QZTM0eyEGcBj1A9/lmS3wW72oMfRTo6CxCkqPteFJeBA== - -"@cloudflare/workerd-darwin-arm64@1.20241106.2": - version "1.20241106.2" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241106.2.tgz#5cdf5be61de2d3884e5551faaea61846ef64c7d8" - integrity sha512-AZQTAKG6bP9z0SKSXQGlXR2K2MQnDMtKC78NGjN0NOcjALTsFlLFhczaLvmuJjsT16k9yJUq2Gl+NG4ao/qgvg== - -"@cloudflare/workerd-linux-64@1.20241106.2": - version "1.20241106.2" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241106.2.tgz#fecb55ca15d600048ba6fcb4092c77acc52a36d0" - integrity sha512-TWIcVdUzU7w7YP2OEIgTDtNl9jyzjxOptjRDw7jhSUsQy/02IjBLP+ZnNpgB5CUJ1tCbcOp1L2IGhZmayd7OEQ== - -"@cloudflare/workerd-linux-arm64@1.20241106.2": - version "1.20241106.2" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241106.2.tgz#2fcea56d2329485e050b84fe7bbd621d8da0275e" - integrity sha512-f5Mn9IzfLs9yGjB2UCcKh+I7Ahiw6xqiQ9f/FGsHjsgLELjJ8JCKBwXmc9WdfNmVPae5jNCg2N5qVfDoWBKbCA== - -"@cloudflare/workerd-windows-64@1.20241106.2": - version "1.20241106.2" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241106.2.tgz#f757009c886cbb58ed45be0585fabcd92c5451e9" - integrity sha512-kdLExN3rktax23iHUKP7AHQP0HT0yGHik58fMP4kExjsMnwxw92TLI3n4HlmEqsbtMtwr9rhTJVaMBRUXq0aXw== - -"@cloudflare/workers-shared@0.9.1": - version "0.9.1" - resolved "https://registry.yarnpkg.com/@cloudflare/workers-shared/-/workers-shared-0.9.1.tgz#29117db96d1b2e8557b6bf6c075b12e8b9c8c6bc" - integrity sha512-56w4pL5D6ODw7+SieMgdwrwNyyT7tY8H4UPD4/95TSBVjqDcMPq0Dr+D4rJ+nHK+290o4ZnSiOOiKqRMqy6tPg== - dependencies: - mime "^3.0.0" - zod "^3.22.3" - -"@cloudflare/workers-types@^4.20241230.0": - version "4.20241230.0" - resolved "https://registry.yarnpkg.com/@cloudflare/workers-types/-/workers-types-4.20241230.0.tgz#75b40be5509fdb6568decf4bca71dd82f1e6fc38" - integrity sha512-dtLD4jY35Lb750cCVyO1i/eIfdZJg2Z0i+B1RYX6BVeRPlgaHx/H18ImKAkYmy0g09Ow8R2jZy3hIxMgXun0WQ== - "@commitlint/cli@^19.6.1": version "19.6.1" resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-19.6.1.tgz#24edd26595d911cc6b680cdfbb1fb083bfd5f73d" @@ -2053,293 +1948,98 @@ "@types/conventional-commits-parser" "^5.0.0" chalk "^5.3.0" -"@cspotcode/source-map-support@0.8.1", "@cspotcode/source-map-support@^0.8.0": +"@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@emnapi/runtime@^1.2.0": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.3.1.tgz#0fcaa575afc31f455fd33534c19381cfce6c6f60" - integrity sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw== - dependencies: - tslib "^2.4.0" - -"@esbuild-plugins/node-globals-polyfill@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz#0e4497a2b53c9e9485e149bc92ddb228438d6bcf" - integrity sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw== - -"@esbuild-plugins/node-modules-polyfill@^0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz#cefa3dc0bd1c16277a8338b52833420c94987327" - integrity sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA== - dependencies: - escape-string-regexp "^4.0.0" - rollup-plugin-node-polyfills "^0.2.1" - -"@esbuild/aix-ppc64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f" - integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ== - "@esbuild/aix-ppc64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz#b57697945b50e99007b4c2521507dc613d4a648c" integrity sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw== -"@esbuild/android-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" - integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== - -"@esbuild/android-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz#09d9b4357780da9ea3a7dfb833a1f1ff439b4052" - integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A== - "@esbuild/android-arm64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz#1add7e0af67acefd556e407f8497e81fddad79c0" integrity sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w== -"@esbuild/android-arm@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" - integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== - -"@esbuild/android-arm@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz#9b04384fb771926dfa6d7ad04324ecb2ab9b2e28" - integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg== - "@esbuild/android-arm@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.24.0.tgz#ab7263045fa8e090833a8e3c393b60d59a789810" integrity sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew== -"@esbuild/android-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" - integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== - -"@esbuild/android-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz#29918ec2db754cedcb6c1b04de8cd6547af6461e" - integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA== - "@esbuild/android-x64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.24.0.tgz#e8f8b196cfdfdd5aeaebbdb0110983460440e705" integrity sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ== -"@esbuild/darwin-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276" - integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== - -"@esbuild/darwin-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz#e495b539660e51690f3928af50a76fb0a6ccff2a" - integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== - "@esbuild/darwin-arm64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz#2d0d9414f2acbffd2d86e98253914fca603a53dd" integrity sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw== -"@esbuild/darwin-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" - integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== - -"@esbuild/darwin-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz#c13838fa57372839abdddc91d71542ceea2e1e22" - integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw== - "@esbuild/darwin-x64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz#33087aab31a1eb64c89daf3d2cf8ce1775656107" integrity sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA== -"@esbuild/freebsd-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" - integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== - -"@esbuild/freebsd-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz#646b989aa20bf89fd071dd5dbfad69a3542e550e" - integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g== - "@esbuild/freebsd-arm64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz#bb76e5ea9e97fa3c753472f19421075d3a33e8a7" integrity sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA== -"@esbuild/freebsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" - integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== - -"@esbuild/freebsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz#aa615cfc80af954d3458906e38ca22c18cf5c261" - integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ== - "@esbuild/freebsd-x64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz#e0e2ce9249fdf6ee29e5dc3d420c7007fa579b93" integrity sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ== -"@esbuild/linux-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" - integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== - -"@esbuild/linux-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz#70ac6fa14f5cb7e1f7f887bcffb680ad09922b5b" - integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q== - "@esbuild/linux-arm64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz#d1b2aa58085f73ecf45533c07c82d81235388e75" integrity sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g== -"@esbuild/linux-arm@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" - integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== - -"@esbuild/linux-arm@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz#fc6fd11a8aca56c1f6f3894f2bea0479f8f626b9" - integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA== - "@esbuild/linux-arm@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz#8e4915df8ea3e12b690a057e77a47b1d5935ef6d" integrity sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw== -"@esbuild/linux-ia32@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" - integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== - -"@esbuild/linux-ia32@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz#3271f53b3f93e3d093d518d1649d6d68d346ede2" - integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg== - "@esbuild/linux-ia32@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz#8200b1110666c39ab316572324b7af63d82013fb" integrity sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA== -"@esbuild/linux-loong64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" - integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== - -"@esbuild/linux-loong64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz#ed62e04238c57026aea831c5a130b73c0f9f26df" - integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg== - "@esbuild/linux-loong64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz#6ff0c99cf647504df321d0640f0d32e557da745c" integrity sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g== -"@esbuild/linux-mips64el@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" - integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== - -"@esbuild/linux-mips64el@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz#e79b8eb48bf3b106fadec1ac8240fb97b4e64cbe" - integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg== - "@esbuild/linux-mips64el@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz#3f720ccd4d59bfeb4c2ce276a46b77ad380fa1f3" integrity sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA== -"@esbuild/linux-ppc64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" - integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== - -"@esbuild/linux-ppc64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz#5f2203860a143b9919d383ef7573521fb154c3e4" - integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w== - "@esbuild/linux-ppc64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz#9d6b188b15c25afd2e213474bf5f31e42e3aa09e" integrity sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ== -"@esbuild/linux-riscv64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" - integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== - -"@esbuild/linux-riscv64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz#07bcafd99322d5af62f618cb9e6a9b7f4bb825dc" - integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA== - "@esbuild/linux-riscv64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz#f989fdc9752dfda286c9cd87c46248e4dfecbc25" integrity sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw== -"@esbuild/linux-s390x@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" - integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== - -"@esbuild/linux-s390x@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz#b7ccf686751d6a3e44b8627ababc8be3ef62d8de" - integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A== - "@esbuild/linux-s390x@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz#29ebf87e4132ea659c1489fce63cd8509d1c7319" integrity sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g== -"@esbuild/linux-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" - integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== - -"@esbuild/linux-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz#6d8f0c768e070e64309af8004bb94e68ab2bb3b0" - integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== - "@esbuild/linux-x64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz#4af48c5c0479569b1f359ffbce22d15f261c0cef" integrity sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA== -"@esbuild/netbsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" - integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== - -"@esbuild/netbsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz#bbe430f60d378ecb88decb219c602667387a6047" - integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg== - "@esbuild/netbsd-x64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz#1ae73d23cc044a0ebd4f198334416fb26c31366c" @@ -2350,76 +2050,26 @@ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz#5d904a4f5158c89859fd902c427f96d6a9e632e2" integrity sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg== -"@esbuild/openbsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" - integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== - -"@esbuild/openbsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz#99d1cf2937279560d2104821f5ccce220cb2af70" - integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow== - "@esbuild/openbsd-x64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz#4c8aa88c49187c601bae2971e71c6dc5e0ad1cdf" integrity sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q== -"@esbuild/sunos-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" - integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== - -"@esbuild/sunos-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz#08741512c10d529566baba837b4fe052c8f3487b" - integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg== - "@esbuild/sunos-x64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz#8ddc35a0ea38575fa44eda30a5ee01ae2fa54dd4" integrity sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA== -"@esbuild/win32-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" - integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== - -"@esbuild/win32-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz#675b7385398411240735016144ab2e99a60fc75d" - integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A== - "@esbuild/win32-arm64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz#6e79c8543f282c4539db684a207ae0e174a9007b" integrity sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA== -"@esbuild/win32-ia32@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" - integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== - -"@esbuild/win32-ia32@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz#1bfc3ce98aa6ca9a0969e4d2af72144c59c1193b" - integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA== - "@esbuild/win32-ia32@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz#057af345da256b7192d18b676a02e95d0fa39103" integrity sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw== -"@esbuild/win32-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" - integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== - -"@esbuild/win32-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" - integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== - "@esbuild/win32-x64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz#168ab1c7e1c318b922637fad8f339d48b01e1244" @@ -2483,11 +2133,6 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.13.0": - version "9.13.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.13.0.tgz#c5f89bcd57eb54d5d4fa8b77693e9c28dc97e547" - integrity sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA== - "@eslint/js@9.14.0": version "9.14.0" resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.14.0.tgz#2347a871042ebd11a00fd8c2d3d56a265ee6857e" @@ -2510,26 +2155,12 @@ dependencies: levn "^0.4.1" -"@ethereumjs/rlp@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.1.tgz#626fabfd9081baab3d0a3074b0c7ecaf674aaa41" - integrity sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw== - "@ethereumjs/rlp@^5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-5.0.2.tgz#c89bd82f2f3bec248ab2d517ae25f5bbc4aac842" integrity sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA== -"@ethereumjs/util@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.1.0.tgz#299df97fb6b034e0577ce9f94c7d9d1004409ed4" - integrity sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA== - dependencies: - "@ethereumjs/rlp" "^4.0.1" - ethereum-cryptography "^2.0.0" - micro-ftch "^0.3.1" - -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.9", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@^5.1.2": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -2544,7 +2175,7 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" -"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": +"@ethersproject/abstract-provider@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== @@ -2557,7 +2188,7 @@ "@ethersproject/transactions" "^5.7.0" "@ethersproject/web" "^5.7.0" -"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": +"@ethersproject/abstract-signer@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== @@ -2568,7 +2199,7 @@ "@ethersproject/logger" "^5.7.0" "@ethersproject/properties" "^5.7.0" -"@ethersproject/address@5.7.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.7.0": +"@ethersproject/address@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== @@ -2579,22 +2210,14 @@ "@ethersproject/logger" "^5.7.0" "@ethersproject/rlp" "^5.7.0" -"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": +"@ethersproject/base64@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== dependencies: "@ethersproject/bytes" "^5.7.0" -"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" - integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - -"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": +"@ethersproject/bignumber@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== @@ -2603,37 +2226,21 @@ "@ethersproject/logger" "^5.7.0" bn.js "^5.2.1" -"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": +"@ethersproject/bytes@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== dependencies: "@ethersproject/logger" "^5.7.0" -"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": +"@ethersproject/constants@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== dependencies: "@ethersproject/bignumber" "^5.7.0" -"@ethersproject/contracts@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" - integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - -"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.7.0": +"@ethersproject/hash@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== @@ -2648,44 +2255,7 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" -"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" - integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/basex" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/pbkdf2" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/wordlists" "^5.7.0" - -"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" - integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== - dependencies: - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hdnode" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/pbkdf2" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": +"@ethersproject/keccak256@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== @@ -2693,68 +2263,26 @@ "@ethersproject/bytes" "^5.7.0" js-sha3 "0.8.0" -"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": +"@ethersproject/logger@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== -"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": +"@ethersproject/networks@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== dependencies: "@ethersproject/logger" "^5.7.0" -"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" - integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - -"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": +"@ethersproject/properties@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== dependencies: "@ethersproject/logger" "^5.7.0" -"@ethersproject/providers@5.7.2": - version "5.7.2" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" - integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/base64" "^5.7.0" - "@ethersproject/basex" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/networks" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/web" "^5.7.0" - bech32 "1.1.4" - ws "7.4.6" - -"@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" - integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": +"@ethersproject/rlp@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== @@ -2762,16 +2290,7 @@ "@ethersproject/bytes" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" - integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": +"@ethersproject/signing-key@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== @@ -2783,19 +2302,7 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/solidity@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" - integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/sha2" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": +"@ethersproject/strings@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== @@ -2804,7 +2311,7 @@ "@ethersproject/constants" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": +"@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== @@ -2819,37 +2326,7 @@ "@ethersproject/rlp" "^5.7.0" "@ethersproject/signing-key" "^5.7.0" -"@ethersproject/units@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" - integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/wallet@5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" - integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/abstract-signer" "^5.7.0" - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/hdnode" "^5.7.0" - "@ethersproject/json-wallets" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/random" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/wordlists" "^5.7.0" - -"@ethersproject/web@5.7.1", "@ethersproject/web@^5.7.0": +"@ethersproject/web@^5.7.0": version "5.7.1" resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== @@ -2860,40 +2337,16 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" -"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" - integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/hash" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - "@fastify/busboy@^2.0.0": version "2.1.1" resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA== -"@humanfs/core@^0.19.0": - version "0.19.0" - resolved "https://registry.yarnpkg.com/@humanfs/core/-/core-0.19.0.tgz#08db7a8c73bb07673d9ebd925f2dad746411fcec" - integrity sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw== - "@humanfs/core@^0.19.1": version "0.19.1" resolved "https://registry.yarnpkg.com/@humanfs/core/-/core-0.19.1.tgz#17c55ca7d426733fe3c561906b8173c336b40a77" integrity sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA== -"@humanfs/node@^0.16.5": - version "0.16.5" - resolved "https://registry.yarnpkg.com/@humanfs/node/-/node-0.16.5.tgz#a9febb7e7ad2aff65890fdc630938f8d20aa84ba" - integrity sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg== - dependencies: - "@humanfs/core" "^0.19.0" - "@humanwhocodes/retry" "^0.3.0" - "@humanfs/node@^0.16.6": version "0.16.6" resolved "https://registry.yarnpkg.com/@humanfs/node/-/node-0.16.6.tgz#ee2a10eaabd1131987bf0488fd9b820174cd765e" @@ -2907,7 +2360,7 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/retry@^0.3.0", "@humanwhocodes/retry@^0.3.1": +"@humanwhocodes/retry@^0.3.0": version "0.3.1" resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.3.1.tgz#c72a5c76a9fbaf3488e231b13dc52c0da7bab42a" integrity sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA== @@ -2917,152 +2370,6 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.4.1.tgz#9a96ce501bc62df46c4031fbd970e3cc6b10f07b" integrity sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA== -"@img/sharp-darwin-arm64@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz#ef5b5a07862805f1e8145a377c8ba6e98813ca08" - integrity sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ== - optionalDependencies: - "@img/sharp-libvips-darwin-arm64" "1.0.4" - -"@img/sharp-darwin-x64@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz#e03d3451cd9e664faa72948cc70a403ea4063d61" - integrity sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q== - optionalDependencies: - "@img/sharp-libvips-darwin-x64" "1.0.4" - -"@img/sharp-libvips-darwin-arm64@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz#447c5026700c01a993c7804eb8af5f6e9868c07f" - integrity sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg== - -"@img/sharp-libvips-darwin-x64@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz#e0456f8f7c623f9dbfbdc77383caa72281d86062" - integrity sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ== - -"@img/sharp-libvips-linux-arm64@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz#979b1c66c9a91f7ff2893556ef267f90ebe51704" - integrity sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA== - -"@img/sharp-libvips-linux-arm@1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz#99f922d4e15216ec205dcb6891b721bfd2884197" - integrity sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g== - -"@img/sharp-libvips-linux-s390x@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz#f8a5eb1f374a082f72b3f45e2fb25b8118a8a5ce" - integrity sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA== - -"@img/sharp-libvips-linux-x64@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz#d4c4619cdd157774906e15770ee119931c7ef5e0" - integrity sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw== - -"@img/sharp-libvips-linuxmusl-arm64@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz#166778da0f48dd2bded1fa3033cee6b588f0d5d5" - integrity sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA== - -"@img/sharp-libvips-linuxmusl-x64@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz#93794e4d7720b077fcad3e02982f2f1c246751ff" - integrity sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw== - -"@img/sharp-linux-arm64@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz#edb0697e7a8279c9fc829a60fc35644c4839bb22" - integrity sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA== - optionalDependencies: - "@img/sharp-libvips-linux-arm64" "1.0.4" - -"@img/sharp-linux-arm@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz#422c1a352e7b5832842577dc51602bcd5b6f5eff" - integrity sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ== - optionalDependencies: - "@img/sharp-libvips-linux-arm" "1.0.5" - -"@img/sharp-linux-s390x@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz#f5c077926b48e97e4a04d004dfaf175972059667" - integrity sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q== - optionalDependencies: - "@img/sharp-libvips-linux-s390x" "1.0.4" - -"@img/sharp-linux-x64@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz#d806e0afd71ae6775cc87f0da8f2d03a7c2209cb" - integrity sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA== - optionalDependencies: - "@img/sharp-libvips-linux-x64" "1.0.4" - -"@img/sharp-linuxmusl-arm64@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz#252975b915894fb315af5deea174651e208d3d6b" - integrity sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g== - optionalDependencies: - "@img/sharp-libvips-linuxmusl-arm64" "1.0.4" - -"@img/sharp-linuxmusl-x64@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz#3f4609ac5d8ef8ec7dadee80b560961a60fd4f48" - integrity sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw== - optionalDependencies: - "@img/sharp-libvips-linuxmusl-x64" "1.0.4" - -"@img/sharp-wasm32@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz#6f44f3283069d935bb5ca5813153572f3e6f61a1" - integrity sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg== - dependencies: - "@emnapi/runtime" "^1.2.0" - -"@img/sharp-win32-ia32@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz#1a0c839a40c5351e9885628c85f2e5dfd02b52a9" - integrity sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ== - -"@img/sharp-win32-x64@0.33.5": - version "0.33.5" - resolved "https://registry.yarnpkg.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz#56f00962ff0c4e0eb93d34a047d29fa995e3e342" - integrity sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg== - -"@inquirer/confirm@^5.0.0": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-5.0.1.tgz#35e0aa0f9fdaadee3acb1c42024e707af308fced" - integrity sha512-6ycMm7k7NUApiMGfVc32yIPp28iPKxhGRMqoNDiUjq2RyTAkbs5Fx0TdzBqhabcKvniDdAAvHCmsRjnNfTsogw== - dependencies: - "@inquirer/core" "^10.0.1" - "@inquirer/type" "^3.0.0" - -"@inquirer/core@^10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-10.0.1.tgz#22068da87d8f6317452172dfd521e811ccbcb90e" - integrity sha512-KKTgjViBQUi3AAssqjUFMnMO3CM3qwCHvePV9EW+zTKGKafFGFF01sc1yOIYjLJ7QU52G/FbzKc+c01WLzXmVQ== - dependencies: - "@inquirer/figures" "^1.0.7" - "@inquirer/type" "^3.0.0" - ansi-escapes "^4.3.2" - cli-width "^4.1.0" - mute-stream "^2.0.0" - signal-exit "^4.1.0" - strip-ansi "^6.0.1" - wrap-ansi "^6.2.0" - yoctocolors-cjs "^2.1.2" - -"@inquirer/figures@^1.0.7": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.7.tgz#d050ccc0eabfacc0248c4ff647a9dfba1b01594b" - integrity sha512-m+Trk77mp54Zma6xLkLuY+mvanPxlE4A7yNKs2HBiyZ4UkVs28Mv5c/pgWrHeInx+USHeX/WEPzjrWrcJiQgjw== - -"@inquirer/type@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-3.0.0.tgz#1762ebe667ec1d838012b20bf0cf90b841ba68bc" - integrity sha512-YYykfbw/lefC7yKj7nanzQXILM7r3suIvyFlCcMskc99axmsSewXWkAfXKwMbgxL76iAFVmRwmYdwNZNc8gjog== - "@isaacs/cliui@^8.0.2": version "8.0.2" resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" @@ -3302,7 +2609,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.5.0" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== @@ -3356,70 +2663,6 @@ tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" -"@mswjs/interceptors@^0.37.0": - version "0.37.1" - resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.37.1.tgz#fe30692c18318b0dba8aa36b390cb0a482fd81a7" - integrity sha512-SvE+tSpcX884RJrPCskXxoS965Ky/pYABDEhWW6oeSRhpUDLrS5nTvT5n1LLSDVDYvty4imVmXsy+3/ROVuknA== - dependencies: - "@open-draft/deferred-promise" "^2.2.0" - "@open-draft/logger" "^0.3.0" - "@open-draft/until" "^2.0.0" - is-node-process "^1.2.0" - outvariant "^1.4.3" - strict-event-emitter "^0.5.1" - -"@next/env@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/env/-/env-15.1.2.tgz#fa36e47bbaa33b9ecac228aa786bb05bbc15351c" - integrity sha512-Hm3jIGsoUl6RLB1vzY+dZeqb+/kWPZ+h34yiWxW0dV87l8Im/eMOwpOA+a0L78U0HM04syEjXuRlCozqpwuojQ== - -"@next/eslint-plugin-next@15.0.2": - version "15.0.2" - resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-15.0.2.tgz#4aa6e4d3cd5d2d7239bf69e253471a92bd47ac67" - integrity sha512-R9Jc7T6Ge0txjmqpPwqD8vx6onQjynO9JT73ArCYiYPvSrwYXepH/UY/WdKDY8JPWJl72sAE4iGMHPeQ5xdEWg== - dependencies: - fast-glob "3.3.1" - -"@next/swc-darwin-arm64@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.2.tgz#822265999fc76f828f4c671a5ef861b8e2c5213e" - integrity sha512-b9TN7q+j5/7+rGLhFAVZiKJGIASuo8tWvInGfAd8wsULjB1uNGRCj1z1WZwwPWzVQbIKWFYqc+9L7W09qwt52w== - -"@next/swc-darwin-x64@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.2.tgz#78d277bce3d35c6e8d9ad423b6f5b0031aa9a1e2" - integrity sha512-caR62jNDUCU+qobStO6YJ05p9E+LR0EoXh1EEmyU69cYydsAy7drMcOlUlRtQihM6K6QfvNwJuLhsHcCzNpqtA== - -"@next/swc-linux-arm64-gnu@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.2.tgz#4d48c8c37da869b0fdbb51f3f3f71df7a3b6b1bb" - integrity sha512-fHHXBusURjBmN6VBUtu6/5s7cCeEkuGAb/ZZiGHBLVBXMBy4D5QpM8P33Or8JD1nlOjm/ZT9sEE5HouQ0F+hUA== - -"@next/swc-linux-arm64-musl@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.2.tgz#0efbaffc2bc3fad4a6458c91b1655b0c3d509577" - integrity sha512-9CF1Pnivij7+M3G74lxr+e9h6o2YNIe7QtExWq1KUK4hsOLTBv6FJikEwCaC3NeYTflzrm69E5UfwEAbV2U9/g== - -"@next/swc-linux-x64-gnu@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.2.tgz#fcdb19e2a7602f85f103190539d0cf42eca7f217" - integrity sha512-tINV7WmcTUf4oM/eN3Yuu/f8jQ5C6AkueZPKeALs/qfdfX57eNv4Ij7rt0SA6iZ8+fMobVfcFVv664Op0caCCg== - -"@next/swc-linux-x64-musl@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.2.tgz#06b09f1712498dd5c61fac10c56a09535469b4c4" - integrity sha512-jf2IseC4WRsGkzeUw/cK3wci9pxR53GlLAt30+y+B+2qAQxMw6WAC3QrANIKxkcoPU3JFh/10uFfmoMDF9JXKg== - -"@next/swc-win32-arm64-msvc@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.2.tgz#63159223241ff45e8df76b24fc979bbb933c74df" - integrity sha512-wvg7MlfnaociP7k8lxLX4s2iBJm4BrNiNFhVUY+Yur5yhAJHfkS8qPPeDEUH8rQiY0PX3u/P7Q/wcg6Mv6GSAA== - -"@next/swc-win32-x64-msvc@15.1.2": - version "15.1.2" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.2.tgz#6e6b33b1d725c0e98fa76773fe437fb02ad6540b" - integrity sha512-D3cNA8NoT3aWISWmo7HF5Eyko/0OdOO+VagkoJuiTk7pyX3P/b+n8XA/MYvyR+xSVcbKn68B1rY9fgqjNISqzQ== - "@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1": version "5.1.1-v1" resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz#dbf733a965ca47b1973177dc0bb6c889edcfb129" @@ -3439,13 +2682,6 @@ dependencies: "@noble/hashes" "1.3.2" -"@noble/curves@1.4.2", "@noble/curves@~1.4.0": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9" - integrity sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw== - dependencies: - "@noble/hashes" "1.4.0" - "@noble/curves@1.7.0", "@noble/curves@^1.6.0", "@noble/curves@^1.7.0", "@noble/curves@~1.7.0": version "1.7.0" resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz#0512360622439256df892f21d25b388f52505e45" @@ -3463,11 +2699,6 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== -"@noble/hashes@1.4.0", "@noble/hashes@~1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" - integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== - "@noble/hashes@1.6.0": version "1.6.0" resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz#d4bfb516ad6e7b5111c216a5cc7075f4cf19e6c5" @@ -3478,7 +2709,7 @@ 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": +"@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== @@ -3509,11 +2740,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@nolyfill/is-core-module@1.0.39": - version "1.0.39" - resolved "https://registry.yarnpkg.com/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz#3dc35ba0f1e66b403c00b39344f870298ebb1c8e" - integrity sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA== - "@nomicfoundation/edr-darwin-arm64@0.6.4": version "0.6.4" resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.6.4.tgz#6eaa64a6ea5201e4c92b121f2b7fd197b26e450a" @@ -3592,16 +2818,6 @@ "@nomicfoundation/ethereumjs-rlp" "5.0.4" ethereum-cryptography "0.1.3" -"@nomicfoundation/hardhat-chai-matchers@^2.0.0": - version "2.0.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.8.tgz#9c7cfc4ad0f0a5e9cf16aba8ab668c02f6e273aa" - integrity sha512-Z5PiCXH4xhNLASROlSUOADfhfpfhYO6D7Hn9xp8PddmHey0jq704cr6kfU8TRrQ4PUZbpfsZadPj+pCfZdjPIg== - dependencies: - "@types/chai-as-promised" "^7.1.3" - chai-as-promised "^7.1.1" - deep-eql "^4.0.1" - ordinal "^1.0.3" - "@nomicfoundation/hardhat-ethers@^3.0.8": version "3.0.8" resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.8.tgz#af078f566373abeb77e11cbe69fe3dd47f8bfc27" @@ -3610,33 +2826,6 @@ debug "^4.1.1" lodash.isequal "^4.5.0" -"@nomicfoundation/hardhat-network-helpers@^1.0.0": - version "1.0.12" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.12.tgz#2c0abec0c50b75f9d0d71776e49e3b5ef746d289" - integrity sha512-xTNQNI/9xkHvjmCJnJOTyqDSl8uq1rKb2WOVmixQxFtRd7Oa3ecO8zM0cyC2YmOK+jHB9WPZ+F/ijkHg1CoORA== - dependencies: - ethereumjs-util "^7.1.4" - -"@nomicfoundation/hardhat-toolbox@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-4.0.0.tgz#eb1f619218dd1414fa161dfec92d3e5e53a2f407" - integrity sha512-jhcWHp0aHaL0aDYj8IJl80v4SZXWMS1A2XxXa1CA6pBiFfJKuZinCkO6wb+POAt0LIfXB3gA3AgdcOccrcwBwA== - -"@nomicfoundation/hardhat-verify@^2.0.12": - version "2.0.12" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.12.tgz#480819a245a2db0b127e473c62079f7b4f16daa8" - integrity sha512-Lg3Nu7DCXASQRVI/YysjuAX2z8jwOCbS0w5tz2HalWGSTZThqA0v9N0v0psHbKNqzPJa8bNOeapIVSziyJTnAg== - dependencies: - "@ethersproject/abi" "^5.1.2" - "@ethersproject/address" "^5.0.2" - cbor "^8.1.0" - debug "^4.1.1" - lodash.clonedeep "^4.5.0" - picocolors "^1.1.0" - semver "^6.3.0" - table "^6.8.0" - undici "^5.14.0" - "@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2": version "0.1.2" resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.2.tgz#3a9c3b20d51360b20affb8f753e756d553d49557" @@ -3685,24 +2874,6 @@ "@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.1.2" "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.2" -"@open-draft/deferred-promise@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz#4a822d10f6f0e316be4d67b4d4f8c9a124b073bd" - integrity sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA== - -"@open-draft/logger@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@open-draft/logger/-/logger-0.3.0.tgz#2b3ab1242b360aa0adb28b85f5d7da1c133a0954" - integrity sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ== - dependencies: - is-node-process "^1.2.0" - outvariant "^1.4.0" - -"@open-draft/until@^2.0.0", "@open-draft/until@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@open-draft/until/-/until-2.1.0.tgz#0acf32f470af2ceaf47f095cdecd40d68666efda" - integrity sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg== - "@openzeppelin/contracts-upgradeable@5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-5.0.2.tgz#3e5321a2ecdd0b206064356798c21225b6ec7105" @@ -3713,11 +2884,6 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.2.tgz#b1d03075e49290d06570b2fd42154d76c2a5d210" integrity sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA== -"@openzeppelin/contracts@^5.1.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.1.0.tgz#4e61162f2a2bf414c4e10c45eca98ce5f1aadbd4" - integrity sha512-p1ULhl7BXzjjbha5aqst+QMLY+4/LCWADXOCsmLHRM77AqiPjnd9vvUN9sosUfhL9JGKpZ0TjEGxgvnizmWGSA== - "@pkgjs/parseargs@^0.11.0": version "0.11.0" resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" @@ -3728,23 +2894,6 @@ resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== -"@playwright/test@^1.49.0": - version "1.49.0" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.0.tgz#74227385b58317ee076b86b56d0e1e1b25cff01e" - integrity sha512-DMulbwQURa8rNIQrf94+jPJQ4FmOVdpE5ZppRNvWVjvhC+6sOeo28r8MgIpQRYouXRtt/FCCXU7zn20jnHR4Qw== - dependencies: - playwright "1.49.0" - -"@polka/url@^1.0.0-next.24": - version "1.0.0-next.28" - resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.28.tgz#d45e01c4a56f143ee69c54dd6b12eade9e270a73" - integrity sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw== - -"@remix-run/router@1.20.0": - version "1.20.0" - resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.20.0.tgz#03554155b45d8b529adf635b2f6ad1165d70d8b4" - integrity sha512-mUnk8rPJBI9loFDZ+YzPGdeniYK+FTmRD1TMCz7ev2SNIozyKKpnGgsxO34u6Z4z/t0ITuu7voi/AshfsGsgFg== - "@rollup/rollup-android-arm-eabi@4.29.1": version "4.29.1" resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.29.1.tgz#9bd38df6a29afb7f0336d988bc8112af0c8816c0" @@ -3845,17 +2994,12 @@ resolved "https://registry.yarnpkg.com/@rtsao/scc/-/scc-1.1.0.tgz#927dd2fae9bc3361403ac2c7a00c32ddce9ad7e8" integrity sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g== -"@rushstack/eslint-patch@^1.10.3": - version "1.10.4" - resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.10.4.tgz#427d5549943a9c6fce808e39ea64dbe60d4047f1" - integrity sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA== - "@scure/base@^1.2.1", "@scure/base@~1.2.1": version "1.2.1" resolved "https://registry.npmjs.org/@scure/base/-/base-1.2.1.tgz#dd0b2a533063ca612c17aa9ad26424a2ff5aa865" integrity sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ== -"@scure/base@~1.1.0", "@scure/base@~1.1.6": +"@scure/base@~1.1.0": version "1.1.9" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== @@ -3869,15 +3013,6 @@ "@noble/secp256k1" "~1.7.0" "@scure/base" "~1.1.0" -"@scure/bip32@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67" - integrity sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg== - dependencies: - "@noble/curves" "~1.4.0" - "@noble/hashes" "~1.4.0" - "@scure/base" "~1.1.6" - "@scure/bip32@1.6.0", "@scure/bip32@^1.4.0", "@scure/bip32@^1.5.0": version "1.6.0" resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.6.0.tgz#6dbc6b4af7c9101b351f41231a879d8da47e0891" @@ -3895,14 +3030,6 @@ "@noble/hashes" "~1.2.0" "@scure/base" "~1.1.0" -"@scure/bip39@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3" - integrity sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ== - dependencies: - "@noble/hashes" "~1.4.0" - "@scure/base" "~1.1.6" - "@scure/bip39@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.5.0.tgz#c8f9533dbd787641b047984356531d84485f19be" @@ -4441,69 +3568,6 @@ "@smithy/util-buffer-from" "^4.0.0" tslib "^2.6.2" -"@solidity-parser/parser@^0.14.0": - version "0.14.5" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.5.tgz#87bc3cc7b068e08195c219c91cd8ddff5ef1a804" - integrity sha512-6dKnHZn7fg/iQATVEzqyUOyEidbn05q7YA2mQ9hC0MMXhhV3/JrsxmFSYZAcr7j1yUP700LLhTruvJ3MiQmjJg== - dependencies: - antlr4ts "^0.5.0-alpha.4" - -"@solidity-parser/parser@^0.19.0": - version "0.19.0" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.19.0.tgz#37a8983b2725af9b14ff8c4a475fa0e98d773c3f" - integrity sha512-RV16k/qIxW/wWc+mLzV3ARyKUaMUTBy9tOLMzFhtNSKYeTAanQ3a5MudJKf/8arIFnA2L27SNjarQKmFg0w/jA== - -"@swc/counter@0.1.3": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9" - integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== - -"@swc/helpers@0.5.15": - version "0.5.15" - resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.15.tgz#79efab344c5819ecf83a43f3f9f811fc84b516d7" - integrity sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g== - dependencies: - tslib "^2.8.0" - -"@testing-library/dom@^10.1.0", "@testing-library/dom@^10.4.0": - version "10.4.0" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-10.4.0.tgz#82a9d9462f11d240ecadbf406607c6ceeeff43a8" - integrity sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/runtime" "^7.12.5" - "@types/aria-query" "^5.0.1" - aria-query "5.3.0" - chalk "^4.1.0" - dom-accessibility-api "^0.5.9" - lz-string "^1.5.0" - pretty-format "^27.0.2" - -"@testing-library/jest-dom@^6.6.3": - version "6.6.3" - resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.6.3.tgz#26ba906cf928c0f8172e182c6fe214eb4f9f2bd2" - integrity sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA== - dependencies: - "@adobe/css-tools" "^4.4.0" - aria-query "^5.0.0" - chalk "^3.0.0" - css.escape "^1.5.1" - dom-accessibility-api "^0.6.3" - lodash "^4.17.21" - redent "^3.0.0" - -"@testing-library/react@^16.1.0": - version "16.1.0" - resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-16.1.0.tgz#aa0c61398bac82eaf89776967e97de41ac742d71" - integrity sha512-Q2ToPvg0KsVL0ohND9A3zLJWcOXXcO8IDu3fj11KhNt0UlCWyFyvnCIBkd12tidB2lkiVRG8VFqdhcqhqnAQtg== - dependencies: - "@babel/runtime" "^7.12.5" - -"@testing-library/user-event@^14.5.2": - version "14.5.2" - resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.5.2.tgz#db7257d727c891905947bd1c1a99da20e03c2ebd" - integrity sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ== - "@tootallnate/once@2": version "2.0.0" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" @@ -4534,27 +3598,7 @@ resolved "https://registry.yarnpkg.com/@tsd/typescript/-/typescript-5.4.5.tgz#a7c11d3a97ddfa201f831f4e4270a169a87f7655" integrity sha512-saiCxzHRhUrRxQV2JhH580aQUZiKQUXI38FcAcikcfOomAil4G4lxT0RfrrKywoAYP/rqAdYXYmNRLppcd+hQQ== -"@typechain/ethers-v6@^0.5.0": - version "0.5.1" - resolved "https://registry.yarnpkg.com/@typechain/ethers-v6/-/ethers-v6-0.5.1.tgz#42fe214a19a8b687086c93189b301e2b878797ea" - integrity sha512-F+GklO8jBWlsaVV+9oHaPh5NJdd6rAKN4tklGfInX1Q7h0xPgVLP39Jl3eCulPB5qexI71ZFHwbljx4ZXNfouA== - dependencies: - lodash "^4.17.15" - ts-essentials "^7.0.1" - -"@typechain/hardhat@^9.0.0": - version "9.1.0" - resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-9.1.0.tgz#6985015f01dfb37ef2ca8a29c742d05890351ddc" - integrity sha512-mtaUlzLlkqTlfPwB3FORdejqBskSnh+Jl8AIJGjXNAQfRQ4ofHADPl1+oU7Z3pAJzmZbUXII8MhOLQltcHgKnA== - dependencies: - fs-extra "^9.1.0" - -"@types/aria-query@^5.0.1": - version "5.0.4" - resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708" - integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw== - -"@types/babel__core@^7.1.14", "@types/babel__core@^7.20.5": +"@types/babel__core@^7.1.14": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== @@ -4609,30 +3653,6 @@ "@types/connect" "*" "@types/node" "*" -"@types/chai-as-promised@^7.1.3": - version "7.1.8" - resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.8.tgz#f2b3d82d53c59626b5d6bbc087667ccb4b677fe9" - integrity sha512-ThlRVIJhr69FLlh6IctTXFkmhtP3NpMZ2QGq69StYLyKZFp/HOp1VdKZj7RvfNWYYcJ1xlbLGLLWj1UvP5u/Gw== - dependencies: - "@types/chai" "*" - -"@types/chai@*": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-5.0.0.tgz#7f981e71e69c9b2d422f58f78de1c59179782133" - integrity sha512-+DwhEHAaFPPdJ2ral3kNHFQXnTfscEEFsUxzD+d7nlcLrFK23JtNjH71RGasTcHb88b4vVi4mTyfpf8u2L8bdA== - -"@types/chai@^4.2.0": - version "4.3.20" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.20.tgz#cb291577ed342ca92600430841a00329ba05cecc" - integrity sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ== - -"@types/concat-stream@^1.6.0": - version "1.6.1" - resolved "https://registry.yarnpkg.com/@types/concat-stream/-/concat-stream-1.6.1.tgz#24bcfc101ecf68e886aaedce60dfd74b632a1b74" - integrity sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA== - dependencies: - "@types/node" "*" - "@types/connect@*": version "3.4.38" resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" @@ -4647,11 +3667,6 @@ dependencies: "@types/node" "*" -"@types/cookie@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.6.0.tgz#eac397f28bf1d6ae0ae081363eca2f425bedf0d5" - integrity sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA== - "@types/cors@^2.8.17": version "2.8.17" resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.17.tgz#5d718a5e494a8166f569d986794e49c48b216b2b" @@ -4684,7 +3699,7 @@ "@types/estree" "*" "@types/json-schema" "*" -"@types/estree@*", "@types/estree@1.0.6", "@types/estree@^1.0.0", "@types/estree@^1.0.6": +"@types/estree@*", "@types/estree@1.0.6", "@types/estree@^1.0.6": version "1.0.6" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== @@ -4709,13 +3724,6 @@ "@types/qs" "*" "@types/serve-static" "*" -"@types/form-data@0.0.33": - version "0.0.33" - resolved "https://registry.yarnpkg.com/@types/form-data/-/form-data-0.0.33.tgz#c9ac85b2a5fd18435b8c85d9ecb50e6d6c893ff8" - integrity sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw== - dependencies: - "@types/node" "*" - "@types/fs-extra@^11.0.4": version "11.0.4" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-11.0.4.tgz#e16a863bb8843fba8c5004362b5a73e17becca45" @@ -4724,14 +3732,6 @@ "@types/jsonfile" "*" "@types/node" "*" -"@types/glob@^7.1.1": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" - integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== - dependencies: - "@types/minimatch" "*" - "@types/node" "*" - "@types/graceful-fs@^4.1.3": version "4.1.9" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" @@ -4770,14 +3770,6 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@^29.5.14": - version "29.5.14" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" - integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== - dependencies: - expect "^29.0.0" - pretty-format "^29.0.0" - "@types/jsdom@^20.0.0": version "20.0.1" resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" @@ -4821,29 +3813,12 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== -"@types/minimatch@*": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" - integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== - "@types/minimist@^1.2.0": version "1.2.5" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== -"@types/mocha@>=10.0.10": - version "10.0.10" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.10.tgz#91f62905e8d23cbd66225312f239454a23bebfa0" - integrity sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q== - -"@types/node-forge@^1.3.0": - version "1.3.11" - resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da" - integrity sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ== - dependencies: - "@types/node" "*" - -"@types/node@*", "@types/node@^22", "@types/node@^22.7.9": +"@types/node@*", "@types/node@^22.7.9": version "22.7.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.9.tgz#2bf2797b5e84702d8262ea2cf843c3c3c880d0e9" integrity sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg== @@ -4857,7 +3832,7 @@ dependencies: undici-types "~6.19.2" -"@types/node@^10.0.3", "@types/node@^10.3.2": +"@types/node@^10.3.2": version "10.17.60" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b" integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== @@ -4874,11 +3849,6 @@ dependencies: undici-types "~5.26.4" -"@types/node@^8.0.0": - version "8.10.66" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.66.tgz#dd035d409df322acc83dff62a602f12a5783bbb3" - integrity sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw== - "@types/normalize-package-data@^2.4.0": version "2.4.4" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901" @@ -4891,17 +3861,7 @@ dependencies: "@types/node" "*" -"@types/prettier@^2.1.1": - version "2.7.3" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" - integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== - -"@types/prop-types@*": - version "15.7.13" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.13.tgz#2af91918ee12d9d32914feb13f5326658461b451" - integrity sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA== - -"@types/qs@*", "@types/qs@^6.2.31": +"@types/qs@*": version "6.9.16" resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.16.tgz#52bba125a07c0482d26747d5d4947a64daf8f794" integrity sha512-7i+zxXdPD0T4cKDuxCUXJ4wHcsJLwENa6Z3dCu8cfCK743OGy5Nu1RmAGqDPsoTDINVEcdXKRvR/zre+P2Ku1A== @@ -4911,29 +3871,6 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== -"@types/react-dom@^18.3.1": - version "18.3.1" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.1.tgz#1e4654c08a9cdcfb6594c780ac59b55aad42fe07" - integrity sha512-qW1Mfv8taImTthu4KoXgDfLuk4bydU6Q/TkADnDWWHwi4NX4BR+LWfTp2sVmTqRrsHvyDDTelgelxJ+SsejKKQ== - dependencies: - "@types/react" "*" - -"@types/react@*", "@types/react@^18.3.5": - version "18.3.11" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.11.tgz#9d530601ff843ee0d7030d4227ea4360236bd537" - integrity sha512-r6QZ069rFTjrEYgFdOck1gK7FLVsgJE7tTz0pQBczlBNUhBNk0MQH4UbnFSwjpQLMkLzgqvBBa+qGpLje16eTQ== - dependencies: - "@types/prop-types" "*" - csstype "^3.0.2" - -"@types/react@^18.3.11": - version "18.3.12" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.12.tgz#99419f182ccd69151813b7ee24b792fe08774f60" - integrity sha512-D2wOSq/d6Agt28q7rSI3jhU7G6aiuzljDGZ2hTZHIkrTLUI+AF3WMeKkEZ9nN2fkBAlcktT6vcZjDFiIhMYEQw== - dependencies: - "@types/prop-types" "*" - csstype "^3.0.2" - "@types/secp256k1@^4.0.1": version "4.0.6" resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.6.tgz#d60ba2349a51c2cbc5e816dcd831a42029d376bf" @@ -4985,12 +3922,7 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== -"@types/statuses@^2.0.4": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@types/statuses/-/statuses-2.0.5.tgz#f61ab46d5352fd73c863a1ea4e1cef3b0b51ae63" - integrity sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A== - -"@types/tough-cookie@*", "@types/tough-cookie@^4.0.5": +"@types/tough-cookie@*": version "4.0.5" resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== @@ -5049,21 +3981,6 @@ natural-compare "^1.4.0" ts-api-utils "^1.3.0" -"@typescript-eslint/eslint-plugin@^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.17.0.tgz#2ee073c421f4e81e02d10e731241664b6253b23c" - integrity sha512-HU1KAdW3Tt8zQkdvNoIijfWDMvdSweFYm4hWh+KwhPstv+sCmWb89hCIP8msFm9N1R/ooh9honpSuvqKWlYy3w== - dependencies: - "@eslint-community/regexpp" "^4.10.0" - "@typescript-eslint/scope-manager" "8.17.0" - "@typescript-eslint/type-utils" "8.17.0" - "@typescript-eslint/utils" "8.17.0" - "@typescript-eslint/visitor-keys" "8.17.0" - graphemer "^1.4.0" - ignore "^5.3.1" - natural-compare "^1.4.0" - ts-api-utils "^1.3.0" - "@typescript-eslint/parser@8.16.0": version "8.16.0" resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.16.0.tgz#ee5b2d6241c1ab3e2e53f03fd5a32d8e266d8e06" @@ -5075,17 +3992,6 @@ "@typescript-eslint/visitor-keys" "8.16.0" debug "^4.3.4" -"@typescript-eslint/parser@^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.17.0.tgz#2ee972bb12fa69ac625b85813dc8d9a5a053ff52" - integrity sha512-Drp39TXuUlD49F7ilHHCG7TTg8IkA+hxCuULdmzWYICxGXvDXmDmWEjJYZQYgf6l/TFfYNE167m7isnc3xlIEg== - dependencies: - "@typescript-eslint/scope-manager" "8.17.0" - "@typescript-eslint/types" "8.17.0" - "@typescript-eslint/typescript-estree" "8.17.0" - "@typescript-eslint/visitor-keys" "8.17.0" - debug "^4.3.4" - "@typescript-eslint/parser@^6.4.0": version "6.21.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" @@ -5129,14 +4035,6 @@ "@typescript-eslint/types" "8.16.0" "@typescript-eslint/visitor-keys" "8.16.0" -"@typescript-eslint/scope-manager@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.17.0.tgz#a3f49bf3d4d27ff8d6b2ea099ba465ef4dbcaa3a" - integrity sha512-/ewp4XjvnxaREtqsZjF4Mfn078RD/9GmiEAtTeLQ7yFdKnqwTOgRMSvFz4et9U5RiJQ15WTGXPLj89zGusvxBg== - dependencies: - "@typescript-eslint/types" "8.17.0" - "@typescript-eslint/visitor-keys" "8.17.0" - "@typescript-eslint/type-utils@7.16.1": version "7.16.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.16.1.tgz#4d7ae4f3d9e3c8cbdabae91609b1a431de6aa6ca" @@ -5157,16 +4055,6 @@ debug "^4.3.4" ts-api-utils "^1.3.0" -"@typescript-eslint/type-utils@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.17.0.tgz#d326569f498cdd0edf58d5bb6030b4ad914e63d3" - integrity sha512-q38llWJYPd63rRnJ6wY/ZQqIzPrBCkPdpIsaCfkR3Q4t3p6sb422zougfad4TFW9+ElIFLVDzWGiGAfbb/v2qw== - dependencies: - "@typescript-eslint/typescript-estree" "8.17.0" - "@typescript-eslint/utils" "8.17.0" - debug "^4.3.4" - ts-api-utils "^1.3.0" - "@typescript-eslint/types@6.21.0": version "6.21.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" @@ -5187,11 +4075,6 @@ resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.16.0.tgz#49c92ae1b57942458ab83d9ec7ccab3005e64737" integrity sha512-NzrHj6thBAOSE4d9bsuRNMvk+BvaQvmY4dDglgkgGC0EW/tB3Kelnp3tAKH87GEwzoxgeQn9fNGRyFJM/xd+GQ== -"@typescript-eslint/types@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.17.0.tgz#ef84c709ef8324e766878834970bea9a7e3b72cf" - integrity sha512-gY2TVzeve3z6crqh2Ic7Cr+CAv6pfb0Egee7J5UAVWCpVvDI/F71wNfolIim4FE6hT15EbpZFVUj9j5i38jYXA== - "@typescript-eslint/typescript-estree@6.21.0": version "6.21.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" @@ -5248,20 +4131,6 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/typescript-estree@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.17.0.tgz#40b5903bc929b1e8dd9c77db3cb52cfb199a2a34" - integrity sha512-JqkOopc1nRKZpX+opvKqnM3XUlM7LpFMD0lYxTqOTKQfCWAmxw45e3qlOCsEqEB2yuacujivudOFpCnqkBDNMw== - dependencies: - "@typescript-eslint/types" "8.17.0" - "@typescript-eslint/visitor-keys" "8.17.0" - debug "^4.3.4" - fast-glob "^3.3.2" - is-glob "^4.0.3" - minimatch "^9.0.4" - semver "^7.6.0" - ts-api-utils "^1.3.0" - "@typescript-eslint/utils@7.16.1": version "7.16.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.16.1.tgz#df42dc8ca5a4603016fd102db0346cdab415cdb7" @@ -5282,16 +4151,6 @@ "@typescript-eslint/types" "8.16.0" "@typescript-eslint/typescript-estree" "8.16.0" -"@typescript-eslint/utils@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.17.0.tgz#41c05105a2b6ab7592f513d2eeb2c2c0236d8908" - integrity sha512-bQC8BnEkxqG8HBGKwG9wXlZqg37RKSMY7v/X8VEWD8JG2JuTHuNK0VFvMPMUKQcbk6B+tf05k+4AShAEtCtJ/w== - dependencies: - "@eslint-community/eslint-utils" "^4.4.0" - "@typescript-eslint/scope-manager" "8.17.0" - "@typescript-eslint/types" "8.17.0" - "@typescript-eslint/typescript-estree" "8.17.0" - "@typescript-eslint/utils@^7.16.1": version "7.18.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.18.0.tgz#bca01cde77f95fc6a8d5b0dbcbfb3d6ca4be451f" @@ -5334,14 +4193,6 @@ "@typescript-eslint/types" "8.16.0" eslint-visitor-keys "^4.2.0" -"@typescript-eslint/visitor-keys@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.17.0.tgz#4dbcd0e28b9bf951f4293805bf34f98df45e1aa8" - integrity sha512-1Hm7THLpO6ww5QU6H/Qp+AusUUl+z/CAm3cNZZ0jQvon9yicgO7Rwd+/WWRpMKLYV6p2UvdbR27c86rzCPpreg== - dependencies: - "@typescript-eslint/types" "8.17.0" - eslint-visitor-keys "^4.2.0" - "@ungap/structured-clone@^1.0.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" @@ -5372,150 +4223,6 @@ "@openzeppelin/contracts-upgradeable" "5.0.2" ethers "^6.9.0" -"@vitejs/plugin-react@^4.3.4": - version "4.3.4" - resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-4.3.4.tgz#c64be10b54c4640135a5b28a2432330e88ad7c20" - integrity sha512-SCCPBJtYLdE8PX/7ZQAs1QAZ8Jqwih+0VBLum1EGqmCCQal+MIUqLCzj3ZUy8ufbC0cAM4LRlSTm7IQJwWT4ug== - dependencies: - "@babel/core" "^7.26.0" - "@babel/plugin-transform-react-jsx-self" "^7.25.9" - "@babel/plugin-transform-react-jsx-source" "^7.25.9" - "@types/babel__core" "^7.20.5" - react-refresh "^0.14.2" - -"@vitest/browser@^2.1.6": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@vitest/browser/-/browser-2.1.8.tgz#c87cf383eb5b6f3630f5654767f8525413b53c74" - integrity sha512-OWVvEJThRgxlNMYNVLEK/9qVkpRcLvyuKLngIV3Hob01P56NjPHprVBYn+rx4xAJudbM9yrCrywPIEuA3Xyo8A== - dependencies: - "@testing-library/dom" "^10.4.0" - "@testing-library/user-event" "^14.5.2" - "@vitest/mocker" "2.1.8" - "@vitest/utils" "2.1.8" - magic-string "^0.30.12" - msw "^2.6.4" - sirv "^3.0.0" - tinyrainbow "^1.2.0" - ws "^8.18.0" - -"@vitest/expect@2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-2.1.4.tgz#48f4f53a01092a3bdc118cff245f79ef388bdd8e" - integrity sha512-DOETT0Oh1avie/D/o2sgMHGrzYUFFo3zqESB2Hn70z6QB1HrS2IQ9z5DfyTqU8sg4Bpu13zZe9V4+UTNQlUeQA== - dependencies: - "@vitest/spy" "2.1.4" - "@vitest/utils" "2.1.4" - chai "^5.1.2" - tinyrainbow "^1.2.0" - -"@vitest/expect@2.1.8": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-2.1.8.tgz#13fad0e8d5a0bf0feb675dcf1d1f1a36a1773bc1" - integrity sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw== - dependencies: - "@vitest/spy" "2.1.8" - "@vitest/utils" "2.1.8" - chai "^5.1.2" - tinyrainbow "^1.2.0" - -"@vitest/mocker@2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@vitest/mocker/-/mocker-2.1.4.tgz#0dc07edb9114f7f080a0181fbcdb16cd4a2d855d" - integrity sha512-Ky/O1Lc0QBbutJdW0rqLeFNbuLEyS+mIPiNdlVlp2/yhJ0SbyYqObS5IHdhferJud8MbbwMnexg4jordE5cCoQ== - dependencies: - "@vitest/spy" "2.1.4" - estree-walker "^3.0.3" - magic-string "^0.30.12" - -"@vitest/mocker@2.1.8": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@vitest/mocker/-/mocker-2.1.8.tgz#51dec42ac244e949d20009249e033e274e323f73" - integrity sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA== - dependencies: - "@vitest/spy" "2.1.8" - estree-walker "^3.0.3" - magic-string "^0.30.12" - -"@vitest/pretty-format@2.1.4", "@vitest/pretty-format@^2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-2.1.4.tgz#fc31993bdc1ef5a6c1a4aa6844e7ba55658a4f9f" - integrity sha512-L95zIAkEuTDbUX1IsjRl+vyBSLh3PwLLgKpghl37aCK9Jvw0iP+wKwIFhfjdUtA2myLgjrG6VU6JCFLv8q/3Ww== - dependencies: - tinyrainbow "^1.2.0" - -"@vitest/pretty-format@2.1.8", "@vitest/pretty-format@^2.1.8": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-2.1.8.tgz#88f47726e5d0cf4ba873d50c135b02e4395e2bca" - integrity sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ== - dependencies: - tinyrainbow "^1.2.0" - -"@vitest/runner@2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-2.1.4.tgz#f9346500bdd0be1c926daaac5d683bae87ceda2c" - integrity sha512-sKRautINI9XICAMl2bjxQM8VfCMTB0EbsBc/EDFA57V6UQevEKY/TOPOF5nzcvCALltiLfXWbq4MaAwWx/YxIA== - dependencies: - "@vitest/utils" "2.1.4" - pathe "^1.1.2" - -"@vitest/runner@2.1.8": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-2.1.8.tgz#b0e2dd29ca49c25e9323ea2a45a5125d8729759f" - integrity sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg== - dependencies: - "@vitest/utils" "2.1.8" - pathe "^1.1.2" - -"@vitest/snapshot@2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-2.1.4.tgz#ef8c3f605fbc23a32773256d37d3fdfd9b23d353" - integrity sha512-3Kab14fn/5QZRog5BPj6Rs8dc4B+mim27XaKWFWHWA87R56AKjHTGcBFKpvZKDzC4u5Wd0w/qKsUIio3KzWW4Q== - dependencies: - "@vitest/pretty-format" "2.1.4" - magic-string "^0.30.12" - pathe "^1.1.2" - -"@vitest/snapshot@2.1.8": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-2.1.8.tgz#d5dc204f4b95dc8b5e468b455dfc99000047d2de" - integrity sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg== - dependencies: - "@vitest/pretty-format" "2.1.8" - magic-string "^0.30.12" - pathe "^1.1.2" - -"@vitest/spy@2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-2.1.4.tgz#4e90f9783437c5841a27c80f8fd84d7289a6100a" - integrity sha512-4JOxa+UAizJgpZfaCPKK2smq9d8mmjZVPMt2kOsg/R8QkoRzydHH1qHxIYNvr1zlEaFj4SXiaaJWxq/LPLKaLg== - dependencies: - tinyspy "^3.0.2" - -"@vitest/spy@2.1.8": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-2.1.8.tgz#bc41af3e1e6a41ae3b67e51f09724136b88fa447" - integrity sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg== - dependencies: - tinyspy "^3.0.2" - -"@vitest/utils@2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-2.1.4.tgz#6d67ac966647a21ce8bc497472ce230de3b64537" - integrity sha512-MXDnZn0Awl2S86PSNIim5PWXgIAx8CIkzu35mBdSApUip6RFOGXBCf3YFyeEu8n1IHk4bWD46DeYFu9mQlFIRg== - dependencies: - "@vitest/pretty-format" "2.1.4" - loupe "^3.1.2" - tinyrainbow "^1.2.0" - -"@vitest/utils@2.1.8": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-2.1.8.tgz#f8ef85525f3362ebd37fd25d268745108d6ae388" - integrity sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA== - dependencies: - "@vitest/pretty-format" "2.1.8" - loupe "^3.1.2" - tinyrainbow "^1.2.0" - JSONStream@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -5529,16 +4236,6 @@ abab@^2.0.6: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== -abbrev@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" - integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== - -abbrev@1.0.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" - integrity sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q== - abitype@1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.7.tgz#876a0005d211e1c9132825d45bcee7b46416b284" @@ -5577,14 +4274,14 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^8.0.2, acorn-walk@^8.1.1, acorn-walk@^8.2.0: +acorn-walk@^8.0.2, acorn-walk@^8.1.1: version "8.3.4" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== dependencies: acorn "^8.11.0" -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.4.1, acorn@^8.8.0, acorn@^8.8.1: +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.4.1, acorn@^8.8.1: version "8.12.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== @@ -5634,7 +4331,7 @@ ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.1, ajv@^8.11.0: +ajv@^8.11.0: version "8.17.1" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== @@ -5644,11 +4341,6 @@ ajv@^8.0.1, ajv@^8.11.0: json-schema-traverse "^1.0.0" require-from-string "^2.0.2" -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - integrity sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg== - ansi-align@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" @@ -5661,18 +4353,13 @@ ansi-colors@^4.1.1, ansi-colors@^4.1.3: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== -ansi-escapes@^4.2.1, ansi-escapes@^4.3.0, ansi-escapes@^4.3.2: +ansi-escapes@^4.2.1, ansi-escapes@^4.3.0: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== dependencies: type-fest "^0.21.3" -ansi-regex@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1" - integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw== - ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -5707,11 +4394,6 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -antlr4ts@^0.5.0-alpha.4: - version "0.5.0-alpha.4" - resolved "https://registry.yarnpkg.com/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz#71702865a87478ed0b40c0709f422cf14d51652a" - integrity sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ== - any-promise@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" @@ -5768,11 +4450,6 @@ arg@^4.1.0: resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== -arg@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c" - integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg== - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -5785,28 +4462,11 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -aria-query@5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e" - integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A== - dependencies: - dequal "^2.0.3" - -aria-query@^5.0.0, aria-query@^5.3.2: +aria-query@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.2.tgz#93f81a43480e33a338f19163a3d10a50c01dcd59" integrity sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw== -array-back@^3.0.1, array-back@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/array-back/-/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0" - integrity sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q== - -array-back@^4.0.1, array-back@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e" - integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg== - array-buffer-byte-length@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz#1e5583ec16763540a27ae52eed99ff899223568f" @@ -5842,11 +4502,6 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -array-uniq@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - integrity sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q== - array.prototype.findlast@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz#3e4fbcb30a15a7f5bf64cf2faae22d139c2e4904" @@ -5921,18 +4576,6 @@ arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== -as-table@^1.0.36: - version "1.0.55" - resolved "https://registry.yarnpkg.com/as-table/-/as-table-1.0.55.tgz#dc984da3937745de902cea1d45843c01bdbbec4f" - integrity sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ== - dependencies: - printable-characters "^1.0.42" - -asap@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== - asn1@^0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" @@ -5949,36 +4592,16 @@ asn1js@^3.0.5: pvutils "^1.1.3" tslib "^2.4.0" -assertion-error@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" - integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== - -assertion-error@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-2.0.1.tgz#f641a196b335690b1070bf00b6e7593fec190bf7" - integrity sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA== - ast-types-flow@^0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.8.tgz#0a85e1c92695769ac13a428bb653e7538bea27d6" integrity sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ== -astral-regex@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" - integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== - async-lock@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/async-lock/-/async-lock-1.4.1.tgz#56b8718915a9b68b10fce2f2a9a3dddf765ef53f" integrity sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ== -async@1.x: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - integrity sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w== - async@^3.2.3, async@^3.2.4: version "3.2.6" resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" @@ -5989,23 +4612,6 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -at-least-node@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" - integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== - -autoprefixer@^10.0.1: - version "10.4.20" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.20.tgz#5caec14d43976ef42e32dcb4bd62878e96be5b3b" - integrity sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g== - dependencies: - browserslist "^4.23.3" - caniuse-lite "^1.0.30001646" - fraction.js "^4.3.7" - normalize-range "^0.1.2" - picocolors "^1.0.1" - postcss-value-parser "^4.2.0" - available-typed-arrays@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" @@ -6018,15 +4624,6 @@ axe-core@^4.10.0: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.10.0.tgz#d9e56ab0147278272739a000880196cdfe113b59" integrity sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g== -axios@^1.5.1: - version "1.7.7" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f" - integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q== - dependencies: - follow-redirects "^1.15.6" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - axobject-query@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-4.1.0.tgz#28768c76d0e3cff21bc62a9e2d0b6ac30042a1ee" @@ -6182,11 +4779,6 @@ bcrypt-pbkdf@^1.0.2: dependencies: tweetnacl "^0.14.3" -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - better-path-resolve@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/better-path-resolve/-/better-path-resolve-1.0.0.tgz#13a35a1104cdd48a7b74bf8758f96a1ee613f99d" @@ -6209,11 +4801,6 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== -birpc@0.2.14: - version "0.2.14" - resolved "https://registry.yarnpkg.com/birpc/-/birpc-0.2.14.tgz#4a5498771e6ff24cf8ae5f47faf90e76ca2fce03" - integrity sha512-37FHE8rqsYM5JEKCnXFyHpBCzvgHEExwVVTq+nUmloInU7l8ezD1TpOhKpS8oe1DTYFqEK27rFZVKG43oTqXRA== - bl@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -6223,27 +4810,17 @@ bl@^4.0.3: inherits "^2.0.4" readable-stream "^3.4.0" -blake3-wasm@^2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/blake3-wasm/-/blake3-wasm-2.1.5.tgz#b22dbb84bc9419ed0159caa76af4b1b132e6ba52" - integrity sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g== - blakejs@^1.1.0, blakejs@^1.1.2: version "1.2.1" resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -bn.js@4.11.6: - version "4.11.6" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" - integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== - bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9, bn.js@^4.4.0: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: +bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== @@ -6329,7 +4906,7 @@ browserify-aes@^1.2.0: inherits "^2.0.1" safe-buffer "^5.0.1" -browserslist@^4.23.3, browserslist@^4.24.0: +browserslist@^4.24.0: version "4.24.0" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.0.tgz#a1325fe4bc80b64fda169629fc01b3d6cecd38d4" integrity sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A== @@ -6427,13 +5004,6 @@ bundle-require@^5.0.0: dependencies: load-tsconfig "^0.2.3" -busboy@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" - integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== - dependencies: - streamsearch "^1.1.0" - byline@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" @@ -6475,11 +5045,6 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase-css@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5" - integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== - camelcase-keys@^6.2.2: version "6.2.2" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" @@ -6499,67 +5064,16 @@ camelcase@^6.0.0, camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001646, caniuse-lite@^1.0.30001663, caniuse-lite@^1.0.30001669: +caniuse-lite@^1.0.30001663, caniuse-lite@^1.0.30001669: version "1.0.30001680" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz#5380ede637a33b9f9f1fc6045ea99bd142f3da5e" integrity sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA== -capnp-ts@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/capnp-ts/-/capnp-ts-0.7.0.tgz#16fd8e76b667d002af8fcf4bf92bf15d1a7b54a9" - integrity sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g== - dependencies: - debug "^4.3.1" - tslib "^2.2.0" - -caseless@^0.12.0, caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== - -cbor@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/cbor/-/cbor-8.1.0.tgz#cfc56437e770b73417a2ecbfc9caf6b771af60d5" - integrity sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg== - dependencies: - nofilter "^3.1.0" - ccount@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/ccount/-/ccount-2.0.1.tgz#17a3bf82302e0870d6da43a01311a8bc02a3ecf5" integrity sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg== -chai-as-promised@^7.1.1: - version "7.1.2" - resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.2.tgz#70cd73b74afd519754161386421fb71832c6d041" - integrity sha512-aBDHZxRzYnUYuIAIPBH2s511DjlKPzXNlXSGFC8CwmroWQLfrW0LtE1nK3MAwwNhJPa9raEjNCmRoFpG0Hurdw== - dependencies: - check-error "^1.0.2" - -chai@^4.2.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.5.0.tgz#707e49923afdd9b13a8b0b47d33d732d13812fd8" - integrity sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw== - dependencies: - assertion-error "^1.1.0" - check-error "^1.0.3" - deep-eql "^4.1.3" - get-func-name "^2.0.2" - loupe "^2.3.6" - pathval "^1.1.1" - type-detect "^4.1.0" - -chai@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/chai/-/chai-5.1.2.tgz#3afbc340b994ae3610ca519a6c70ace77ad4378d" - integrity sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw== - dependencies: - assertion-error "^2.0.1" - check-error "^2.1.1" - deep-eql "^5.0.1" - loupe "^3.1.0" - pathval "^2.0.0" - chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -6569,15 +5083,7 @@ chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.2: +chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -6610,24 +5116,7 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -"charenc@>= 0.0.1": - version "0.0.2" - resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" - integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== - -check-error@^1.0.2, check-error@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" - integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== - dependencies: - get-func-name "^2.0.2" - -check-error@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-2.1.1.tgz#87eb876ae71ee388fa0471fe423f494be1d96ccc" - integrity sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw== - -chokidar@^3.5.3, chokidar@^3.6.0: +chokidar@^3.5.3: version "3.6.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== @@ -6672,7 +5161,7 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: inherits "^2.0.1" safe-buffer "^5.0.1" -cjs-module-lexer@^1.0.0, cjs-module-lexer@^1.2.3: +cjs-module-lexer@^1.0.0: version "1.4.1" resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz#707413784dbb3a72aa11c2f2b042a0bef4004170" integrity sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA== @@ -6687,26 +5176,6 @@ cli-boxes@^2.2.1: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== -cli-table3@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.5.1.tgz#0252372d94dfc40dbd8df06005f48f31f656f202" - integrity sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw== - dependencies: - object-assign "^4.1.0" - string-width "^2.1.1" - optionalDependencies: - colors "^1.1.2" - -cli-width@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-4.1.0.tgz#42daac41d3c254ef38ad8ac037672130173691c5" - integrity sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ== - -client-only@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1" - integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA== - cliui@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" @@ -6763,33 +5232,12 @@ color-name@1.1.3: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== -color-name@^1.0.0, color-name@~1.1.4: +color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -color-string@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" - integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== - dependencies: - color-name "^1.0.0" - simple-swizzle "^0.2.2" - -color@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/color/-/color-4.2.3.tgz#d781ecb5e57224ee43ea9627560107c0e0c6463a" - integrity sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A== - dependencies: - color-convert "^2.0.1" - color-string "^1.9.0" - -colors@1.4.0, colors@^1.1.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" - integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== - -combined-stream@^1.0.6, combined-stream@^1.0.8: +combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -6806,26 +5254,6 @@ command-exists@^1.2.8: resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== -command-line-args@^5.1.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.2.1.tgz#c44c32e437a57d7c51157696893c5909e9cec42e" - integrity sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg== - dependencies: - array-back "^3.1.0" - find-replace "^3.0.0" - lodash.camelcase "^4.3.0" - typical "^4.0.0" - -command-line-usage@^6.1.0: - version "6.1.3" - resolved "https://registry.yarnpkg.com/command-line-usage/-/command-line-usage-6.1.3.tgz#428fa5acde6a838779dfa30e44686f4b6761d957" - integrity sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw== - dependencies: - array-back "^4.0.2" - chalk "^2.4.2" - table-layout "^1.0.2" - typical "^5.2.0" - commander@^13.0.0: version "13.0.0" resolved "https://registry.yarnpkg.com/commander/-/commander-13.0.0.tgz#1b161f60ee3ceb8074583a0f95359a4f8701845c" @@ -6870,16 +5298,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== -concat-stream@^1.6.0, concat-stream@^1.6.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - consola@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/consola/-/consola-3.2.3.tgz#0741857aa88cfa0d6fd53f1cff0375136e98502f" @@ -6946,16 +5364,6 @@ cookie@^0.4.1: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== -cookie@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" - integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== - -cookie@^0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" - integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== - core-js-compat@^3.31.0, core-js-compat@^3.38.0: version "3.39.0" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.39.0.tgz#b12dccb495f2601dc860bdbe7b4e3ffa8ba63f61" @@ -7078,21 +5486,6 @@ cross-spawn@^5.1.0, cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, shebang-command "^2.0.0" which "^2.0.1" -"crypt@>= 0.0.1": - version "0.0.2" - resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" - integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== - -css.escape@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb" - integrity sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg== - -cssesc@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" - integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== - cssom@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" @@ -7110,11 +5503,6 @@ cssstyle@^2.3.0: dependencies: cssom "~0.3.6" -csstype@^3.0.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" - integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== - damerau-levenshtein@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" @@ -7125,11 +5513,6 @@ dargs@^8.0.0: resolved "https://registry.yarnpkg.com/dargs/-/dargs-8.1.0.tgz#a34859ea509cbce45485e5aa356fef70bfcc7272" integrity sha512-wAV9QHOsNbwnWdNW2FYvE1P56wtgSbM+3SZcdGiWQILwVjACCXDCI3Ai8QlCjMDB8YK5zySiXZYBiwGmNY3lnw== -data-uri-to-buffer@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz#d296973d5a4897a5dbe31716d118211921f04770" - integrity sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA== - data-urls@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" @@ -7166,16 +5549,6 @@ data-view-byte-offset@^1.0.0: es-errors "^1.3.0" is-data-view "^1.0.1" -date-fns@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-4.1.0.tgz#64b3d83fff5aa80438f5b1a633c2e83b8a1c2d14" - integrity sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg== - -death@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/death/-/death-1.1.0.tgz#01aa9c401edd92750514470b8266390c66c67318" - integrity sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w== - debug@2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -7225,24 +5598,7 @@ dedent@^1.0.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== -deep-eql@^4.0.1, deep-eql@^4.1.3: - version "4.1.4" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.4.tgz#d0d3912865911bb8fac5afb4e3acfa6a28dc72b7" - integrity sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg== - dependencies: - type-detect "^4.0.0" - -deep-eql@^5.0.1: - version "5.0.2" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-5.0.2.tgz#4b756d8d770a9257300825d52a2c2cff99c3a341" - integrity sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q== - -deep-extend@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - -deep-is@^0.1.3, deep-is@~0.1.3: +deep-is@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== @@ -7277,11 +5633,6 @@ define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1: has-property-descriptors "^1.0.0" object-keys "^1.1.1" -defu@^6.1.4: - version "6.1.4" - resolved "https://registry.yarnpkg.com/defu/-/defu-6.1.4.tgz#4e0c9cf9ff68fe5f3d7f2765cc1a012dfdcb0479" - integrity sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg== - delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -7292,7 +5643,7 @@ depd@2.0.0: resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== -dequal@^2.0.0, dequal@^2.0.3: +dequal@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== @@ -7307,21 +5658,11 @@ detect-indent@^6.0.0: resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== -detect-libc@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" - integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== - detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -devalue@^4.3.0: - version "4.3.3" - resolved "https://registry.yarnpkg.com/devalue/-/devalue-4.3.3.tgz#e35df3bdc49136837e77986f629b9fa6fef50726" - integrity sha512-UH8EL6H2ifcY8TbD2QsxwCC/pr5xSwPvv85LrLXVihmHVC3T3YqTCIwnR5ak0yO1KYqlxrPVOA/JVZJYPy2ATg== - devlop@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/devlop/-/devlop-1.1.0.tgz#4db7c2ca4dc6e0e834c30be70c94bbc976dc7018" @@ -7329,11 +5670,6 @@ devlop@^1.0.0: dependencies: dequal "^2.0.0" -didyoumean@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037" - integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== - diff-sequences@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" @@ -7349,13 +5685,6 @@ diff@^5.2.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== -difflib@^0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/difflib/-/difflib-0.2.4.tgz#b5e30361a6db023176d562892db85940a718f47e" - integrity sha512-9YVwmMb0wQHQNr5J9m6BSj6fk4pfGITGQOOs+D9Fl+INODWFOfvhIU1hNv6GgR1RBoC/9NJcwu77zShxV0kT7w== - dependencies: - heap ">= 0.2.0" - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -7363,11 +5692,6 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -dlv@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/dlv/-/dlv-1.1.3.tgz#5c198a8a11453596e751494d49874bc7732f2e79" - integrity sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA== - docker-compose@^0.24.8: version "0.24.8" resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.24.8.tgz#6c125e6b9e04cf68ced47e2596ef2bb93ee9694e" @@ -7401,16 +5725,6 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" -dom-accessibility-api@^0.5.9: - version "0.5.16" - resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz#5a7429e6066eb3664d911e33fb0e45de8eb08453" - integrity sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg== - -dom-accessibility-api@^0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz#993e925cc1d73f2c662e7d75dd5a5445259a8fd8" - integrity sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w== - domexception@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" @@ -7510,7 +5824,7 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" -enhanced-resolve@^5.15.0, enhanced-resolve@^5.17.1: +enhanced-resolve@^5.17.1: version "5.17.1" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== @@ -7628,11 +5942,6 @@ es-iterator-helpers@^1.1.0: iterator.prototype "^1.1.3" safe-array-concat "^1.1.2" -es-module-lexer@^1.5.4: - version "1.5.4" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" - integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== - es-object-atoms@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.0.0.tgz#ddb55cd47ac2e240701260bc2a8e31ecb643d941" @@ -7670,63 +5979,6 @@ es6-error@^4.0.1: resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d" integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg== -esbuild@0.17.19: - version "0.17.19" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955" - integrity sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw== - optionalDependencies: - "@esbuild/android-arm" "0.17.19" - "@esbuild/android-arm64" "0.17.19" - "@esbuild/android-x64" "0.17.19" - "@esbuild/darwin-arm64" "0.17.19" - "@esbuild/darwin-x64" "0.17.19" - "@esbuild/freebsd-arm64" "0.17.19" - "@esbuild/freebsd-x64" "0.17.19" - "@esbuild/linux-arm" "0.17.19" - "@esbuild/linux-arm64" "0.17.19" - "@esbuild/linux-ia32" "0.17.19" - "@esbuild/linux-loong64" "0.17.19" - "@esbuild/linux-mips64el" "0.17.19" - "@esbuild/linux-ppc64" "0.17.19" - "@esbuild/linux-riscv64" "0.17.19" - "@esbuild/linux-s390x" "0.17.19" - "@esbuild/linux-x64" "0.17.19" - "@esbuild/netbsd-x64" "0.17.19" - "@esbuild/openbsd-x64" "0.17.19" - "@esbuild/sunos-x64" "0.17.19" - "@esbuild/win32-arm64" "0.17.19" - "@esbuild/win32-ia32" "0.17.19" - "@esbuild/win32-x64" "0.17.19" - -esbuild@^0.21.3: - version "0.21.5" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.5.tgz#9ca301b120922959b766360d8ac830da0d02997d" - integrity sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw== - optionalDependencies: - "@esbuild/aix-ppc64" "0.21.5" - "@esbuild/android-arm" "0.21.5" - "@esbuild/android-arm64" "0.21.5" - "@esbuild/android-x64" "0.21.5" - "@esbuild/darwin-arm64" "0.21.5" - "@esbuild/darwin-x64" "0.21.5" - "@esbuild/freebsd-arm64" "0.21.5" - "@esbuild/freebsd-x64" "0.21.5" - "@esbuild/linux-arm" "0.21.5" - "@esbuild/linux-arm64" "0.21.5" - "@esbuild/linux-ia32" "0.21.5" - "@esbuild/linux-loong64" "0.21.5" - "@esbuild/linux-mips64el" "0.21.5" - "@esbuild/linux-ppc64" "0.21.5" - "@esbuild/linux-riscv64" "0.21.5" - "@esbuild/linux-s390x" "0.21.5" - "@esbuild/linux-x64" "0.21.5" - "@esbuild/netbsd-x64" "0.21.5" - "@esbuild/openbsd-x64" "0.21.5" - "@esbuild/sunos-x64" "0.21.5" - "@esbuild/win32-arm64" "0.21.5" - "@esbuild/win32-ia32" "0.21.5" - "@esbuild/win32-x64" "0.21.5" - esbuild@^0.24.0: version "0.24.0" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.24.0.tgz#f2d470596885fcb2e91c21eb3da3b3c89c0b55e7" @@ -7782,18 +6034,6 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -escodegen@1.8.x: - version "1.8.1" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" - integrity sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A== - dependencies: - esprima "^2.7.1" - estraverse "^1.9.1" - esutils "^2.0.2" - optionator "^0.8.1" - optionalDependencies: - source-map "~0.2.0" - escodegen@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" @@ -7812,22 +6052,6 @@ eslint-compat-utils@^0.5.1: dependencies: semver "^7.5.4" -eslint-config-next@15.0.2: - version "15.0.2" - resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-15.0.2.tgz#b06ce97f88a4a0a82cbf3d353359ff5680d01f67" - integrity sha512-N8o6cyUXzlMmQbdc2Kc83g1qomFi3ITqrAZfubipVKET2uR2mCStyGRcx/r8WiAIVMul2KfwRiCHBkTpBvGBmA== - dependencies: - "@next/eslint-plugin-next" "15.0.2" - "@rushstack/eslint-patch" "^1.10.3" - "@typescript-eslint/eslint-plugin" "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0" - "@typescript-eslint/parser" "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0" - eslint-import-resolver-node "^0.3.6" - eslint-import-resolver-typescript "^3.5.2" - eslint-plugin-import "^2.31.0" - eslint-plugin-jsx-a11y "^6.10.0" - eslint-plugin-react "^7.35.0" - eslint-plugin-react-hooks "^5.0.0" - eslint-config-prettier@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" @@ -7860,7 +6084,7 @@ eslint-formatter-pretty@^4.1.0: string-width "^4.2.0" supports-hyperlinks "^2.0.0" -eslint-import-resolver-node@^0.3.6, eslint-import-resolver-node@^0.3.9: +eslint-import-resolver-node@^0.3.9: version "0.3.9" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" integrity sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g== @@ -7869,21 +6093,7 @@ eslint-import-resolver-node@^0.3.6, eslint-import-resolver-node@^0.3.9: is-core-module "^2.13.0" resolve "^1.22.4" -eslint-import-resolver-typescript@^3.5.2: - version "3.6.3" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.3.tgz#bb8e388f6afc0f940ce5d2c5fd4a3d147f038d9e" - integrity sha512-ud9aw4szY9cCT1EWWdGv1L1XR6hh2PaRWif0j2QjQ0pgTY/69iw+W0Z4qZv5wHahOl8isEr+k/JnyAqNQkLkIA== - dependencies: - "@nolyfill/is-core-module" "1.0.39" - debug "^4.3.5" - enhanced-resolve "^5.15.0" - eslint-module-utils "^2.8.1" - fast-glob "^3.3.2" - get-tsconfig "^4.7.5" - is-bun-module "^1.0.2" - is-glob "^4.0.3" - -eslint-module-utils@^2.12.0, eslint-module-utils@^2.8.1: +eslint-module-utils@^2.12.0: version "2.12.0" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz#fe4cfb948d61f49203d7b08871982b65b9af0b0b" integrity sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg== @@ -7924,7 +6134,7 @@ eslint-plugin-import@^2.29.1, eslint-plugin-import@^2.31.0: string.prototype.trimend "^1.0.8" tsconfig-paths "^3.15.0" -eslint-plugin-jsx-a11y@^6.10.0, eslint-plugin-jsx-a11y@^6.8.0: +eslint-plugin-jsx-a11y@^6.8.0: version "6.10.2" resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.10.2.tgz#d2812bb23bf1ab4665f1718ea442e8372e638483" integrity sha512-scB3nz4WmG75pV8+3eRUQOHZlNSUhFNq37xnpgRkCCELU3XMvXAxLk1eqWWyE22Ki4Q01Fnsw9BA3cJHDPgn2Q== @@ -7982,16 +6192,6 @@ eslint-plugin-react-hooks@4.6.0: resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g== -eslint-plugin-react-hooks@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.0.0.tgz#72e2eefbac4b694f5324154619fee44f5f60f101" - integrity sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw== - -eslint-plugin-react-refresh@^0.4.16: - version "0.4.16" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.16.tgz#149dbc9279bd16942409f1c1d2f0dce3299430ef" - integrity sha512-slterMlxAhov/DZO8NScf6mEeMBBXodFUolijDvrtTxyezyLoTQaa73FyYus/VbTdftd8wBgBxPMRk3poleXNQ== - eslint-plugin-react@^7.35.0: version "7.37.2" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.37.2.tgz#cd0935987876ba2900df2f58339f6d92305acc7a" @@ -8081,14 +6281,6 @@ eslint-scope@^7.1.1: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-scope@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.1.0.tgz#70214a174d4cbffbc3e8a26911d8bf51b9ae9d30" - integrity sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw== - dependencies: - esrecurse "^4.3.0" - estraverse "^5.2.0" - eslint-scope@^8.2.0: version "8.2.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.2.0.tgz#377aa6f1cb5dc7592cfd0b7f892fd0cf352ce442" @@ -8107,57 +6299,11 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint-visitor-keys@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz#1f785cc5e81eb7534523d85922248232077d2f8c" - integrity sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg== - eslint-visitor-keys@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz#687bacb2af884fcdda8a6e7d65c606f46a14cd45" integrity sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw== -eslint@^9.13.0: - version "9.13.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.13.0.tgz#7659014b7dda1ff876ecbd990f726e11c61596e6" - integrity sha512-EYZK6SX6zjFHST/HRytOdA/zE72Cq/bfw45LSyuwrdvcclb/gqV8RRQxywOBEWO2+WDpva6UZa4CcDeJKzUCFA== - dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.11.0" - "@eslint/config-array" "^0.18.0" - "@eslint/core" "^0.7.0" - "@eslint/eslintrc" "^3.1.0" - "@eslint/js" "9.13.0" - "@eslint/plugin-kit" "^0.2.0" - "@humanfs/node" "^0.16.5" - "@humanwhocodes/module-importer" "^1.0.1" - "@humanwhocodes/retry" "^0.3.1" - "@types/estree" "^1.0.6" - "@types/json-schema" "^7.0.15" - ajv "^6.12.4" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.3.2" - escape-string-regexp "^4.0.0" - eslint-scope "^8.1.0" - eslint-visitor-keys "^4.1.0" - espree "^10.2.0" - esquery "^1.5.0" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^8.0.0" - find-up "^5.0.0" - glob-parent "^6.0.2" - ignore "^5.2.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - json-stable-stringify-without-jsonify "^1.0.1" - lodash.merge "^4.6.2" - minimatch "^3.1.2" - natural-compare "^1.4.0" - optionator "^0.9.3" - text-table "^0.2.0" - eslint@^9.14.0: version "9.14.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.14.0.tgz#534180a97c00af08bcf2b60b0ebf0c4d6c1b2c95" @@ -8199,7 +6345,7 @@ eslint@^9.14.0: optionator "^0.9.3" text-table "^0.2.0" -espree@^10.0.1, espree@^10.2.0, espree@^10.3.0: +espree@^10.0.1, 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== @@ -8217,11 +6363,6 @@ espree@^9.3.1: acorn-jsx "^5.3.2" eslint-visitor-keys "^3.4.1" -esprima@2.7.x, esprima@^2.7.1: - version "2.7.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" - integrity sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A== - esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" @@ -8241,11 +6382,6 @@ esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" -estraverse@^1.9.1: - version "1.9.3" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" - integrity sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA== - estraverse@^4.1.1: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" @@ -8256,18 +6392,6 @@ estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== -estree-walker@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" - integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== - -estree-walker@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-3.0.3.tgz#67c3e549ec402a487b4fc193d1953a524752340d" - integrity sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g== - dependencies: - "@types/estree" "^1.0.0" - esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -8278,32 +6402,6 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== -eth-gas-reporter@^0.2.25: - version "0.2.27" - resolved "https://registry.yarnpkg.com/eth-gas-reporter/-/eth-gas-reporter-0.2.27.tgz#928de8548a674ed64c7ba0bf5795e63079150d4e" - integrity sha512-femhvoAM7wL0GcI8ozTdxfuBtBFJ9qsyIAsmKVjlWAHUbdnnXHt+lKzz/kmldM5lA9jLuNHGwuIxorNpLbR1Zw== - dependencies: - "@solidity-parser/parser" "^0.14.0" - axios "^1.5.1" - cli-table3 "^0.5.0" - colors "1.4.0" - ethereum-cryptography "^1.0.3" - ethers "^5.7.2" - fs-readdir-recursive "^1.1.0" - lodash "^4.17.14" - markdown-table "^1.1.3" - mocha "^10.2.0" - req-cwd "^2.0.0" - sha1 "^1.1.1" - sync-request "^6.0.0" - -ethereum-bloom-filters@^1.0.6: - version "1.2.0" - resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.2.0.tgz#8294f074c1a6cbd32c39d2cc77ce86ff14797dab" - integrity sha512-28hyiE7HVsWubqhpVLVmZXFd4ITeHi+BUu05o9isf0GUpMtzBUi+8/gFrGaGYzvGAJQmJ3JKj77Mk9G98T84rA== - dependencies: - "@noble/hashes" "^1.4.0" - ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -8335,16 +6433,6 @@ ethereum-cryptography@^1.0.3: "@scure/bip32" "1.1.5" "@scure/bip39" "1.1.1" -ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz#58f2810f8e020aecb97de8c8c76147600b0b8ccf" - integrity sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg== - dependencies: - "@noble/curves" "1.4.2" - "@noble/hashes" "1.4.0" - "@scure/bip32" "1.4.0" - "@scure/bip39" "1.3.0" - ethereumjs-abi@^0.6.8: version "0.6.8" resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz#71bc152db099f70e62f108b7cdfca1b362c6fcae" @@ -8366,17 +6454,6 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: ethjs-util "0.1.6" rlp "^2.2.3" -ethereumjs-util@^7.1.4: - version "7.1.5" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" - integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== - dependencies: - "@types/bn.js" "^5.1.0" - bn.js "^5.1.2" - create-hash "^1.1.2" - ethereum-cryptography "^0.1.3" - rlp "^2.2.4" - ethers@6.13.5, ethers@^6.9.0: version "6.13.5" resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.5.tgz#8c1d6ac988ac08abc3c1d8fabbd4b8b602851ac4" @@ -8390,50 +6467,6 @@ ethers@6.13.5, ethers@^6.9.0: tslib "2.7.0" ws "8.17.1" -ethers@^5.7.2: - version "5.7.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" - integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== - dependencies: - "@ethersproject/abi" "5.7.0" - "@ethersproject/abstract-provider" "5.7.0" - "@ethersproject/abstract-signer" "5.7.0" - "@ethersproject/address" "5.7.0" - "@ethersproject/base64" "5.7.0" - "@ethersproject/basex" "5.7.0" - "@ethersproject/bignumber" "5.7.0" - "@ethersproject/bytes" "5.7.0" - "@ethersproject/constants" "5.7.0" - "@ethersproject/contracts" "5.7.0" - "@ethersproject/hash" "5.7.0" - "@ethersproject/hdnode" "5.7.0" - "@ethersproject/json-wallets" "5.7.0" - "@ethersproject/keccak256" "5.7.0" - "@ethersproject/logger" "5.7.0" - "@ethersproject/networks" "5.7.1" - "@ethersproject/pbkdf2" "5.7.0" - "@ethersproject/properties" "5.7.0" - "@ethersproject/providers" "5.7.2" - "@ethersproject/random" "5.7.0" - "@ethersproject/rlp" "5.7.0" - "@ethersproject/sha2" "5.7.0" - "@ethersproject/signing-key" "5.7.0" - "@ethersproject/solidity" "5.7.0" - "@ethersproject/strings" "5.7.0" - "@ethersproject/transactions" "5.7.0" - "@ethersproject/units" "5.7.0" - "@ethersproject/wallet" "5.7.0" - "@ethersproject/web" "5.7.1" - "@ethersproject/wordlists" "5.7.0" - -ethjs-unit@0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" - integrity sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw== - dependencies: - bn.js "4.11.6" - number-to-bn "1.7.0" - ethjs-util@0.1.6, ethjs-util@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" @@ -8480,22 +6513,12 @@ execa@^5.0.0: signal-exit "^3.0.3" strip-final-newline "^2.0.0" -exit-hook@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-2.2.1.tgz#007b2d92c6428eda2b76e7016a34351586934593" - integrity sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw== - exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expect-type@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/expect-type/-/expect-type-1.1.0.tgz#a146e414250d13dfc49eafcfd1344a4060fa4c75" - integrity sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA== - -expect@^29.0.0, expect@^29.7.0: +expect@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== @@ -8572,18 +6595,7 @@ fast-fifo@^1.2.0, fast-fifo@^1.3.2: resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== -fast-glob@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" - integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-glob@^3.0.3, fast-glob@^3.2.9, fast-glob@^3.3.2: +fast-glob@^3.2.9, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -8599,7 +6611,7 @@ fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-sta resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== @@ -8678,13 +6690,6 @@ find-cache-dir@^3.2.0: make-dir "^3.0.2" pkg-dir "^4.1.0" -find-replace@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38" - integrity sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ== - dependencies: - array-back "^3.0.1" - find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" @@ -8735,7 +6740,7 @@ flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== -follow-redirects@^1.12.1, follow-redirects@^1.15.6: +follow-redirects@^1.12.1: version "1.15.9" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== @@ -8763,15 +6768,6 @@ foreground-child@^3.1.0, foreground-child@^3.3.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" -form-data@^2.2.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" - integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -8796,11 +6792,6 @@ fp-ts@^1.0.0: resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-1.19.5.tgz#3da865e585dfa1fdfd51785417357ac50afc520a" integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== -fraction.js@^4.3.7: - version "4.3.7" - resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7" - integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew== - fresh@0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" @@ -8825,7 +6816,7 @@ fs-extra@^11.2.0: jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^7.0.0, fs-extra@^7.0.1: +fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -8843,32 +6834,12 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" - integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== - dependencies: - at-least-node "^1.0.0" - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - -fs-readdir-recursive@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" - integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -fsevents@^2.3.2, fsevents@~2.3.2, fsevents@~2.3.3: +fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -8908,11 +6879,6 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-func-name@^2.0.1, get-func-name@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" - integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== - get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" @@ -8929,24 +6895,11 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-port@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc" - integrity sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg== - get-port@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193" integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ== -get-source@^2.0.12: - version "2.0.12" - resolved "https://registry.yarnpkg.com/get-source/-/get-source-2.0.12.tgz#0b47d57ea1e53ce0d3a69f4f3d277eb8047da944" - integrity sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w== - dependencies: - data-uri-to-buffer "^2.0.0" - source-map "^0.6.1" - get-stream@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" @@ -8961,21 +6914,13 @@ get-symbol-description@^1.0.2: es-errors "^1.3.0" get-intrinsic "^1.2.4" -get-tsconfig@^4.7.5, get-tsconfig@^4.8.1: +get-tsconfig@^4.8.1: version "4.8.1" resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.8.1.tgz#8995eb391ae6e1638d251118c7b56de7eb425471" integrity sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg== dependencies: resolve-pkg-maps "^1.0.0" -ghost-testrpc@^0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/ghost-testrpc/-/ghost-testrpc-0.0.2.tgz#c4de9557b1d1ae7b2d20bbe474a91378ca90ce92" - integrity sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ== - dependencies: - chalk "^2.4.2" - node-emoji "^1.10.0" - git-raw-commits@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-4.0.0.tgz#b212fd2bff9726d27c1283a1157e829490593285" @@ -8999,23 +6944,6 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob-to-regexp@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== - -glob@7.1.7: - version "7.1.7" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" - integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" @@ -9040,18 +6968,7 @@ glob@^10.0.0, glob@^10.3.10, glob@^10.4.2: package-json-from-dist "^1.0.0" path-scurry "^1.11.1" -glob@^5.0.15: - version "5.0.15" - resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" - integrity sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA== - dependencies: - inflight "^1.0.4" - inherits "2" - minimatch "2 || 3" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.0.0, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -9081,22 +6998,6 @@ global-directory@^4.0.1: dependencies: ini "4.1.1" -global-modules@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" - integrity sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A== - dependencies: - global-prefix "^3.0.0" - -global-prefix@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-3.0.0.tgz#fc85f73064df69f50421f47f883fe5b913ba9b97" - integrity sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg== - dependencies: - ini "^1.3.5" - kind-of "^6.0.2" - which "^1.3.1" - globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" @@ -9120,20 +7021,6 @@ globalthis@^1.0.3, globalthis@^1.0.4: define-properties "^1.2.1" gopd "^1.0.1" -globby@^10.0.1: - version "10.0.2" - resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.2.tgz#277593e745acaa4646c3ab411289ec47a0392543" - integrity sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg== - dependencies: - "@types/glob" "^7.1.1" - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.0.3" - glob "^7.1.3" - ignore "^5.1.1" - merge2 "^1.2.3" - slash "^3.0.0" - globby@^11.0.0, globby@^11.0.1, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" @@ -9163,37 +7050,11 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -graphql@^16.8.1: - version "16.9.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.9.0.tgz#1c310e63f16a49ce1fbb230bd0a000e99f6f115f" - integrity sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw== - -handlebars@^4.0.1: - version "4.7.8" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" - integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== - dependencies: - minimist "^1.2.5" - neo-async "^2.6.2" - source-map "^0.6.1" - wordwrap "^1.0.0" - optionalDependencies: - uglify-js "^3.1.4" - hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== -hardhat-gas-reporter@^1.0.8: - version "1.0.10" - resolved "https://registry.yarnpkg.com/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.10.tgz#ebe5bda5334b5def312747580cd923c2b09aef1b" - integrity sha512-02N4+So/fZrzJ88ci54GqwVA3Zrf0C9duuTyGt0CFRIh/CdNwbnTgkXkRfojOMLBQ+6t+lBIkgbsOtqMvNwikA== - dependencies: - array-uniq "1.0.3" - eth-gas-reporter "^0.2.25" - sha1 "^1.1.1" - hardhat@^2.22.15: version "2.22.15" resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.15.tgz#319b4948f875968fde3f0d09a7edfe74e16b1365" @@ -9249,11 +7110,6 @@ has-bigints@^1.0.1, has-bigints@^1.0.2: resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== -has-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" - integrity sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA== - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -9357,16 +7213,6 @@ he@^1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -headers-polyfill@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.3.tgz#922a0155de30ecc1f785bcf04be77844ca95ad07" - integrity sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ== - -"heap@>= 0.2.0": - version "0.2.7" - resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.7.tgz#1e6adf711d3f27ce35a81fe3b7bd576c2260a8fc" - integrity sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg== - hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -9405,16 +7251,6 @@ html-void-elements@^3.0.0: resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-3.0.0.tgz#fc9dbd84af9e747249034d4d62602def6517f1d7" integrity sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg== -http-basic@^8.1.1: - version "8.1.3" - resolved "https://registry.yarnpkg.com/http-basic/-/http-basic-8.1.3.tgz#a7cabee7526869b9b710136970805b1004261bbf" - integrity sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw== - dependencies: - caseless "^0.12.0" - concat-stream "^1.6.2" - http-response-object "^3.0.1" - parse-cache-control "^1.0.1" - http-errors@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" @@ -9435,13 +7271,6 @@ http-proxy-agent@^5.0.0: agent-base "6" debug "4" -http-response-object@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/http-response-object/-/http-response-object-3.0.2.tgz#7f435bb210454e4360d074ef1f989d5ea8aa9810" - integrity sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA== - dependencies: - "@types/node" "^10.0.3" - https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" @@ -9484,7 +7313,7 @@ ieee754@^1.1.13, ieee754@^1.2.1: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^5.1.1, ignore@^5.2.0, ignore@^5.3.1, ignore@^5.3.2: +ignore@^5.2.0, ignore@^5.3.1, ignore@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== @@ -9543,16 +7372,6 @@ ini@4.1.1: resolved "https://registry.yarnpkg.com/ini/-/ini-4.1.1.tgz#d95b3d843b1e906e56d6747d5447904ff50ce7a1" integrity sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g== -ini@^1.3.5: - version "1.3.8" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" - integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== - -install@^0.13.0: - version "0.13.0" - resolved "https://registry.yarnpkg.com/install/-/install-0.13.0.tgz#6af6e9da9dd0987de2ab420f78e60d9c17260776" - integrity sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA== - internal-slot@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.7.tgz#c06dcca3ed874249881007b0a5523b172a190802" @@ -9562,11 +7381,6 @@ internal-slot@^1.0.7: hasown "^2.0.0" side-channel "^1.0.4" -interpret@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" - integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== - io-ts@1.10.4: version "1.10.4" resolved "https://registry.yarnpkg.com/io-ts/-/io-ts-1.10.4.tgz#cd5401b138de88e4f920adbcb7026e2d1967e6e2" @@ -9597,11 +7411,6 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== -is-arrayish@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" - integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== - is-async-function@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-async-function/-/is-async-function-2.0.0.tgz#8e4418efd3e5d3a6ebb0164c05ef5afb69aa9646" @@ -9631,13 +7440,6 @@ is-boolean-object@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-bun-module@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-bun-module/-/is-bun-module-1.2.1.tgz#495e706f42e29f086fd5fe1ac3c51f106062b9fc" - integrity sha512-AmidtEM6D6NmUiLOvvU7+IePxjEjOzra2h0pSrsfSAcXwl/83zLLXDByafUJy9k/rKK0pvXMLdwKwGHlX2Ke6Q== - dependencies: - semver "^7.6.3" - is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" @@ -9676,11 +7478,6 @@ is-finalizationregistry@^1.0.2: dependencies: call-bind "^1.0.2" -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w== - is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -9720,11 +7517,6 @@ is-negative-zero@^2.0.3: resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747" integrity sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw== -is-node-process@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-node-process/-/is-node-process-1.2.0.tgz#ea02a1b90ddb3934a19aea414e88edef7e11d134" - integrity sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw== - is-number-object@^1.0.4: version "1.0.7" resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" @@ -9960,11 +7752,6 @@ iterator.prototype@^1.1.3: reflect.getprototypeof "^1.0.4" set-function-name "^2.0.1" -itty-time@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/itty-time/-/itty-time-1.0.6.tgz#a6eeda619f19d2f4c480ceddd013b93acb05714d" - integrity sha512-+P8IZaLLBtFv8hCkIjcymZOp4UJ+xW6bSlQsXGqrkmJh7vSiMFSlNne0mCYagEE0N7HDNR5jJBRxwN0oYv61Rw== - jackspeak@^3.1.2: version "3.4.3" resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" @@ -10379,11 +8166,6 @@ jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" -jiti@^1.21.6: - version "1.21.6" - resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.6.tgz#6c7f7398dd4b3142767f9a168af2f317a428d268" - integrity sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w== - jiti@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/jiti/-/jiti-2.4.2.tgz#d19b7732ebb6116b06e2038da74a55366faef560" @@ -10399,7 +8181,7 @@ js-sha3@0.5.7: resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g== -js-sha3@0.8.0, js-sha3@^0.8.0: +js-sha3@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== @@ -10409,7 +8191,7 @@ js-sha3@0.8.0, js-sha3@^0.8.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.x, js-yaml@^3.13.1, js-yaml@^3.6.1: +js-yaml@^3.13.1, js-yaml@^3.6.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -10524,11 +8306,6 @@ jsonparse@^1.2.0: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== -jsonschema@^1.2.4: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.4.1.tgz#cc4c3f0077fb4542982973d8a083b6b34f482dab" - integrity sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ== - "jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.3.5: version "3.3.5" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz#4766bd05a8e2a11af222becd19e15575e52a853a" @@ -10555,7 +8332,7 @@ keyv@^4.5.4: dependencies: json-buffer "3.0.1" -kind-of@^6.0.2, kind-of@^6.0.3: +kind-of@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== @@ -10597,15 +8374,7 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" -levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA== - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -lilconfig@^3.0.0, lilconfig@^3.1.1, lilconfig@^3.1.3: +lilconfig@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.3.tgz#a1bcfd6257f9585bf5ae14ceeebb7b559025e4c4" integrity sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw== @@ -10661,11 +8430,6 @@ lodash.camelcase@^4.3.0: resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA== -lodash.clonedeep@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" - integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== - lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -10721,11 +8485,6 @@ lodash.startcase@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.startcase/-/lodash.startcase-4.4.0.tgz#9436e34ed26093ed7ffae1936144350915d9add8" integrity sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg== -lodash.truncate@^4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" - integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== - lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" @@ -10736,7 +8495,7 @@ lodash.upperfirst@^4.3.1: resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" integrity sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg== -lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.21: +lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -10749,25 +8508,13 @@ log-symbols@^4.0.0, log-symbols@^4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" -loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: js-tokens "^3.0.0 || ^4.0.0" -loupe@^2.3.6: - version "2.3.7" - resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.7.tgz#6e69b7d4db7d3ab436328013d37d1c8c3540c697" - integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA== - dependencies: - get-func-name "^2.0.1" - -loupe@^3.1.0, loupe@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/loupe/-/loupe-3.1.2.tgz#c86e0696804a02218f2206124c45d8b15291a240" - integrity sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg== - lru-cache@^10.2.0: version "10.4.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" @@ -10797,25 +8544,6 @@ lunr@^2.3.9: resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== -lz-string@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941" - integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ== - -magic-string@^0.25.3: - version "0.25.9" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" - integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ== - dependencies: - sourcemap-codec "^1.4.8" - -magic-string@^0.30.12: - version "0.30.12" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.12.tgz#9eb11c9d072b9bcb4940a5b2c2e1a217e4ee1a60" - integrity sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw== - dependencies: - "@jridgewell/sourcemap-codec" "^1.5.0" - make-dir@^3.0.0, make-dir@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -10864,11 +8592,6 @@ markdown-it@^14.1.0: punycode.js "^2.3.1" uc.micro "^2.1.0" -markdown-table@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.3.tgz#9fcb69bcfdb8717bfd0398c6ec2d93036ef8de60" - integrity sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q== - md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -10941,7 +8664,7 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1: +merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== @@ -10951,11 +8674,6 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== -micro-ftch@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" - integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== - micromark-util-character@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-2.1.0.tgz#31320ace16b4644316f6bf057531689c71e2aee1" @@ -10988,7 +8706,7 @@ micromark-util-types@^2.0.0: resolved "https://registry.yarnpkg.com/micromark-util-types/-/micromark-util-types-2.0.0.tgz#63b4b7ffeb35d3ecf50d1ca20e68fc7caa36d95e" integrity sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w== -micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.8: +micromatch@^4.0.2, micromatch@^4.0.4: version "4.0.8" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== @@ -11013,11 +8731,6 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mime@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-3.0.0.tgz#b374550dca3a0c18443b0c950a6a58f1931cf7a7" - integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== - mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -11028,24 +8741,6 @@ min-indent@^1.0.0: resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== -miniflare@3.20241106.2: - version "3.20241106.2" - resolved "https://registry.yarnpkg.com/miniflare/-/miniflare-3.20241106.2.tgz#4e046a9ee9e09e0d5ba9bbab84572a9a4b216cc4" - integrity sha512-40JAPtNFMFrSW41CSxPgDykX4CgDokDfTZgDYYL8dsODb7pdAlj/dvlDPnaonkyXjRO7svyDwAavQT6IdagMwA== - dependencies: - "@cspotcode/source-map-support" "0.8.1" - acorn "^8.8.0" - acorn-walk "^8.2.0" - capnp-ts "^0.7.0" - exit-hook "^2.2.1" - glob-to-regexp "^0.4.1" - stoppable "^1.1.0" - undici "^5.28.4" - workerd "1.20241106.2" - ws "^8.18.0" - youch "^3.2.2" - zod "^3.22.3" - minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -11056,13 +8751,6 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -"minimatch@2 || 3", minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - minimatch@9.0.3: version "9.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" @@ -11070,6 +8758,13 @@ minimatch@9.0.3: dependencies: brace-expansion "^2.0.1" +minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + minimatch@^5.0.1, minimatch@^5.1.0, minimatch@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" @@ -11093,7 +8788,7 @@ minimist-options@4.1.0: is-plain-obj "^1.1.0" kind-of "^6.0.3" -minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6, minimist@^1.2.8: +minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -11108,13 +8803,6 @@ mkdirp-classic@^0.5.2: resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== -mkdirp@0.5.x: - version "0.5.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" @@ -11127,7 +8815,7 @@ mnemonist@^0.38.0: dependencies: obliterator "^2.0.0" -mocha@^10.0.0, mocha@^10.2.0: +mocha@^10.0.0: version "10.7.3" resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752" integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A== @@ -11158,11 +8846,6 @@ mri@^1.2.0: resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== -mrmime@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/mrmime/-/mrmime-2.0.0.tgz#151082a6e06e59a9a39b46b3e14d5cfe92b3abb4" - integrity sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw== - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -11173,40 +8856,6 @@ ms@2.1.3, ms@^2.1.1, ms@^2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -msw@^2.6.4: - version "2.6.5" - resolved "https://registry.yarnpkg.com/msw/-/msw-2.6.5.tgz#0d4ec95e6170aff26fcb0734ec1258c1e2bb617d" - integrity sha512-PnlnTpUlOrj441kYQzzFhzMzMCGFT6a2jKUBG7zSpLkYS5oh8Arrbc0dL8/rNAtxaoBy0EVs2mFqj2qdmWK7lQ== - dependencies: - "@bundled-es-modules/cookie" "^2.0.1" - "@bundled-es-modules/statuses" "^1.0.1" - "@bundled-es-modules/tough-cookie" "^0.1.6" - "@inquirer/confirm" "^5.0.0" - "@mswjs/interceptors" "^0.37.0" - "@open-draft/deferred-promise" "^2.2.0" - "@open-draft/until" "^2.1.0" - "@types/cookie" "^0.6.0" - "@types/statuses" "^2.0.4" - chalk "^4.1.2" - graphql "^16.8.1" - headers-polyfill "^4.0.2" - is-node-process "^1.2.0" - outvariant "^1.4.3" - path-to-regexp "^6.3.0" - strict-event-emitter "^0.5.1" - type-fest "^4.26.1" - yargs "^17.7.2" - -mustache@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" - integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== - -mute-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-2.0.0.tgz#a5446fc0c512b71c83c44d908d5c7b7b4c493b2b" - integrity sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA== - mz@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -11221,11 +8870,6 @@ nan@^2.19.0, nan@^2.20.0: resolved "https://registry.yarnpkg.com/nan/-/nan-2.20.0.tgz#08c5ea813dd54ed16e5bd6505bf42af4f7838ca3" integrity sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw== -nanoid@^3.3.3, nanoid@^3.3.6, nanoid@^3.3.7: - version "3.3.8" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf" - integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -11236,34 +8880,6 @@ negotiator@0.6.3: resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== -neo-async@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" - integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== - -next@15.1.2: - version "15.1.2" - resolved "https://registry.yarnpkg.com/next/-/next-15.1.2.tgz#305d093a9f3d6900b53fa4abb5b213264b22047c" - integrity sha512-nLJDV7peNy+0oHlmY2JZjzMfJ8Aj0/dd3jCwSZS8ZiO5nkQfcZRqDrRN3U5rJtqVTQneIOGZzb6LCNrk7trMCQ== - dependencies: - "@next/env" "15.1.2" - "@swc/counter" "0.1.3" - "@swc/helpers" "0.5.15" - busboy "1.6.0" - caniuse-lite "^1.0.30001579" - postcss "8.4.31" - styled-jsx "5.1.6" - optionalDependencies: - "@next/swc-darwin-arm64" "15.1.2" - "@next/swc-darwin-x64" "15.1.2" - "@next/swc-linux-arm64-gnu" "15.1.2" - "@next/swc-linux-arm64-musl" "15.1.2" - "@next/swc-linux-x64-gnu" "15.1.2" - "@next/swc-linux-x64-musl" "15.1.2" - "@next/swc-win32-arm64-msvc" "15.1.2" - "@next/swc-win32-x64-msvc" "15.1.2" - sharp "^0.33.5" - node-addon-api@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" @@ -11274,13 +8890,6 @@ node-addon-api@^5.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== -node-emoji@^1.10.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c" - integrity sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A== - dependencies: - lodash "^4.17.21" - node-fetch@^2.6.12: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -11288,11 +8897,6 @@ node-fetch@^2.6.12: dependencies: whatwg-url "^5.0.0" -node-forge@^1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" - integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== - node-gyp-build@^4.2.0: version "4.8.2" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.2.tgz#4f802b71c1ab2ca16af830e6c1ea7dd1ad9496fa" @@ -11315,18 +8919,6 @@ node-releases@^2.0.18: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== -nofilter@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-3.1.0.tgz#c757ba68801d41ff930ba2ec55bab52ca184aa66" - integrity sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g== - -nopt@3.x: - version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" - integrity sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg== - dependencies: - abbrev "1" - normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -11352,11 +8944,6 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -normalize-range@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" - integrity sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA== - npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -11364,14 +8951,6 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" -number-to-bn@1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" - integrity sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig== - dependencies: - bn.js "4.11.6" - strip-hex-prefix "1.0.0" - nwsapi@^2.2.2: version "2.2.13" resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.13.tgz#e56b4e98960e7a040e5474536587e599c4ff4655" @@ -11410,16 +8989,11 @@ nyc@^17.1.0: test-exclude "^6.0.0" yargs "^15.0.2" -object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: +object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== -object-hash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" - integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== - object-inspect@^1.13.1: version "1.13.3" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.3.tgz#f14c183de51130243d6d18ae149375ff50ea488a" @@ -11482,11 +9056,6 @@ obliterator@^2.0.0: resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816" integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ== -ohash@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/ohash/-/ohash-1.1.4.tgz#ae8d83014ab81157d2c285abf7792e2995fadd72" - integrity sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g== - on-finished@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -11494,7 +9063,7 @@ on-finished@2.4.1: dependencies: ee-first "1.1.1" -once@1.x, once@^1.3.0, once@^1.3.1, once@^1.4.0: +once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== @@ -11515,18 +9084,6 @@ oniguruma-to-js@0.4.3: dependencies: regex "^4.3.2" -optionator@^0.8.1: - version "0.8.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" - integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.6" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - word-wrap "~1.2.3" - optionator@^0.9.3: version "0.9.4" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" @@ -11539,11 +9096,6 @@ optionator@^0.9.3: type-check "^0.4.0" word-wrap "^1.2.5" -ordinal@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/ordinal/-/ordinal-1.0.3.tgz#1a3c7726a61728112f50944ad7c35c06ae3a0d4d" - integrity sha512-cMddMgb2QElm8G7vdaa02jhUNbTSrhsgAGUz1OokD83uJTwSUn+nKoNoKVVaRa08yF6sgfO7Maou1+bgLd9rdQ== - os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -11554,11 +9106,6 @@ outdent@^0.5.0: resolved "https://registry.yarnpkg.com/outdent/-/outdent-0.5.0.tgz#9e10982fdc41492bb473ad13840d22f9655be2ff" integrity sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q== -outvariant@^1.4.0, outvariant@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.4.3.tgz#221c1bfc093e8fec7075497e7799fdbf43d14873" - integrity sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA== - ox@0.6.5: version "0.6.5" resolved "https://registry.yarnpkg.com/ox/-/ox-0.6.5.tgz#e6506a589bd6af9b5fecfcb2c641b63c9882edb6" @@ -11691,11 +9238,6 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -parse-cache-control@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/parse-cache-control/-/parse-cache-control-1.0.1.tgz#8eeab3e54fa56920fe16ba38f77fa21aacc2d74e" - integrity sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg== - parse-json@^5.0.0, parse-json@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" @@ -11761,31 +9303,11 @@ path-to-regexp@0.1.12: resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7" integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ== -path-to-regexp@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.3.0.tgz#2b6a26a337737a8e1416f9272ed0766b1c0389f4" - integrity sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ== - path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -pathe@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.2.tgz#6c4cb47a945692e48a1ddd6e4094d170516437ec" - integrity sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ== - -pathval@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" - integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== - -pathval@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-2.0.0.tgz#7e2550b422601d4f6b8e26f1301bc8f15a741a25" - integrity sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA== - pbkdf2@^3.0.17: version "3.1.2" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" @@ -11797,7 +9319,7 @@ pbkdf2@^3.0.17: safe-buffer "^5.0.1" sha.js "^2.4.8" -picocolors@^1.0.0, picocolors@^1.0.1, picocolors@^1.1.0, picocolors@^1.1.1: +picocolors@^1.0.0, picocolors@^1.1.0, picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== @@ -11812,11 +9334,6 @@ picomatch@^4.0.2: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== -pify@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== - pify@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" @@ -11834,20 +9351,6 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -playwright-core@1.49.0: - version "1.49.0" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.0.tgz#8e69ffed3f41855b854982f3632f2922c890afcb" - integrity sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA== - -playwright@1.49.0: - version "1.49.0" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.0.tgz#df6b9e05423377a99658202844a294a8afb95d0a" - integrity sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A== - dependencies: - playwright-core "1.49.0" - optionalDependencies: - fsevents "2.3.2" - plur@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/plur/-/plur-4.0.0.tgz#729aedb08f452645fe8c58ef115bf16b0a73ef84" @@ -11860,30 +9363,6 @@ possible-typed-array-names@^1.0.0: resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f" integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q== -postcss-import@^15.1.0: - version "15.1.0" - resolved "https://registry.yarnpkg.com/postcss-import/-/postcss-import-15.1.0.tgz#41c64ed8cc0e23735a9698b3249ffdbf704adc70" - integrity sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew== - dependencies: - postcss-value-parser "^4.0.0" - read-cache "^1.0.0" - resolve "^1.1.7" - -postcss-js@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-4.0.1.tgz#61598186f3703bab052f1c4f7d805f3991bee9d2" - integrity sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw== - dependencies: - camelcase-css "^2.0.1" - -postcss-load-config@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-4.0.2.tgz#7159dcf626118d33e299f485d6afe4aff7c4a3e3" - integrity sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ== - dependencies: - lilconfig "^3.0.0" - yaml "^2.3.4" - postcss-load-config@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-6.0.1.tgz#6fd7dcd8ae89badcf1b2d644489cbabf83aa8096" @@ -11891,54 +9370,11 @@ postcss-load-config@^6.0.1: dependencies: lilconfig "^3.1.1" -postcss-nested@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-6.2.0.tgz#4c2d22ab5f20b9cb61e2c5c5915950784d068131" - integrity sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ== - dependencies: - postcss-selector-parser "^6.1.1" - -postcss-selector-parser@^6.1.1, postcss-selector-parser@^6.1.2: - version "6.1.2" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz#27ecb41fb0e3b6ba7a1ec84fff347f734c7929de" - integrity sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg== - dependencies: - cssesc "^3.0.0" - util-deprecate "^1.0.2" - -postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" - integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== - -postcss@8.4.31: - version "8.4.31" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" - integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== - dependencies: - nanoid "^3.3.6" - picocolors "^1.0.0" - source-map-js "^1.0.2" - -postcss@^8, postcss@^8.4.43, postcss@^8.4.47, postcss@^8.4.49: - version "8.4.49" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.49.tgz#4ea479048ab059ab3ae61d082190fabfd994fe19" - integrity sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA== - dependencies: - nanoid "^3.3.7" - picocolors "^1.1.1" - source-map-js "^1.2.1" - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== - prettier-linter-helpers@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" @@ -11946,7 +9382,7 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.3.1, prettier@^2.7.1: +prettier@^2.7.1: version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== @@ -11956,16 +9392,7 @@ prettier@^3.4.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.1.tgz#e211d451d6452db0a291672ca9154bc8c2579f7b" integrity sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg== -pretty-format@^27.0.2: - version "27.5.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e" - integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ== - dependencies: - ansi-regex "^5.0.1" - ansi-styles "^5.0.0" - react-is "^17.0.1" - -pretty-format@^29.0.0, pretty-format@^29.7.0: +pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== @@ -11974,11 +9401,6 @@ pretty-format@^29.0.0, pretty-format@^29.7.0: ansi-styles "^5.0.0" react-is "^18.0.0" -printable-characters@^1.0.42: - version "1.0.42" - resolved "https://registry.yarnpkg.com/printable-characters/-/printable-characters-1.0.42.tgz#3f18e977a9bd8eb37fcc4ff5659d7be90868b3d8" - integrity sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ== - process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -12001,13 +9423,6 @@ promise-polyfill@^8.1.3: resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.3.0.tgz#9284810268138d103807b11f4e23d5e945a4db63" integrity sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg== -promise@^8.0.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/promise/-/promise-8.3.0.tgz#8cb333d1edeb61ef23869fbb8a4ea0279ab60e0a" - integrity sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg== - dependencies: - asap "~2.0.6" - prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -12054,11 +9469,6 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" -proxy-from-env@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" - integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== - psl@^1.1.33: version "1.9.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" @@ -12099,7 +9509,7 @@ pvutils@^1.1.3: resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3" integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ== -qs@6.13.0, qs@^6.4.0: +qs@6.13.0: version "6.13.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== @@ -12148,63 +9558,16 @@ raw-body@2.5.2, raw-body@^2.4.1: iconv-lite "0.4.24" unpipe "1.0.0" -react-dom@^18, react-dom@^18.3.1: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4" - integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== - dependencies: - loose-envify "^1.1.0" - scheduler "^0.23.2" - react-is@^16.13.1: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react-is@^17.0.1: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" - integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== - react-is@^18.0.0: version "18.3.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== -react-refresh@^0.14.2: - version "0.14.2" - resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9" - integrity sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA== - -react-router-dom@^6.27.0: - version "6.27.0" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.27.0.tgz#8d7972a425fd75f91c1e1ff67e47240c5752dc3f" - integrity sha512-+bvtFWMC0DgAFrfKXKG9Fc+BcXWRUO1aJIihbB79xaeq0v5UzfvnM5houGUm1Y461WVRcgAQ+Clh5rdb1eCx4g== - dependencies: - "@remix-run/router" "1.20.0" - react-router "6.27.0" - -react-router@6.27.0: - version "6.27.0" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.27.0.tgz#db292474926c814c996c0ff3ef0162d1f9f60ed4" - integrity sha512-YA+HGZXz4jaAkVoYBE98VQl+nVzI+cVI2Oj/06F5ZM+0u3TgedN9Y9kmMRo2mnkSK2nCpNQn0DVob4HCsY/WLw== - dependencies: - "@remix-run/router" "1.20.0" - -react@^18, react@^18.3.1: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" - integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== - dependencies: - loose-envify "^1.1.0" - -read-cache@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774" - integrity sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA== - dependencies: - pify "^2.3.0" - read-pkg-up@^7.0.0, read-pkg-up@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" @@ -12234,7 +9597,7 @@ read-yaml-file@^1.1.0: pify "^4.0.1" strip-bom "^3.0.0" -readable-stream@^2.0.5, readable-stream@^2.2.2: +readable-stream@^2.0.5: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -12286,20 +9649,6 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw== - dependencies: - resolve "^1.1.6" - -recursive-readdir@^2.2.2: - version "2.2.3" - resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.3.tgz#e726f328c0d69153bcabd5c322d3195252379372" - integrity sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA== - dependencies: - minimatch "^3.0.5" - redent@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" @@ -12308,11 +9657,6 @@ redent@^3.0.0: indent-string "^4.0.0" strip-indent "^3.0.0" -reduce-flatten@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" - integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w== - refa@^0.12.0, refa@^0.12.1: version "0.12.1" resolved "https://registry.yarnpkg.com/refa/-/refa-0.12.1.tgz#dac13c4782dc22b6bae6cce81a2b863888ea39c6" @@ -12416,20 +9760,6 @@ release-zalgo@^1.0.0: dependencies: es6-error "^4.0.1" -req-cwd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/req-cwd/-/req-cwd-2.0.0.tgz#d4082b4d44598036640fb73ddea01ed53db49ebc" - integrity sha512-ueoIoLo1OfB6b05COxAA9UpeoscNpYyM+BqYlA7H6LVF4hKGPXQQSSaD2YmvDVJMkk4UDpAHIeU1zG53IqjvlQ== - dependencies: - req-from "^2.0.0" - -req-from@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/req-from/-/req-from-2.0.0.tgz#d74188e47f93796f4aa71df6ee35ae689f3e0e70" - integrity sha512-LzTfEVDVQHBRfjOUMgNBA+V6DWsSnoeKzf42J7l0xa/B4jyPOuuF5MlNSmomLNGemWTnV2TIdjSSLnEn95fOQA== - dependencies: - resolve-from "^3.0.0" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -12457,11 +9787,6 @@ resolve-cwd@^3.0.0: dependencies: resolve-from "^5.0.0" -resolve-from@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" - integrity sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw== - resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" @@ -12482,11 +9807,6 @@ resolve.exports@^2.0.0: resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== -resolve@1.1.x: - version "1.1.7" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" - integrity sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg== - resolve@1.17.0: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" @@ -12494,7 +9814,7 @@ resolve@1.17.0: dependencies: path-parse "^1.0.6" -resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.22.4, resolve@^1.22.8: +resolve@^1.10.0, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.22.4: version "1.22.8" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== @@ -12537,37 +9857,14 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rlp@^2.0.0, rlp@^2.2.3, rlp@^2.2.4: +rlp@^2.0.0, rlp@^2.2.3: version "2.2.7" resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== dependencies: bn.js "^5.2.0" -rollup-plugin-inject@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz#e4233855bfba6c0c12a312fd6649dff9a13ee9f4" - integrity sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w== - dependencies: - estree-walker "^0.6.1" - magic-string "^0.25.3" - rollup-pluginutils "^2.8.1" - -rollup-plugin-node-polyfills@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz#53092a2744837164d5b8a28812ba5f3ff61109fd" - integrity sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA== - dependencies: - rollup-plugin-inject "^3.0.0" - -rollup-pluginutils@^2.8.1: - version "2.8.2" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" - integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== - dependencies: - estree-walker "^0.6.1" - -rollup@^4.20.0, rollup@^4.23.0, rollup@^4.24.0: +rollup@^4.24.0: version "4.29.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.29.1.tgz#a9aaaece817e5f778489e5bf82e379cc8a5c05bc" integrity sha512-RaJ45M/kmJUzSWDs1Nnd5DdV4eerC98idtUOVr6FfKcgxqvjwHmxc5upLF9qZU9EpsVzzhleFahrT3shLuJzIw== @@ -12650,39 +9947,12 @@ saxes@^6.0.0: dependencies: xmlchars "^2.2.0" -sc-istanbul@^0.4.5: - version "0.4.6" - resolved "https://registry.yarnpkg.com/sc-istanbul/-/sc-istanbul-0.4.6.tgz#cf6784355ff2076f92d70d59047d71c13703e839" - integrity sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g== - dependencies: - abbrev "1.0.x" - async "1.x" - escodegen "1.8.x" - esprima "2.7.x" - glob "^5.0.15" - handlebars "^4.0.1" - js-yaml "3.x" - mkdirp "0.5.x" - nopt "3.x" - once "1.x" - resolve "1.1.x" - supports-color "^3.1.0" - which "^1.1.1" - wordwrap "^1.0.0" - -scheduler@^0.23.2: - version "0.23.2" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3" - integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== - dependencies: - loose-envify "^1.1.0" - scrypt-js@2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" integrity sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw== -scrypt-js@3.0.1, scrypt-js@^3.0.0: +scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== @@ -12705,14 +9975,6 @@ secp256k1@^4.0.1: node-addon-api "^5.0.0" node-gyp-build "^4.2.0" -selfsigned@^2.0.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-2.4.1.tgz#560d90565442a3ed35b674034cec4e95dceb4ae0" - integrity sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q== - dependencies: - "@types/node-forge" "^1.3.0" - node-forge "^1" - "semver@2 || 3 || 4 || 5", semver@^5.5.0: version "5.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" @@ -12730,7 +9992,7 @@ semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.4, semver@^7.3.6, semver@^7.5.1, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3: +semver@^7.3.4, semver@^7.3.6, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== @@ -12821,43 +10083,6 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" -sha1@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/sha1/-/sha1-1.1.1.tgz#addaa7a93168f393f19eb2b15091618e2700f848" - integrity sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA== - dependencies: - charenc ">= 0.0.1" - crypt ">= 0.0.1" - -sharp@^0.33.5: - version "0.33.5" - resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.5.tgz#13e0e4130cc309d6a9497596715240b2ec0c594e" - integrity sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw== - dependencies: - color "^4.2.3" - detect-libc "^2.0.3" - semver "^7.6.3" - optionalDependencies: - "@img/sharp-darwin-arm64" "0.33.5" - "@img/sharp-darwin-x64" "0.33.5" - "@img/sharp-libvips-darwin-arm64" "1.0.4" - "@img/sharp-libvips-darwin-x64" "1.0.4" - "@img/sharp-libvips-linux-arm" "1.0.5" - "@img/sharp-libvips-linux-arm64" "1.0.4" - "@img/sharp-libvips-linux-s390x" "1.0.4" - "@img/sharp-libvips-linux-x64" "1.0.4" - "@img/sharp-libvips-linuxmusl-arm64" "1.0.4" - "@img/sharp-libvips-linuxmusl-x64" "1.0.4" - "@img/sharp-linux-arm" "0.33.5" - "@img/sharp-linux-arm64" "0.33.5" - "@img/sharp-linux-s390x" "0.33.5" - "@img/sharp-linux-x64" "0.33.5" - "@img/sharp-linuxmusl-arm64" "0.33.5" - "@img/sharp-linuxmusl-x64" "0.33.5" - "@img/sharp-wasm32" "0.33.5" - "@img/sharp-win32-ia32" "0.33.5" - "@img/sharp-win32-x64" "0.33.5" - shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -12870,15 +10095,6 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shelljs@^0.8.3: - version "0.8.5" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" - integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - shiki@^1.16.2: version "1.21.0" resolved "https://registry.yarnpkg.com/shiki/-/shiki-1.21.0.tgz#11debe38d5cc9c4a0e931632de574785c4677039" @@ -12901,37 +10117,16 @@ side-channel@^1.0.4, side-channel@^1.0.6: get-intrinsic "^1.2.4" object-inspect "^1.13.1" -siginfo@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/siginfo/-/siginfo-2.0.0.tgz#32e76c70b79724e3bb567cb9d543eb858ccfaf30" - integrity sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g== - signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.0.1, signal-exit@^4.1.0: +signal-exit@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== -simple-swizzle@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" - integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg== - dependencies: - is-arrayish "^0.3.1" - -sirv@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/sirv/-/sirv-3.0.0.tgz#f8d90fc528f65dff04cb597a88609d4e8a4361ce" - integrity sha512-BPwJGUeDaDCHihkORDchNyyTvWFhcusy1XMmhEVTQTwGeybFbp8YEmB+njbPnth1FibULBSBVwCQni25XlCUDg== - dependencies: - "@polka/url" "^1.0.0-next.24" - mrmime "^2.0.0" - totalist "^3.0.0" - sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" @@ -12942,15 +10137,6 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slice-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" - integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== - dependencies: - ansi-styles "^4.0.0" - astral-regex "^2.0.0" - is-fullwidth-code-point "^3.0.0" - solc@0.8.26: version "0.8.26" resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.26.tgz#afc78078953f6ab3e727c338a2fefcd80dd5b01a" @@ -12964,36 +10150,6 @@ solc@0.8.26: semver "^5.5.0" tmp "0.0.33" -solidity-coverage@^0.8.14: - version "0.8.14" - resolved "https://registry.yarnpkg.com/solidity-coverage/-/solidity-coverage-0.8.14.tgz#db9bfcc10e3bc369fc074b35b267d665bcc6ae2e" - integrity sha512-ItAAObe5GaEOp20kXC2BZRnph+9P7Rtoqg2mQc2SXGEHgSDF2wWd1Wxz3ntzQWXkbCtIIGdJT918HG00cObwbA== - dependencies: - "@ethersproject/abi" "^5.0.9" - "@solidity-parser/parser" "^0.19.0" - chalk "^2.4.2" - death "^1.1.0" - difflib "^0.2.4" - fs-extra "^8.1.0" - ghost-testrpc "^0.0.2" - global-modules "^2.0.0" - globby "^10.0.1" - jsonschema "^1.2.4" - lodash "^4.17.21" - mocha "^10.2.0" - node-emoji "^1.10.0" - pify "^4.0.1" - recursive-readdir "^2.2.2" - sc-istanbul "^0.4.5" - semver "^7.3.4" - shelljs "^0.8.3" - web3-utils "^1.3.6" - -source-map-js@^1.0.2, source-map-js@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" - integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== - source-map-support@0.5.13: version "0.5.13" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" @@ -13022,18 +10178,6 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" - integrity sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA== - dependencies: - amdefine ">=0.0.4" - -sourcemap-codec@^1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" - integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== - space-separated-tokens@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz#1ecd9d2350a3844572c3f4a312bceb018348859f" @@ -13126,11 +10270,6 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" -stackback@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/stackback/-/stackback-0.0.2.tgz#1ac8a0d9483848d1695e418b6d031a3c3ce68e3b" - integrity sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw== - stacktrace-parser@^0.1.10: version "0.1.10" resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz#29fb0cae4e0d0b85155879402857a1639eb6051a" @@ -13138,39 +10277,11 @@ stacktrace-parser@^0.1.10: dependencies: type-fest "^0.7.1" -stacktracey@^2.1.8: - version "2.1.8" - resolved "https://registry.yarnpkg.com/stacktracey/-/stacktracey-2.1.8.tgz#bf9916020738ce3700d1323b32bd2c91ea71199d" - integrity sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw== - dependencies: - as-table "^1.0.36" - get-source "^2.0.12" - -statuses@2.0.1, statuses@^2.0.1: +statuses@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -std-env@^3.7.0: - version "3.7.0" - resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.7.0.tgz#c9f7386ced6ecf13360b6c6c55b8aaa4ef7481d2" - integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg== - -std-env@^3.8.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.8.0.tgz#b56ffc1baf1a29dcc80a3bdf11d7fca7c315e7d5" - integrity sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w== - -stoppable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/stoppable/-/stoppable-1.1.0.tgz#32da568e83ea488b08e4d7ea2c3bcc9d75015d5b" - integrity sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw== - -streamsearch@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" - integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== - streamx@^2.15.0, streamx@^2.20.0: version "2.20.1" resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.20.1.tgz#471c4f8b860f7b696feb83d5b125caab2fdbb93c" @@ -13182,16 +10293,6 @@ streamx@^2.15.0, streamx@^2.20.0: optionalDependencies: bare-events "^2.2.0" -strict-event-emitter@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz#1602ece81c51574ca39c6815e09f1a3e8550bd93" - integrity sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ== - -string-format@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-format/-/string-format-2.0.0.tgz#f2df2e7097440d3b65de31b6d40d54c96eaffb9b" - integrity sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA== - string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -13209,14 +10310,6 @@ string-length@^4.0.1: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -13327,13 +10420,6 @@ stringify-entities@^4.0.0: dependencies: ansi-regex "^5.0.1" -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow== - dependencies: - ansi-regex "^3.0.0" - strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -13387,13 +10473,6 @@ strnum@^1.0.5: resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== -styled-jsx@5.1.6: - version "5.1.6" - resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.6.tgz#83b90c077e6c6a80f7f5e8781d0f311b2fe41499" - integrity sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA== - dependencies: - client-only "0.0.1" - sucrase@^3.35.0: version "3.35.0" resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.35.0.tgz#57f17a3d7e19b36d8995f06679d121be914ae263" @@ -13407,13 +10486,6 @@ sucrase@^3.35.0: pirates "^4.0.1" ts-interface-checker "^0.1.9" -supports-color@^3.1.0: - version "3.2.3" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" - integrity sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A== - dependencies: - has-flag "^1.0.0" - supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -13453,22 +10525,6 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== -sync-request@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/sync-request/-/sync-request-6.1.0.tgz#e96217565b5e50bbffe179868ba75532fb597e68" - integrity sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw== - dependencies: - http-response-object "^3.0.1" - sync-rpc "^1.2.1" - then-request "^6.0.0" - -sync-rpc@^1.2.1: - version "1.3.6" - resolved "https://registry.yarnpkg.com/sync-rpc/-/sync-rpc-1.3.6.tgz#b2e8b2550a12ccbc71df8644810529deb68665a7" - integrity sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw== - dependencies: - get-port "^3.1.0" - synckit@^0.9.1: version "0.9.1" resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.1.tgz#febbfbb6649979450131f64735aa3f6c14575c88" @@ -13477,55 +10533,6 @@ synckit@^0.9.1: "@pkgr/core" "^0.1.0" tslib "^2.6.2" -table-layout@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-1.0.2.tgz#c4038a1853b0136d63365a734b6931cf4fad4a04" - integrity sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A== - dependencies: - array-back "^4.0.1" - deep-extend "~0.6.0" - typical "^5.2.0" - wordwrapjs "^4.0.0" - -table@^6.8.0: - version "6.8.2" - resolved "https://registry.yarnpkg.com/table/-/table-6.8.2.tgz#c5504ccf201213fa227248bdc8c5569716ac6c58" - integrity sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA== - dependencies: - ajv "^8.0.1" - lodash.truncate "^4.4.2" - slice-ansi "^4.0.0" - string-width "^4.2.3" - strip-ansi "^6.0.1" - -tailwindcss@^3.4.17: - version "3.4.17" - resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.17.tgz#ae8406c0f96696a631c790768ff319d46d5e5a63" - integrity sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og== - dependencies: - "@alloc/quick-lru" "^5.2.0" - arg "^5.0.2" - chokidar "^3.6.0" - didyoumean "^1.2.2" - dlv "^1.1.3" - fast-glob "^3.3.2" - glob-parent "^6.0.2" - is-glob "^4.0.3" - jiti "^1.21.6" - lilconfig "^3.1.3" - micromatch "^4.0.8" - normalize-path "^3.0.0" - object-hash "^3.0.0" - picocolors "^1.1.1" - postcss "^8.4.47" - postcss-import "^15.1.0" - postcss-js "^4.0.1" - postcss-load-config "^4.0.2" - postcss-nested "^6.2.0" - postcss-selector-parser "^6.1.2" - resolve "^1.22.8" - sucrase "^3.35.0" - tapable@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" @@ -13624,23 +10631,6 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== -then-request@^6.0.0: - version "6.0.2" - resolved "https://registry.yarnpkg.com/then-request/-/then-request-6.0.2.tgz#ec18dd8b5ca43aaee5cb92f7e4c1630e950d4f0c" - integrity sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA== - dependencies: - "@types/concat-stream" "^1.6.0" - "@types/form-data" "0.0.33" - "@types/node" "^8.0.0" - "@types/qs" "^6.2.31" - caseless "~0.12.0" - concat-stream "^1.6.0" - form-data "^2.2.0" - http-basic "^8.1.1" - http-response-object "^3.0.1" - promise "^8.0.0" - qs "^6.4.0" - thenify-all@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" @@ -13673,11 +10663,6 @@ thor-devkit@^2.0.9: resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== -tinybench@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.9.0.tgz#103c9f8ba6d7237a47ab6dd1dcff77251863426b" - integrity sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg== - tinyexec@^0.3.0, tinyexec@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-0.3.1.tgz#0ab0daf93b43e2c211212396bdb836b468c97c98" @@ -13691,21 +10676,6 @@ tinyglobby@^0.2.9: fdir "^6.4.2" picomatch "^4.0.2" -tinypool@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-1.0.1.tgz#c64233c4fac4304e109a64340178760116dbe1fe" - integrity sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA== - -tinyrainbow@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/tinyrainbow/-/tinyrainbow-1.2.0.tgz#5c57d2fc0fb3d1afd78465c33ca885d04f02abb5" - integrity sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ== - -tinyspy@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-3.0.2.tgz#86dd3cf3d737b15adcf17d7887c84a75201df20a" - integrity sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q== - tmp@0.0.33, tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -13740,12 +10710,7 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -totalist@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/totalist/-/totalist-3.0.1.tgz#ba3a3d600c915b1a97872348f79c127475f6acf8" - integrity sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ== - -tough-cookie@^4.1.2, tough-cookie@^4.1.4: +tough-cookie@^4.1.2: version "4.1.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== @@ -13794,21 +10759,6 @@ ts-api-utils@^1.0.1, ts-api-utils@^1.3.0: resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== -ts-command-line-args@^2.2.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz#e64456b580d1d4f6d948824c274cf6fa5f45f7f0" - integrity sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw== - dependencies: - chalk "^4.1.0" - command-line-args "^5.1.1" - command-line-usage "^6.1.0" - string-format "^2.0.0" - -ts-essentials@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.3.tgz#686fd155a02133eedcc5362dc8b5056cde3e5a38" - integrity sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ== - ts-interface-checker@^0.1.9: version "0.1.13" resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" @@ -13837,7 +10787,7 @@ ts-node-test@^0.4.4: ts-node "10.9.2" yargs "17.7.2" -ts-node@10.9.2, ts-node@^10.9.2: +ts-node@10.9.2: version "10.9.2" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== @@ -13889,7 +10839,7 @@ tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.2.0, tslib@^2.4.0, tslib@^2.6.1, tslib@^2.6.2, tslib@^2.8.0: +tslib@^2.4.0, tslib@^2.6.1, tslib@^2.6.2: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== @@ -13985,23 +10935,11 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg== - dependencies: - prelude-ls "~1.1.2" - type-detect@4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== -type-detect@^4.0.0, type-detect@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.1.0.tgz#deb2453e8f08dcae7ae98c626b13dddb0155906c" - integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw== - type-fest@^0.18.0: version "0.18.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" @@ -14032,11 +10970,6 @@ type-fest@^0.8.0, type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type-fest@^4.26.1: - version "4.26.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.26.1.tgz#a4a17fa314f976dd3e6d6675ef6c775c16d7955e" - integrity sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg== - type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -14045,22 +10978,6 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -typechain@^8.3.0: - version "8.3.2" - resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.3.2.tgz#1090dd8d9c57b6ef2aed3640a516bdbf01b00d73" - integrity sha512-x/sQYr5w9K7yv3es7jo4KTX05CLxOf7TRWwoHlrjRh8H82G64g+k7VuWPJlgMo6qrjfCulOdfBjiaDtmhFYD/Q== - dependencies: - "@types/prettier" "^2.1.1" - debug "^4.3.1" - fs-extra "^7.0.0" - glob "7.1.7" - js-sha3 "^0.8.0" - lodash "^4.17.15" - mkdirp "^1.0.4" - prettier "^2.3.1" - ts-command-line-args "^2.2.0" - ts-essentials "^7.0.1" - typed-array-buffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3" @@ -14112,11 +11029,6 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== - typedoc-plugin-missing-exports@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/typedoc-plugin-missing-exports/-/typedoc-plugin-missing-exports-3.1.0.tgz#cab4952c19cae1ab3f91cbbf2d7d17564682b023" @@ -14142,36 +11054,16 @@ typescript-eslint@8.16.0: "@typescript-eslint/parser" "8.16.0" "@typescript-eslint/utils" "8.16.0" -typescript@*, typescript@^5, typescript@^5.6.3, typescript@~5.6.2: +typescript@*, typescript@^5.6.3: version "5.6.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw== -typical@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4" - integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw== - -typical@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066" - integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== - uc.micro@^2.0.0, uc.micro@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee" integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A== -ufo@^1.5.4: - version "1.5.4" - resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.5.4.tgz#16d6949674ca0c9e0fbbae1fa20a71d7b1ded754" - integrity sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ== - -uglify-js@^3.1.4: - version "3.19.3" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" - integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== - unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -14199,16 +11091,6 @@ undici@^5.14.0, undici@^5.28.4, undici@^5.28.5: dependencies: "@fastify/busboy" "^2.0.0" -"unenv@npm:unenv-nightly@2.0.0-20241121-161142-806b5c0": - version "2.0.0-20241121-161142-806b5c0" - resolved "https://registry.yarnpkg.com/unenv-nightly/-/unenv-nightly-2.0.0-20241121-161142-806b5c0.tgz#ce8e0281d7492878daca3b9284d18fa8b765fd1c" - integrity sha512-RnFOasE/O0Q55gBkNB1b84OgKttgLEijGO0JCWpbn+O4XxpyCQg89NmcqQ5RGUiy4y+rMIrKzePTquQcLQF5pQ== - dependencies: - defu "^6.1.4" - ohash "^1.1.4" - pathe "^1.1.2" - ufo "^1.5.4" - unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz#cb3173fe47ca743e228216e4a3ddc4c84d628cc2" @@ -14318,12 +11200,7 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -utf8@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" - integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== - -util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: +util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== @@ -14405,106 +11282,6 @@ viem@^2.22.8: ox "0.6.5" ws "8.18.0" -vite-node@2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-2.1.4.tgz#97ffb6de913fd8d42253afe441f9512e9dbdfd5c" - integrity sha512-kqa9v+oi4HwkG6g8ufRnb5AeplcRw8jUF6/7/Qz1qRQOXHImG8YnLbB+LLszENwFnoBl9xIf9nVdCFzNd7GQEg== - dependencies: - cac "^6.7.14" - debug "^4.3.7" - pathe "^1.1.2" - vite "^5.0.0" - -vite-node@2.1.8: - version "2.1.8" - resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-2.1.8.tgz#9495ca17652f6f7f95ca7c4b568a235e0c8dbac5" - integrity sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg== - dependencies: - cac "^6.7.14" - debug "^4.3.7" - es-module-lexer "^1.5.4" - pathe "^1.1.2" - vite "^5.0.0" - -vite@^5.0.0: - version "5.4.11" - resolved "https://registry.yarnpkg.com/vite/-/vite-5.4.11.tgz#3b415cd4aed781a356c1de5a9ebafb837715f6e5" - integrity sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q== - dependencies: - esbuild "^0.21.3" - postcss "^8.4.43" - rollup "^4.20.0" - optionalDependencies: - fsevents "~2.3.3" - -vite@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/vite/-/vite-6.0.2.tgz#7a22630c73c7b663335ddcdb2390971ffbc14993" - integrity sha512-XdQ+VsY2tJpBsKGs0wf3U/+azx8BBpYRHFAyKm5VeEZNOJZRB63q7Sc8Iup3k0TrN3KO6QgyzFf+opSbfY1y0g== - dependencies: - esbuild "^0.24.0" - postcss "^8.4.49" - rollup "^4.23.0" - optionalDependencies: - fsevents "~2.3.3" - -vitest-browser-react@^0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/vitest-browser-react/-/vitest-browser-react-0.0.3.tgz#7a065addea40c05a0d02e404ecfec31b87780c02" - integrity sha512-bNAE5ANYpGtwxdpN5qc4WxZnIjU0WYhOPMLAamm1/143tTBUFLHXe/rGSiy8q5xid/zrCRfC7AmKUA0LYNyUMg== - -vitest@2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/vitest/-/vitest-2.1.4.tgz#ba8f4589fb639cf5a9e6af54781667312b3e8230" - integrity sha512-eDjxbVAJw1UJJCHr5xr/xM86Zx+YxIEXGAR+bmnEID7z9qWfoxpHw0zdobz+TQAFOLT+nEXz3+gx6nUJ7RgmlQ== - dependencies: - "@vitest/expect" "2.1.4" - "@vitest/mocker" "2.1.4" - "@vitest/pretty-format" "^2.1.4" - "@vitest/runner" "2.1.4" - "@vitest/snapshot" "2.1.4" - "@vitest/spy" "2.1.4" - "@vitest/utils" "2.1.4" - chai "^5.1.2" - debug "^4.3.7" - expect-type "^1.1.0" - magic-string "^0.30.12" - pathe "^1.1.2" - std-env "^3.7.0" - tinybench "^2.9.0" - tinyexec "^0.3.1" - tinypool "^1.0.1" - tinyrainbow "^1.2.0" - vite "^5.0.0" - vite-node "2.1.4" - why-is-node-running "^2.3.0" - -vitest@^2.1.6: - version "2.1.8" - resolved "https://registry.yarnpkg.com/vitest/-/vitest-2.1.8.tgz#2e6a00bc24833574d535c96d6602fb64163092fa" - integrity sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ== - dependencies: - "@vitest/expect" "2.1.8" - "@vitest/mocker" "2.1.8" - "@vitest/pretty-format" "^2.1.8" - "@vitest/runner" "2.1.8" - "@vitest/snapshot" "2.1.8" - "@vitest/spy" "2.1.8" - "@vitest/utils" "2.1.8" - chai "^5.1.2" - debug "^4.3.7" - expect-type "^1.1.0" - magic-string "^0.30.12" - pathe "^1.1.2" - std-env "^3.8.0" - tinybench "^2.9.0" - tinyexec "^0.3.1" - tinypool "^1.0.1" - tinyrainbow "^1.2.0" - vite "^5.0.0" - vite-node "2.1.8" - why-is-node-running "^2.3.0" - vue-eslint-parser@9.4.3: version "9.4.3" resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz#9b04b22c71401f1e8bca9be7c3e3416a4bde76a8" @@ -14532,20 +11309,6 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" -web3-utils@^1.3.6: - version "1.10.4" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.10.4.tgz#0daee7d6841641655d8b3726baf33b08eda1cbec" - integrity sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A== - dependencies: - "@ethereumjs/util" "^8.1.0" - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereum-cryptography "^2.1.2" - ethjs-unit "0.1.6" - number-to-bn "1.7.0" - randombytes "^2.1.0" - utf8 "3.0.0" - webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -14658,13 +11421,6 @@ which-typed-array@^1.1.14, which-typed-array@^1.1.15: gopd "^1.0.1" has-tostringtag "^1.0.2" -which@^1.1.1, which@^1.3.1: - version "1.3.1" - resolved "https://registry.npmjs.org/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== - dependencies: - isexe "^2.0.0" - which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -14672,14 +11428,6 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -why-is-node-running@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/why-is-node-running/-/why-is-node-running-2.3.0.tgz#a3f69a97107f494b3cdc3bdddd883a7d65cebf04" - integrity sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w== - dependencies: - siginfo "^2.0.0" - stackback "0.0.2" - widest-line@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca" @@ -14687,66 +11435,16 @@ widest-line@^3.1.0: dependencies: string-width "^4.0.0" -word-wrap@^1.2.5, word-wrap@~1.2.3: +word-wrap@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== -wordwrap@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== - -wordwrapjs@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f" - integrity sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA== - dependencies: - reduce-flatten "^2.0.0" - typical "^5.2.0" - -workerd@1.20241106.2: - version "1.20241106.2" - resolved "https://registry.yarnpkg.com/workerd/-/workerd-1.20241106.2.tgz#5849cf9f26b74c5c119b57a76e61f483a3912083" - integrity sha512-Xw2hVIXA9MvDSHx3IX55ouGRPsQUzG0oadRVeQRs5xwgmiKshR0ompyYDO1JUvozJazfjcCSdgV8jyLcPqNIDA== - optionalDependencies: - "@cloudflare/workerd-darwin-64" "1.20241106.2" - "@cloudflare/workerd-darwin-arm64" "1.20241106.2" - "@cloudflare/workerd-linux-64" "1.20241106.2" - "@cloudflare/workerd-linux-arm64" "1.20241106.2" - "@cloudflare/workerd-windows-64" "1.20241106.2" - workerpool@^6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== -wrangler@3.92.0, wrangler@^3.72.3: - version "3.92.0" - resolved "https://registry.yarnpkg.com/wrangler/-/wrangler-3.92.0.tgz#0fc643aab8007eb08e5901895d2b158f1b2a342d" - integrity sha512-MC+s+stSYQKXEn7ucENhzrw+RyMc5bSIRQ2EVcjCtqjAtO82uKQBatW2YXK5hkQOZg9Kfcdqgkcnpf/Bn94FiA== - dependencies: - "@cloudflare/kv-asset-handler" "0.3.4" - "@cloudflare/workers-shared" "0.9.1" - "@esbuild-plugins/node-globals-polyfill" "^0.2.3" - "@esbuild-plugins/node-modules-polyfill" "^0.2.2" - blake3-wasm "^2.1.5" - chokidar "^4.0.1" - date-fns "^4.1.0" - esbuild "0.17.19" - itty-time "^1.0.6" - miniflare "3.20241106.2" - nanoid "^3.3.3" - path-to-regexp "^6.3.0" - resolve "^1.22.8" - selfsigned "^2.0.1" - source-map "^0.6.1" - unenv "npm:unenv-nightly@2.0.0-20241121-161142-806b5c0" - workerd "1.20241106.2" - xxhash-wasm "^1.0.1" - optionalDependencies: - fsevents "~2.3.2" - "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" @@ -14806,11 +11504,6 @@ write-file-atomic@^4.0.2: imurmurhash "^0.1.4" signal-exit "^3.0.7" -ws@7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== - ws@8.17.1: version "8.17.1" resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" @@ -14846,11 +11539,6 @@ xmlhttprequest@1.8.0: resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" integrity sha512-58Im/U0mlVBLM38NdZjHyhuMtCqa61469k2YP/AaPbvCoV9aQGUpbJBj1QRm2ytRiVQBD/fsw7L2bJGDVQswBA== -xxhash-wasm@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz#ecc0f813219b727af4d5f3958ca6becee2f2f1ff" - integrity sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A== - y18n@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" @@ -14871,7 +11559,7 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^2.2.2, yaml@^2.3.4, yaml@^2.5.1: +yaml@^2.2.2, yaml@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130" integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q== @@ -14904,7 +11592,7 @@ yargs-unparser@^2.0.0: flat "^5.0.2" is-plain-obj "^2.1.0" -yargs@17.7.2, yargs@^17.0.0, yargs@^17.3.1, yargs@^17.7.2: +yargs@17.7.2, yargs@^17.0.0, yargs@^17.3.1: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== @@ -14962,20 +11650,6 @@ yocto-queue@^1.0.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.1.1.tgz#fef65ce3ac9f8a32ceac5a634f74e17e5b232110" integrity sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g== -yoctocolors-cjs@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.2.tgz#f4b905a840a37506813a7acaa28febe97767a242" - integrity sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA== - -youch@^3.2.2: - version "3.3.3" - resolved "https://registry.yarnpkg.com/youch/-/youch-3.3.3.tgz#50cfdf5bc395ce664a5073e31b712ff4a859d928" - integrity sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA== - dependencies: - cookie "^0.5.0" - mustache "^4.2.0" - stacktracey "^2.1.8" - zip-stream@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-6.0.1.tgz#e141b930ed60ccaf5d7fa9c8260e0d1748a2bbfb" @@ -14985,11 +11659,6 @@ zip-stream@^6.0.1: compress-commons "^6.0.2" readable-stream "^4.0.0" -zod@^3.22.3: - version "3.23.8" - resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" - integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g== - zwitch@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-2.0.4.tgz#c827d4b0acb76fc3e685a4c6ec2902d51070e9d7" From dd0af5633f30d7c610ad98a2c782a2af1517912f Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 15:39:11 +0000 Subject: [PATCH 05/15] fix: 1886 `docker/rpc-proxy` removed --- docker/rpc-proxy/.dockerignore | 4 - docker/rpc-proxy/Dockerfile | 52 ------------- docker/rpc-proxy/config/genesis.json | 105 --------------------------- 3 files changed, 161 deletions(-) delete mode 100644 docker/rpc-proxy/.dockerignore delete mode 100644 docker/rpc-proxy/Dockerfile delete mode 100644 docker/rpc-proxy/config/genesis.json diff --git a/docker/rpc-proxy/.dockerignore b/docker/rpc-proxy/.dockerignore deleted file mode 100644 index a3087b587..000000000 --- a/docker/rpc-proxy/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -packages/*/node_modules -packages/*/dist -packages/*/.turbo -packages/*/coverageUnit \ No newline at end of file diff --git a/docker/rpc-proxy/Dockerfile b/docker/rpc-proxy/Dockerfile deleted file mode 100644 index 6e7042935..000000000 --- a/docker/rpc-proxy/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -# Stage 1: Build the app -FROM node:20.17-alpine3.20 AS builder - -# Set the working directory in the builder stage -WORKDIR /app - -# Copy the dependencies file to the working directory -COPY ./packages/rpc-proxy ./packages/rpc-proxy -COPY ./packages/network ./packages/network -COPY ./packages/core ./packages/core -COPY ./packages/logging ./packages/logging -COPY ./packages/errors ./packages/errors -COPY ./package.json ./package.json -COPY ./turbo.json ./turbo.json -COPY ./yarn.lock ./yarn.lock -COPY ./tsconfig.json ./tsconfig.json - -# Install all the dependencies and build the app -RUN yarn install && yarn build - -# Stage 2: Serve the app using node -FROM node:20.17.0-alpine3.20 AS runner - -# Copy only the built files and essential runtime files from the builder stage -## rpc-proxy -COPY --from=builder /app/packages/rpc-proxy/dist /app/packages/rpc-proxy/dist -COPY --from=builder /app/packages/rpc-proxy/package.json /app/packages/rpc-proxy/package.json -COPY --from=builder /app/packages/rpc-proxy/solo-config.json /app/packages/rpc-proxy/solo-config.json -## SDK dependencies -COPY --from=builder /app/packages/network/dist /app/packages/network/dist -COPY --from=builder /app/packages/network/package.json /app/packages/network/package.json -COPY --from=builder /app/packages/core/dist /app/packages/core/dist -COPY --from=builder /app/packages/core/package.json /app/packages/core/package.json -COPY --from=builder /app/packages/logging/dist /app/packages/logging/dist -COPY --from=builder /app/packages/logging/package.json /app/packages/logging/package.json -COPY --from=builder /app/packages/errors/dist /app/packages/errors/dist -COPY --from=builder /app/packages/errors/package.json /app/packages/errors/package.json -## Just PROD dependencies -COPY --from=builder /app/package.json /app/package.json -COPY --from=builder /app/yarn.lock /app/yarn.lock -WORKDIR /app -RUN yarn workspace @vechain/sdk-rpc-proxy install --production --frozen-lockfile --ignore-scripts --prefer-offline \ - && yarn cache clean \ - && adduser -D rpc-proxy-user -# Create a new user to run the app so we do not use root -USER rpc-proxy-user - -# Tell we are running with Docker -ENV RUNNING_WITH_DOCKER=true - -# Set the default command to use node to run the app -CMD ["node", "packages/rpc-proxy/dist/index.js"] \ No newline at end of file diff --git a/docker/rpc-proxy/config/genesis.json b/docker/rpc-proxy/config/genesis.json deleted file mode 100644 index ca6b3e577..000000000 --- a/docker/rpc-proxy/config/genesis.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "launchTime": 1703180212, - "gasLimit": 40000000, - "extraData": "My custom VeChain", - "forkConfig": { - "VIP191": 0, - "ETH_CONST": 0, - "BLOCKLIST": 0, - "ETH_IST": 0, - "VIP214": 0, - "FINALITY": 0 - }, - "accounts": [ - { - "address": "0x7567d83b7b8d80addcb281a71d54fc7b3364ffed", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": 0, - "code": "0x6060604052600256", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000002" - } - }, - { - "address": "0xf077b491b355e64048ce21e3a6fc4751eeea77fa", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0x435933c8064b4ae76be665428e0307ef2ccfbd68", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0x0f872421dc479f3c11edd89512731814d0598db5", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0xf370940abdbd2583bc80bfc19d19bc216c88ccf0", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0x99602e4bbc0503b8ff4432bb1857f916c3653b85", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0x61e7d0c2b25706be3485980f39a3a994a8207acf", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0x361277d1b27504f36a3b33d3a52d1f8270331b8c", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0xd7f75a0a1287ab2916848909c8531a0ea9412800", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0xabef6032b9176c186f6bf984f548bda53349f70a", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - }, - { - "address": "0x865306084235bf804c8bba8a8d56890940ca8f0b", - "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "energy": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - } - ], - "authority": [ - { - "masterAddress": "0x435933c8064b4ae76be665428e0307ef2ccfbd68", - "endorsorAddress": "0x7567d83b7b8d80addcb281a71d54fc7b3364ffed", - "identity": "0x000000000000000068747470733a2f2f636f6e6e65782e76656368612e696e2f" - }, - { - "masterAddress": "0xf370940abdbd2583bc80bfc19d19bc216c88ccf0", - "endorsorAddress": "0x7567d83b7b8d80addcb281a71d54fc7b3364ffed", - "identity": "0x000000000000000068747470733a2f2f656e762e7665636861696e2e6f72672f" - }, - { - "masterAddress": "0x0f872421dc479f3c11edd89512731814d0598db5", - "endorsorAddress": "0x7567d83b7b8d80addcb281a71d54fc7b3364ffed", - "identity": "0x0000000000000068747470733a2f2f617070732e7665636861696e2e6f72672f" - } - ], - "params": { - "rewardRatio": 300000000000000000, - "baseGasPrice": 1000000000000000, - "proposerEndorsement": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "executorAddress": "0x0000000000000000000000004578656375746f72" - }, - "executor": { - "approvers": [ - { - "address": "0x199b836d8a57365baccd4f371c1fabb7be77d389", - "identity": "0x00000000000067656e6572616c20707572706f736520626c6f636b636861696e" - } - ] - } -} From 5d8517aa1d5ea914d54c640a4c0eee356853095e Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 16:00:12 +0000 Subject: [PATCH 06/15] fix: 1886 module removed --- .changeset/config.json | 1 - .github/CONTRIBUTING.md | 203 ----- .github/workflows/on-pr.yml | 4 - .github/workflows/typedoc.yml | 29 - .gitignore | 1 - .husky/pre-commit | 2 +- docs/README.md | 38 - docs/accounts.md | 164 ---- docs/address.md | 81 -- docs/architecture.md | 41 - docs/bloom-filter.md | 57 -- docs/build-scripts/builddocs.ts | 142 ---- docs/certificates.md | 74 -- docs/contracts-deposit.md | 43 - docs/contracts-erc20.md | 135 --- docs/contracts.md | 254 ------ docs/cryptography.md | 76 -- docs/debug.md | 208 ----- docs/diagrams/architecture/accounts-module.md | 33 - docs/diagrams/architecture/certificate.md | 25 - docs/diagrams/architecture/core-package.md | 57 -- docs/diagrams/architecture/debug-module.md | 93 -- docs/diagrams/architecture/errors-package.md | 54 -- .../architecture/hardhat-plugin-package.md | 14 - docs/diagrams/architecture/hdkey.md | 57 -- docs/diagrams/architecture/http.md | 30 - docs/diagrams/architecture/logging-package.md | 16 - docs/diagrams/architecture/network-package.md | 70 -- docs/diagrams/architecture/network.md | 93 -- .../architecture/rpc-proxy-package.md | 12 - docs/diagrams/architecture/secp256k1.md | 14 - docs/diagrams/architecture/thor-client.md | 50 -- docs/diagrams/architecture/transaction.md | 72 -- docs/diagrams/architecture/vcdm.md | 239 ------ .../v2/core/transaction/transaction_id.md | 197 ----- .../v2/core/transaction/transaction_id.mmd | 38 - docs/diagrams/v2/net/http/http.md | 35 - .../diagrams/v2/net/thor/accounts/accounts.md | 218 ----- docs/diagrams/v2/net/thor/blocks/blocks.md | 84 -- docs/diagrams/v2/net/thor/debug/debug.md | 205 ----- docs/diagrams/v2/net/thor/logs/logs.md | 230 ----- docs/diagrams/v2/net/thor/node/node.md | 71 -- .../net/thor/subscriptions/subscriptions.md | 215 ----- docs/diagrams/v2/net/thor/thor.md | 18 - .../v2/net/thor/transactions/transactions.md | 281 ------ docs/diagrams/v2/net/ws/ws.md | 23 - docs/encoding.md | 132 --- docs/events.md | 101 --- docs/evm-extension.md | 31 - docs/examples/accounts/bip32.ts | 35 - docs/examples/accounts/bip39.ts | 24 - docs/examples/accounts/keystore.ts | 43 - docs/examples/accounts/pubkey.ts | 35 - docs/examples/address/address-derivation.ts | 28 - .../address/address-erc55-checksum.ts | 20 - docs/examples/address/address-validation.ts | 18 - docs/examples/bloom/bloom.ts | 36 - docs/examples/certificates/sign_verify.ts | 31 - docs/examples/contracts/contract-clauses.ts | 25 - .../contracts/contract-create-ERC20-token.ts | 102 --- .../contracts/contract-delegation-ERC20.ts | 80 -- docs/examples/contracts/contract-deploy.ts | 18 - docs/examples/contracts/contract-deposit.ts | 120 --- .../contracts/contract-event-filter.ts | 206 ----- .../contracts/contract-function-call.ts | 74 -- .../contract-transfer-ERC20-token.ts | 80 -- docs/examples/contracts/contract-usage.ts | 133 --- docs/examples/cryptography/blake2b256.ts | 20 - docs/examples/cryptography/keccak256.ts | 21 - docs/examples/cryptography/secp256k1.ts | 42 - .../debug/debug-retrieve-storage-range.ts | 30 - .../debug/debug-trace-contract-call.ts | 34 - .../debug/debug-trace-transaction-clause.ts | 29 - docs/examples/encoding/abi.ts | 50 -- docs/examples/encoding/contract.ts | 54 -- docs/examples/encoding/rlp.ts | 43 - docs/examples/evm-extension/evm-extension.ts | 800 ------------------ docs/examples/polls/event-poll-dapp.ts | 50 -- .../polls/sync-poll-wait-balance-update.ts | 109 --- .../polls/sync-poll-wait-new-block.ts | 30 - .../provider/vechain-hardhat-provider.ts | 24 - docs/examples/provider/vechain-provider.ts | 19 - .../subscriptions/block-subscriptions.ts | 31 - .../subscriptions/event-subscriptions.ts | 58 -- docs/examples/thor-client/accounts.ts | 34 - docs/examples/thor-client/blocks.ts | 51 -- docs/examples/thor-client/contract.ts | 79 -- .../thor-client/delegated-transactions.ts | 104 --- docs/examples/thor-client/gas.ts | 86 -- docs/examples/thor-client/initialize.ts | 20 - docs/examples/thor-client/logs.ts | 138 --- docs/examples/thor-client/nodes.ts | 16 - docs/examples/thor-client/transactions.ts | 79 -- .../transactions/blockref-expiration.ts | 57 -- docs/examples/transactions/fee-delegation.ts | 88 -- .../full-flow-delegator-private-key.ts | 127 --- .../transactions/full-flow-delegator-url.ts | 132 --- .../transactions/full-flow-no-delegator.ts | 103 --- .../examples/transactions/multiple-clauses.ts | 65 -- .../revert-reason-with-simulation.ts | 297 ------- docs/examples/transactions/revert-reason.ts | 19 - docs/examples/transactions/sign-decode.ts | 60 -- docs/examples/transactions/simulation.ts | 115 --- docs/examples/transactions/tx-dependency.ts | 87 -- docs/javascript.md | 59 -- docs/package.json | 28 - docs/polls.md | 223 ----- docs/provider.md | 84 -- docs/subscriptions.md | 128 --- docs/templates/accounts.md | 59 -- docs/templates/address.md | 40 - docs/templates/architecture.md | 41 - docs/templates/bloom-filter.md | 27 - docs/templates/certificates.md | 47 - docs/templates/contracts-deposit.md | 25 - docs/templates/contracts-erc20.md | 57 -- docs/templates/contracts.md | 75 -- docs/templates/cryptography.md | 38 - docs/templates/debug.md | 133 --- docs/templates/encoding.md | 27 - docs/templates/events.md | 25 - docs/templates/evm-extension.md | 21 - docs/templates/javascript.md | 58 -- docs/templates/polls.md | 27 - docs/templates/provider.md | 61 -- docs/templates/subscriptions.md | 34 - docs/templates/thor-client.md | 133 --- docs/templates/transactions.md | 81 -- docs/thor-client.md | 472 ----------- docs/transactions.md | 699 --------------- docs/tsconfig.json | 17 - package.json | 7 +- packages/core/README.md | 2 - packages/errors/README.md | 2 - packages/logging/README.md | 2 - packages/network/README.md | 2 - .../helpers/delegation-handler.ts | 2 +- scripts/pre-release.ts | 99 --- scripts/test-rpc-proxy.ts | 71 -- yarn.lock | 119 +-- 140 files changed, 20 insertions(+), 11675 deletions(-) delete mode 100644 docs/README.md delete mode 100644 docs/accounts.md delete mode 100644 docs/address.md delete mode 100644 docs/architecture.md delete mode 100644 docs/bloom-filter.md delete mode 100644 docs/build-scripts/builddocs.ts delete mode 100644 docs/certificates.md delete mode 100644 docs/contracts-deposit.md delete mode 100644 docs/contracts-erc20.md delete mode 100644 docs/contracts.md delete mode 100644 docs/cryptography.md delete mode 100644 docs/debug.md delete mode 100644 docs/diagrams/architecture/accounts-module.md delete mode 100644 docs/diagrams/architecture/certificate.md delete mode 100644 docs/diagrams/architecture/core-package.md delete mode 100644 docs/diagrams/architecture/debug-module.md delete mode 100644 docs/diagrams/architecture/errors-package.md delete mode 100644 docs/diagrams/architecture/hardhat-plugin-package.md delete mode 100644 docs/diagrams/architecture/hdkey.md delete mode 100644 docs/diagrams/architecture/http.md delete mode 100644 docs/diagrams/architecture/logging-package.md delete mode 100644 docs/diagrams/architecture/network-package.md delete mode 100644 docs/diagrams/architecture/network.md delete mode 100644 docs/diagrams/architecture/rpc-proxy-package.md delete mode 100644 docs/diagrams/architecture/secp256k1.md delete mode 100644 docs/diagrams/architecture/thor-client.md delete mode 100644 docs/diagrams/architecture/transaction.md delete mode 100644 docs/diagrams/architecture/vcdm.md delete mode 100644 docs/diagrams/v2/core/transaction/transaction_id.md delete mode 100644 docs/diagrams/v2/core/transaction/transaction_id.mmd delete mode 100644 docs/diagrams/v2/net/http/http.md delete mode 100644 docs/diagrams/v2/net/thor/accounts/accounts.md delete mode 100644 docs/diagrams/v2/net/thor/blocks/blocks.md delete mode 100644 docs/diagrams/v2/net/thor/debug/debug.md delete mode 100644 docs/diagrams/v2/net/thor/logs/logs.md delete mode 100644 docs/diagrams/v2/net/thor/node/node.md delete mode 100644 docs/diagrams/v2/net/thor/subscriptions/subscriptions.md delete mode 100644 docs/diagrams/v2/net/thor/thor.md delete mode 100644 docs/diagrams/v2/net/thor/transactions/transactions.md delete mode 100644 docs/diagrams/v2/net/ws/ws.md delete mode 100644 docs/encoding.md delete mode 100644 docs/events.md delete mode 100644 docs/evm-extension.md delete mode 100644 docs/examples/accounts/bip32.ts delete mode 100644 docs/examples/accounts/bip39.ts delete mode 100644 docs/examples/accounts/keystore.ts delete mode 100644 docs/examples/accounts/pubkey.ts delete mode 100644 docs/examples/address/address-derivation.ts delete mode 100644 docs/examples/address/address-erc55-checksum.ts delete mode 100644 docs/examples/address/address-validation.ts delete mode 100644 docs/examples/bloom/bloom.ts delete mode 100644 docs/examples/certificates/sign_verify.ts delete mode 100644 docs/examples/contracts/contract-clauses.ts delete mode 100644 docs/examples/contracts/contract-create-ERC20-token.ts delete mode 100644 docs/examples/contracts/contract-delegation-ERC20.ts delete mode 100644 docs/examples/contracts/contract-deploy.ts delete mode 100644 docs/examples/contracts/contract-deposit.ts delete mode 100644 docs/examples/contracts/contract-event-filter.ts delete mode 100644 docs/examples/contracts/contract-function-call.ts delete mode 100644 docs/examples/contracts/contract-transfer-ERC20-token.ts delete mode 100644 docs/examples/contracts/contract-usage.ts delete mode 100644 docs/examples/cryptography/blake2b256.ts delete mode 100644 docs/examples/cryptography/keccak256.ts delete mode 100644 docs/examples/cryptography/secp256k1.ts delete mode 100644 docs/examples/debug/debug-retrieve-storage-range.ts delete mode 100644 docs/examples/debug/debug-trace-contract-call.ts delete mode 100644 docs/examples/debug/debug-trace-transaction-clause.ts delete mode 100644 docs/examples/encoding/abi.ts delete mode 100644 docs/examples/encoding/contract.ts delete mode 100644 docs/examples/encoding/rlp.ts delete mode 100644 docs/examples/evm-extension/evm-extension.ts delete mode 100644 docs/examples/polls/event-poll-dapp.ts delete mode 100644 docs/examples/polls/sync-poll-wait-balance-update.ts delete mode 100644 docs/examples/polls/sync-poll-wait-new-block.ts delete mode 100644 docs/examples/provider/vechain-hardhat-provider.ts delete mode 100644 docs/examples/provider/vechain-provider.ts delete mode 100644 docs/examples/subscriptions/block-subscriptions.ts delete mode 100644 docs/examples/subscriptions/event-subscriptions.ts delete mode 100644 docs/examples/thor-client/accounts.ts delete mode 100644 docs/examples/thor-client/blocks.ts delete mode 100644 docs/examples/thor-client/contract.ts delete mode 100644 docs/examples/thor-client/delegated-transactions.ts delete mode 100644 docs/examples/thor-client/gas.ts delete mode 100644 docs/examples/thor-client/initialize.ts delete mode 100644 docs/examples/thor-client/logs.ts delete mode 100644 docs/examples/thor-client/nodes.ts delete mode 100644 docs/examples/thor-client/transactions.ts delete mode 100644 docs/examples/transactions/blockref-expiration.ts delete mode 100644 docs/examples/transactions/fee-delegation.ts delete mode 100644 docs/examples/transactions/full-flow-delegator-private-key.ts delete mode 100644 docs/examples/transactions/full-flow-delegator-url.ts delete mode 100644 docs/examples/transactions/full-flow-no-delegator.ts delete mode 100644 docs/examples/transactions/multiple-clauses.ts delete mode 100644 docs/examples/transactions/revert-reason-with-simulation.ts delete mode 100644 docs/examples/transactions/revert-reason.ts delete mode 100644 docs/examples/transactions/sign-decode.ts delete mode 100644 docs/examples/transactions/simulation.ts delete mode 100644 docs/examples/transactions/tx-dependency.ts delete mode 100644 docs/javascript.md delete mode 100644 docs/package.json delete mode 100644 docs/polls.md delete mode 100644 docs/provider.md delete mode 100644 docs/subscriptions.md delete mode 100644 docs/templates/accounts.md delete mode 100644 docs/templates/address.md delete mode 100644 docs/templates/architecture.md delete mode 100644 docs/templates/bloom-filter.md delete mode 100644 docs/templates/certificates.md delete mode 100644 docs/templates/contracts-deposit.md delete mode 100644 docs/templates/contracts-erc20.md delete mode 100644 docs/templates/contracts.md delete mode 100644 docs/templates/cryptography.md delete mode 100644 docs/templates/debug.md delete mode 100644 docs/templates/encoding.md delete mode 100644 docs/templates/events.md delete mode 100644 docs/templates/evm-extension.md delete mode 100644 docs/templates/javascript.md delete mode 100644 docs/templates/polls.md delete mode 100644 docs/templates/provider.md delete mode 100644 docs/templates/subscriptions.md delete mode 100644 docs/templates/thor-client.md delete mode 100644 docs/templates/transactions.md delete mode 100644 docs/thor-client.md delete mode 100644 docs/transactions.md delete mode 100644 docs/tsconfig.json delete mode 100644 scripts/pre-release.ts delete mode 100644 scripts/test-rpc-proxy.ts diff --git a/.changeset/config.json b/.changeset/config.json index 79ff89841..fda8cf425 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -8,7 +8,6 @@ "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [ - "docs", "sdk-cloudflare-integration", "sdk-hardhat-integration", "sdk-nextjs-integration", diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 60f28fb4b..e49d9489e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,243 +2,40 @@ ## Introduction -Thank you for considering contributing to the VeChain SDK project. -This SDK is an important part of the VeChain ecosystem, and your contributions are greatly appreciated. -This document outlines the process and guidelines for contributing. - ## Getting Started -1. Fork the repository on GitHub. -2. Clone your forked repository to your local machine. -3. Install the dependencies by running yarn install. -4. Make your changes are in a new git branch: git checkout -b my-fix-branch master. - ## Coding Rules -To ensure consistency throughout the source code, please adhere to the following rules: - -1. Follow the coding style used throughout the project. The project includes an ESLint configuration, so consider installing an ESLint plugin for your text editor for real-time linting. -2. All public API methods must be documented. -3. Write tests for new features and bug fixes. -4. For integration tests using thor-solo, if needed, use a `TEST_ACCOUNT` in order to isolate previous integration tests. -5. Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit messages. - ## Guidelines for Documentation Updates -Accurate and up-to-date documentation is vital for the usability and maintainability of the vechain-sdk. -We welcome contributions that improve or update the documentation. - ### Textual Documentation -1. **Clarity and Accuracy**: Ensure that the documentation is clear, accurate, and easy to understand. Avoid technical jargon where possible, or provide explanations for technical terms. -2. **Consistency**: Follow the existing format and style of the documentation. This includes using the same tense, person, and voice. -3. **Markdown Formatting**: Use Markdown formatting appropriately to improve the readability of the document. - ### Diagrams -1. **Updating Diagrams**: In the `docs/diagrams` directory, update diagrams if there are significant changes to the system architecture or if you find any outdated diagrams. -2. **Tools**: Use mermaid markdown diagrams that produce clear, high-quality diagrams. -3. **Documenting Changes**: Include a brief description of what was changed in the diagram and why in your pull request. - ## Commenting Guidelines ### Class Commenting -Provide an overview of the class's purpose, how it should be used, and in which subsystem it belongs if applicable. - -```typescript -/** - * Represents a statistical utility that provides methods to compute - * common statistical metrics. - * - * @remarks - * This class provides static methods and adheres to the immutability and statelessness principles. - * It is a part of the {@link vechain-sdk#Statistics | Statistics subsystem}. - */ -export class Statistics { - ... -} -``` - -### Method Commenting - -Document the purpose, parameters, return values, and usage examples of methods, as well as any exceptions they might throw. - -```typescript -/** - * Computes the average of two numbers. - * - * @remarks - * This method is designed for two numbers only and returns the exact arithmetic mean. - * It is a part of the {@link vechain-sdk#Statistics | Statistics subsystem}. - * - * @param x - The first input number. - * @param y - The second input number. - * @returns The arithmetic mean of `x` and `y`. - * - * @example - * ``` - * const average = Statistics.getAverage(5, 3); - * console.log(average); // Outputs: 4 - * ``` - */ -public static getAverage(x: number, y: number): number { - return (x + y) / 2.0; -} -``` - -### Property Commenting - -Explain the purpose of properties and any noteworthy characteristics about them. - -```typescript -/** - * The total count of instances created from this class. - * - * @remarks - * This property is static and reflects the total count across all instances. - */ -public static instanceCount: number = 0; -``` - ### Exception Commenting -Describe under what conditions methods throw exceptions. - -```typescript -/** - * Parses a string and returns its integer representation. - * - * @param s - The string to parse. - * @returns The integer representation of the string. - * - * @throws {NumberFormatException} - * Thrown when the provided string does not have a valid integer format. - */ -public static parseInteger(s: string): number { - const result = parseInt(s, 10); - if (isNaN(result)) { - throw new NumberFormatException(`Invalid number format: ${s}`); - } - return result; -} -``` ## Tests -Testing is a crucial aspect of maintaining a high-quality codebase in the VeChain SDK project. Tests not only validate the correctness of the code but also ensure that future changes do not inadvertently introduce bugs or regressions. It is imperative that all new features and bug fixes are accompanied by corresponding tests to verify their functionality. Additionally, existing code should have adequate test coverage to maintain its stability over time. We aim for 100% test coverage to guarantee the reliability of the SDK. - ### Test Group Tagging -When adding new tests or modifying existing ones, please make use of the `@group` tag to indicate the nature of the test: - -- For unit tests, use `@group unit`. -- For integration tests, use `@group integration`. - -```typescript -/** - * Bloom filter tests - * - * @NOTE different from ../utils/bloom/bloom.test.ts. - * This tests bloom functionality, not the utils. - * @group unit/bloom - */ -describe('Bloom Filter', () => { - /** - * Test estimate K function - */ - test('Estimate K', () => { - bloomKTestCases.forEach((bloomKTestCase) => { - expect(bloom.calculateK(bloomKTestCase.calculateK)).toBe( - bloomKTestCase.estimatedK - ); - }); - }); -}); -``` - -These tags help us categorize and run specific types of tests when needed. This ensures that our test suite remains well-organized and efficient. - ### Test File Naming Convention -When adding new test files, please adhere to the following naming conventions to maintain consistency across the project: - -```typescript -/** - * Allowed names for test files - */ -const allowedNames = [ - // Unit tests - '.unit.test.ts', - - // Integration tests - '.testnet.test.ts', - '.mainnet.test.ts', - '.solo.test.ts', - - // Mocks - '.mock.testnet.ts', - '.mock.mainnet.ts', - '.mock.solo.ts' -]; -``` - ## Error handling conventions -Errors handling is delegated to `errors` package. -Follow all code snapshots and convention related to it. - ### Input validation -The typical flow to handle errors is the following: - -```typescript -import { ErrorClass } from 'vechain-sdk'; - -function some_function(input: any) { - if(!valid_input(input)) { - throw new ErrorClass('method_name', 'error_message', { error_data }); - } -} -``` - ### Error thrown by a try/catch block -The typical flow to handle errors is the following: - -```typescript -import { ErrorClass } from 'vechain-sdk'; - -// ... Some code before ... -try { - // Some code that an throw errors -} catch (inner_error) { - throw new ErrorClass('method_name', 'error_message', { error_data }, inner_error); -} -// ... Some code after ... -``` - ## Issues -If you find a bug or want to request a new feature, please open a new issue. When filing a bug report, please provide a clear description of the problem, including the expected behavior and the actual behavior. - ## Submitting a Pull Request -Before submitting a pull request, please make sure the following is done: - -1. Rebase your branch on the latest main branch. -2. Run the test suite to make sure your changes do not break existing functionality. You can do this by running `yarn test`. -3. Squash your commits into a single commit with a clear message. -4. Push your branch to your fork on GitHub. -5. Open a pull request against the main branch of the vechain-sdk repository. - ### Pull Request Review -All submissions, including submissions by project members, require a review. We use GitHub's pull request review feature for this. - ## Code of Conduct -We are committed to providing a welcoming and inclusive environment for everyone who contributes to or interacts with the VeChain SDK project. To ensure a positive experience for our community, we have established a [Code of Conduct](CODE_OF_CONDUCT.md) that outlines our expectations for behavior. We encourage all contributors, maintainers, and users to familiarize themselves with this code, as it reflects our commitment to creating a diverse and respectful community. Thank you for helping us maintain a welcoming and collaborative space for all. - ## Thank You - -Your contributions to open source, large or small, make projects like this possible. Thank you for taking the time to contribute. \ No newline at end of file diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 48e68c99a..33e08407e 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -29,10 +29,6 @@ jobs: id: start-solo run: yarn start-thor-solo - - name: Test docs examples - run: | - yarn test:examples - - name: Stop Thor solo node id: stop-solo run: yarn stop-thor-solo diff --git a/.github/workflows/typedoc.yml b/.github/workflows/typedoc.yml index 6e6d326cb..9fb7248a9 100644 --- a/.github/workflows/typedoc.yml +++ b/.github/workflows/typedoc.yml @@ -22,40 +22,11 @@ env: BUILD_PATH: "./api-docs/" jobs: - build-api-docs: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: lts/* - - - name: Install packages - run: yarn install - - - name: Build - run: yarn build - - - name: Generate api docs - run: yarn generate:apidocs - - - name: Setup pages - uses: actions/configure-pages@v5 - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: ${{ env.BUILD_PATH }} deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - needs: build-api-docs runs-on: ubuntu-latest name: Deploy steps: diff --git a/.gitignore b/.gitignore index 9022f4453..691bb1b10 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ junit.xml .turbo # docs -docs/build/*.md api-docs/ index.html unit-tests.html diff --git a/.husky/pre-commit b/.husky/pre-commit index 92c428191..4c5c5c294 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,5 @@ yarn build yarn lint yarn check:circular-dependencies -yarn test:unit && git add docs +yarn test:unit yarn check:tests-naming diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 6e096f0a3..000000000 --- a/docs/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# VeChain SDK - -Welcome to the official documentation for the JavaScript VeChain SDK! - -This SDK provides developers with tools and resources to integrate VeChain blockchain functionality into their applications with ease. Whether you're building decentralized applications (dApps), managing digital assets, or exploring blockchain-based solutions, this SDK offers a comprehensive set of features to interact with the VeChainThor blockchain. - -## Installation - -To start using the VeChain SDK, you can install specific packages based on your needs. The SDK is a monorepo that includes various packages. Here are the packages available: - - [@vechain/sdk-aws-kms-adapter](https://www.npmjs.com/package/@vechain/sdk-aws-kms-adapter) - - [@vechain/sdk-core](https://www.npmjs.com/package/@vechain/sdk-core) - - [@vechain/sdk-errors](https://www.npmjs.com/package/@vechain/sdk-errors) - - [@vechain/sdk-ethers-adapter](https://www.npmjs.com/package/@vechain/sdk-ethers-adapter) - - [@vechain/sdk-hardhat-plugin](https://www.npmjs.com/package/@vechain/sdk-hardhat-plugin) - - [@vechain/sdk-logging](https://www.npmjs.com/package/@vechain/sdk-logging) - - [@vechain/sdk-network](https://www.npmjs.com/package/@vechain/sdk-network) - - [@vechain/sdk-rpc-proxy](https://www.npmjs.com/package/@vechain/sdk-rpc-proxy) - -You can install these packages individually based on your requirements. Here's how you can install the packages using npm: -``` bash -npm install @vechain/sdk-core -npm install @vechain/sdk-network -... -``` -If you prefer using yarn, you can install the packages as follows: -``` bash -yarn add @vechain/sdk-core -yarn add @vechain/sdk-network -... -``` - -## Contributing - -We welcome contributions from the community to improve the VeChain SDK. If you want to contribute, please review our Contribution Guidelines for more information. - -## License - -The VeChain SDK is licensed under the MIT License, which allows for both personal and commercial use. diff --git a/docs/accounts.md b/docs/accounts.md deleted file mode 100644 index 030eb7c66..000000000 --- a/docs/accounts.md +++ /dev/null @@ -1,164 +0,0 @@ ---- -description: Handling of mnemonics and keystore. ---- - -# Accounts - -Vechain SDK employs two primary classes, mnemonics and keystore, to facilitate account handling. - -## Mnemonics - -Mnemonics represent a standard human-readable approach to generate private keys. They consist of a set of words that are human-friendly and can be converted into entropy for generating private keys using derivation paths and various cryptography concepts. Notably, this process adheres to standards such as BIP-32, BIP-39, and BIP-44. These standards provide specifications and guidelines for mnemonic phrase generation, hierarchical deterministic wallets, and key derivation. - -### BIP-39 - -BIP-39, or Bitcoin Improvement Proposal 39, outlines a standard for creating mnemonic phrases to represent private keys. -These mnemonic phrases are typically generated as a sequence of words chosen from a predefined list, which makes them easier for humans to remember and transcribe accurately. -BIP-39 provides several benefits: - - **Human Readability**: Mnemonic phrases are constructed from a fixed set of words, typically 12 or 24, chosen from a predefined list. This makes them easier for users to write down and remember compared to raw private keys. - - **Error Detection**: BIP-39 includes a checksum in the mnemonic phrase, which allows for simple error detection. If a word is mistyped or omitted, the checksum will fail to validate, alerting the user to the error. - - **Compatibility**: BIP-39 mnemonics are widely supported across different wallets and applications within the cryptocurrency ecosystem. This ensures interoperability and ease of use for users who wish to access their funds from different platforms. - - **Security**: By generating private keys from a mnemonic phrase, users can securely back up and restore their wallets. As long as the mnemonic phrase is kept secure, users can recover their funds even if their original device is lost or damaged. - -```typescript { name=bip39, category=example } -// 1 - Generate BIP39 mnemonic words, default to 12 words (128bit strength) - -const randomMnemonic = Mnemonic.of(); - -console.log('Mnemonic words', randomMnemonic); -// Mnemonic words: "w1 w2 ... w12" - -// 2 - Derive private key from mnemonic words according to BIP32, using the path `m/44'/818'/0'/0`. - -// Defined for VET at https://github.com/satoshilabs/slips/blob/master/slip-0044.md -const privateKey = Mnemonic.toPrivateKey(randomMnemonic); - -console.log(Hex.of(privateKey).toString()); -// ...SOME PRIVATE KEY... -``` - -### BIP-32 - -BIP-32, or Bitcoin Improvement Proposal 32, defines a standard for hierarchical deterministic wallets (HD wallets). -HD wallets allow for the generation of a tree-like structure of keys derived from a single master seed. -This hierarchy provides several advantages, including: - - **Deterministic Key Generation**: All keys in an HD wallet are derived from a single master seed. This means that a user only needs to back up their master seed to recover all of their derived keys, rather than backing up each key individually. - - **Hierarchical Structure**: HD wallets use a tree-like structure to organize keys. This allows for the creation of multiple accounts or sub wallets within a single wallet, each with its own unique set of keys derived from the master seed. - - **Security**: By using a master seed to derive keys, HD wallets simplify the backup and recovery process while maintaining security. As long as the master seed is kept secure, all derived keys are also secure. - - **Privacy**: HD wallets provide improved privacy by generating a new public key for each transaction. This prevents observers from linking multiple transactions to a single wallet address. - -```typescript { name=bip32, category=example } -// 1 - Generate BIP39 mnemonic words, default to 12 words (128bit strength) - -const randomMnemonic = Mnemonic.of(); - -console.log('Mnemonic words', randomMnemonic); -// Mnemonic words: "w1 w2 ... w12" - -// 2 - Create BIP32 HD node from mnemonic words - -const hdnode = HDKey.fromMnemonic(randomMnemonic); - -// 3 - Derive 5 child private keys - -for (let i = 0; i < 5; i++) { - const child = hdnode.deriveChild(i); - console.log( - `children ${i} address`, - Address.ofPublicKey(child.publicKey).toString() - ); - console.log(`children ${i} private key`, child.privateKey); - // children 0 0x... - // children 1 0x... - // ... - // children 4 0x... -} -``` - -### Extended Public Key (xpub) - -An extended public key (xpub) is derived from an HD wallet's master public key (often referred to as an extended private key, xprv). It represents a point in the HD wallet's key derivation path from which child public keys can be derived, but not private keys. This allows for the creation of a "watch-only" wallet, where the ability to generate transactions is restricted, enhancing security. - -### HDKey Instance - -In the context of hierarchical deterministic wallets, an HDKey instance represents a node in the hierarchical tree structure of keys. -This key can be derived from a parent key using specific derivation paths. -HDKey instances encapsulate information such as the private key, public key, chain code, and index, allowing for secure and efficient key derivation. - -### From Public Key - -Generating an HDKey instance from an extended public key (xpub) allows developers to derive child public keys for purposes such as address generation, transaction monitoring, or building hierarchical structures within the wallet. This functionality is particularly useful in scenarios where the private keys are stored securely offline, and only public keys are exposed to the network for enhanced security. - -```typescript { name=pubkey, category=example } -// 1 - Create HD node from xpub (extended private key) and chain code - -const xpub = Hex.of( - '0x04dc40b4324626eb393dbf77b6930e915dcca6297b42508adb743674a8ad5c69a046010f801a62cb945a6cb137a050cefaba0572429fc4afc57df825bfca2f219a' -).bytes; - -const chainCode = Hex.of( - '0x105da5578eb3228655a8abe70bf4c317e525c7f7bb333634f5b7d1f70e111a33' -).bytes; - -// 2 - Create BIP32 HD node from xpub - -const hdKey = HDKey.fromPublicKey(xpub, chainCode); - -// 3 - Derive 5 child public keys - -for (let i = 0; i < 5; i++) { - const child = hdKey.deriveChild(i); - - console.log(`children ${i}`, Address.ofPublicKey(child.publicKey)); - // children 0 0x... - // children 1 0x... - // ... - // children 4 0x... -} - -// 4 - Wipe private data to avoid any hack. - -hdKey.wipePrivateData(); -``` - -## Keystore - -On the other hand, Keystore is employed for encrypting private keys in accordance with the Ethereum standard. By using Keystore, the private keys can be securely encrypted to prevent unauthorized access or exposure. - -Through the use of mnemonics and keystore, VeChainSDK ensures secure and user-friendly account handling. Mnemonics allow for easy generation of private keys, while keystore provides an additional layer of protection by encrypting the private keys in a standardized manner as per Ethereum's security practices. These functionalities collectively contribute to a robust and secure approach to managing accounts within the Thor ecosystem. - -```typescript { name=keystore, category=example } -// 1 - Create private key using Secp256k1 - -const privateKey = await Secp256k1.generatePrivateKey(); - -// @NOTE you can use BIP 39 too! -// const words = Mnemonic.of() -// const privateKey = Mnemonic.toPrivateKey(words) - -// ... - -// 2 - Encrypt/decrypt private key using Ethereum's keystore scheme - -// @NOTE the password should not be represented as a string, -// the Ethereum canonical representation to of password used in -// keystore encryption is UTF-8 NFKC. -const keyStorePassword = 'your password'; - -const newKeyStore = await keystore.encrypt(privateKey, keyStorePassword); - -// @NOTE the `encrypt` function wipes private key and password after use. - -// 3 - Throw the wrong password - -const recoveredPrivateKey = await keystore.decrypt( - newKeyStore, - keyStorePassword -); - -// @NOTE the `decrypt`` function wipes private key and password after use. - -console.log(recoveredPrivateKey.privateKey.toString()); -// 0x... -``` - diff --git a/docs/address.md b/docs/address.md deleted file mode 100644 index fc33608e4..000000000 --- a/docs/address.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -description: Overview of vechain-sdk-core Address class. ---- - -# Address class - -This class handles all address related operations: - -* Address derivation (from the private and public key) -* Address checking -* Address ERC55 Checksum - -# Diagram - -```mermaid -graph TD -; - A[vechain-sdk-core] --> B[Address class]; - B -->|Derivation| C[From Private Key]; - C --- D[From Public Key]; - B -->|Checksum| E[ERC55]; - B -->|Validation| F[Is valid address]; -``` - -# Example - -## Address Derivation - -Here we have a simple example of address derivation: -```typescript { name=address-derivation, category=example } -import { Address, Hex } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// Derive address from a private key -const addressFromPrivateKey = Address.ofPrivateKey( - Hex.of('0x7582be841ca040aa940fff6c05773129e135623e41acce3e0b8ba520dc1ae26a') - .bytes -).toString(); -console.log(addressFromPrivateKey); // 0xd989829d88B0eD1B06eDF5C50174eCfA64F14A64 - -// Derive address from a public key -const addressFromExtendedPublicKey = Address.ofPublicKey( - Hex.of( - '04b90e9bb2617387eba4502c730de65a33878ef384a46f1096d86f2da19043304afa67d0ad09cf2bea0c6f2d1767a9e62a7a7ecc41facf18f2fa505d92243a658f' - ).bytes -).toString(); -console.log(addressFromExtendedPublicKey); // 0xd989829d88B0eD1B06eDF5C50174eCfA64F14A64 -``` - -## Address Validation - -Here we have a simple example of address validation: -```typescript { name=address-validation, category=example } -import { Address } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// Valid address -console.log(Address.isValid('0x8617E340B3D01FA5F11F306F4090FD50E238070D')); // true - -// Invalid address -console.log(Address.isValid('52908400098527886E0F7030069857D2E4169EE7')); // false -``` - -## Address Checksum - -Here we have a simple example of address ERC55 checksum: -```typescript { name=address-erc55-checksum, category=example } -import { Address, HexUInt } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// Address without ERC55 checksum -const unchecksummedAddress = HexUInt.of( - '0x8617E340B3D01FA5F11F306F4090FD50E238070D'.toLowerCase() -); - -// Address with ERC55 checksum -const checksummedAddress = Address.checksum(unchecksummedAddress); - -console.log(checksummedAddress); // 0x8617E340B3D01FA5F11F306F4090FD50E238070D -``` - diff --git a/docs/architecture.md b/docs/architecture.md deleted file mode 100644 index 790b67f70..000000000 --- a/docs/architecture.md +++ /dev/null @@ -1,41 +0,0 @@ -# Architecture - -The chapter is designed to provide a high-level understanding of the VeChain SDK architecture and structure. -Comprehensive diagrams, following the C4 model, are available for reference in the project's [GitHub repository](https://github.com/vechain/vechain-sdk-js/tree/main/docs/diagrams/architecture). - -## Introduction - -Basically the `vechain-sdk` is a monorepo divided into different packages: - -- **Core Package** -- **Error Package** -- **Network Package** -- **Hardhat Plugin Package** -- **Logging Package** -- **RPC Proxy Package** - - -Each of these packages has its own responsibility and is described in the following chapters. - -### Core Package -The core package is the core functionality responsible package of the vechain-sdk. -It is responsible for all core functionality of the vechain-sdk. - -### Error Package -The error package is the error handling responsible package of the vechain-sdk. -It is responsible for all error handling of the vechain-sdk. - -### Network Package -The network package is the network interaction responsible package of the vechain-sdk. -It is responsible for all interactions with the blockchain. - -### Hardhat Plugin Package -Seamlessly integrate the VeChain SDK with Hardhat, the Ethereum development environment. -This plugin provides a bridge between the VeChain SDK and the Ethereum ecosystem, enabling you to leverage the best of both worlds. - -### Logging Package -The logging package provides a simple and easy-to-use logging system for the VeChain SDK. -This module is dedicated to managing and customizing logs within the SDK, ensuring your development experience remains transparent and insightful. - -### RPC Proxy Package -This package is designed to bridge the gap between Thor's RESTful API and Ethereum's JSON-RPC. diff --git a/docs/bloom-filter.md b/docs/bloom-filter.md deleted file mode 100644 index 0e25ee6c9..000000000 --- a/docs/bloom-filter.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -description: Handling of the bloom filter data structure. ---- - -# Bloom Filter - -## What is the bloom filter data structure? - -This data structure was first introduced by Burton H. Bloom in 1970 and has since found extensive utilisation in various domains due to its ability to drastically reduce the need for expensive storage and computational resources. The bloom filter achieves this by representing the set membership information in a compact manner, thereby significantly reducing the memory footprint required to store the set elements. - -The bloom filter remains a valuable and widely employed data structure for optimising set membership queries in scenarios where approximate answers are acceptable, and the preservation of storage and computational resources is of paramount importance. Its versatility and effectiveness makes it an indispensable tool in modern computer science and information technology applications. - -## How is the bloom filter used in VeChainThor? - -The VeChainThor blockchain implements the bloom filters as an integral part of its architecture to enhance the management and processing of addresses and block numbers within the ledger. By incorporating bloom filters, VeChainThor optimises the efficiency of address and block lookup operations, thereby streamlining data retrieval processes and enhancing overall system performance. - -The primary purpose of the bloom filter is to efficiently determine the presence or absence of a specific address or block number within the blockchain ledger. If a query is made to ascertain the existence of an address or block number, the bloom filter promptly provides a response, indicating whether the queried element is not present in the ledger. This response is guaranteed to be accurate in such cases. - -However, when the bloom filter indicates that the queried element is potentially present in the ledger, a higher level of assurance is required due to the probabilistic nature of the data structure. In these scenarios, a subsequent search operation is performed or other relevant operations are executed to further verify the presence or absence of the element with a significantly high degree of confidence. - -It is important to emphasise that the bloom filter's design is intentionally engineered to prioritise query efficiency and conserve computational resources. Consequently, the potential for false positives exists, implying that in certain instances, the filter may indicate the presence of an element that is, in reality, absent from the ledger. However, these occurrences are carefully managed by selecting appropriate parameters and monitoring the trade-off between accuracy and resource optimisation. - -## The impact of bloom filter - -By employing bloom filters in this manner, the VeChainThor blockchain significantly reduces the computational burden associated with address and block lookup operations, resulting in improved responsiveness and heightened scalability. This, in turn, positively impacts the overall user experience and facilitates seamless integration with various applications and services built on the blockchain platform. - -```typescript { name=bloom, category=example } -// 1 - Get best value of k (bits per key) - -const m = 100; // Number of hash functions used in the bloom filter, -const k = BloomFilter.computeBestHashFunctionsQuantity(m); -console.log(k); - -// 2 - Create an empty bloom filter with 14 bits per key. - -const bloomGenerator = BloomFilter.of(); - -// 3 - Add number from 0 to 99 to the bloom generator - -for (let i = 0; i < 100; i++) { - bloomGenerator.add(HexUInt.of(i).bytes); -} - -// 4 - Create the filter - -const bloomFilter = bloomGenerator.build(k, m); - -// Positive case (number from 0 to 99 must be present in the bloom filter) -for (let i = 0; i < 100; i++) { - const inFilter = bloomFilter.contains(HexUInt.of(i).bytes); // All true - expect(inFilter).toBeTruthy(); -} - -// Negative case (number from 100 must not be present in the bloom filter) -const notInFilter = bloomFilter.contains(HexUInt.of(100).bytes); // False -expect(notInFilter).toBeFalsy(); -``` diff --git a/docs/build-scripts/builddocs.ts b/docs/build-scripts/builddocs.ts deleted file mode 100644 index 953970340..000000000 --- a/docs/build-scripts/builddocs.ts +++ /dev/null @@ -1,142 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; - -const FILE_TAG = '[example]'; -const CODE_BLOCK_HEADER = '```typescript { name=, category=example }'; -const CODE_BLOCK = '```'; -const CURRENT_DIR = path.resolve(); -const TEMPLATE_DIR = path.join(CURRENT_DIR, 'templates'); -const FILETAG_REGEX = new RegExp('\\[(.*?)Snippet]', 'g'); - -// Function to construct the file path for a snippet based on a tag and a tag line -function getSnippetFilePath(tag: string, tagLine: string): string { - // Remove the tag and parentheses from the tag line, then trim whitespace - const snippetFileRelPath = tagLine - .replace(tag, '') - .replace('(', '') - .replace(')', '') - .trim(); - // Combine the current directory with the relative path to get the full path - return path.join(CURRENT_DIR, snippetFileRelPath); -} - -// Function to derive the name of a snippet from its tag and tag line -function getSnippetName(tag: string, tagLine: string): string { - const snippetFileAbsPath = getSnippetFilePath(tag, tagLine); - return path.basename(snippetFileAbsPath).toLowerCase().replace('.ts', ''); -} - -// Function to extract the tag from a given tag line -function getTag(tagline: string): string { - let fileTag = undefined; - const matchingArray = tagline.match(FILETAG_REGEX); - if (matchingArray && matchingArray.length > 0) { - fileTag = matchingArray[0]; - } else if (tagline.includes(FILE_TAG)) { - fileTag = FILE_TAG; - } - return fileTag; -} - -// Function to extract the content between two specified comments within a file -function extractContent( - filePath: string, - startComment: string, - endComment: string -): string { - // Read the file content - const content = fs.readFileSync(filePath, 'utf8'); - - // Find the start and end indexes of the comments - const startIndex = content.indexOf(startComment); - const endIndex = content.indexOf( - endComment, - startIndex + startComment.length - ); - - console.log('indexes', startIndex, endIndex); - - // Extract and return the content between the comments - if (startIndex !== -1 && endIndex !== -1) { - return content - .substring(startIndex + startComment.length, endIndex) - .trim(); - } else { - return 'Content not found between specified comments.'; - } -} - -// Function to retrieve the content of a snippet based on a tag and tag line -function getSnippetContent(tag: string, tagLine: string): string { - console.log(`\t\tGetting snippet from: ${tagLine}`); - const snippetFileAbsPath = getSnippetFilePath(tag, tagLine); - - if (tag === FILE_TAG) { - return fs.readFileSync(snippetFileAbsPath, 'utf8'); - } - - const snippetName = tag.replace('[', '').replace(']', ''); - return extractContent( - snippetFileAbsPath, - '// START_SNIPPET: ' + snippetName, - '// END_SNIPPET: ' + snippetName - ); -} - -// Function to build a template file from its filename -function buildTemplate(templateFileName: string): void { - console.log(`\tBuilding file ${templateFileName}`); - try { - const templateFilePath = path.join(TEMPLATE_DIR, templateFileName); - const outputFilePath = path.join(CURRENT_DIR, templateFileName); - const templateContent = fs - .readFileSync(templateFilePath, 'utf8') - .split('\n'); - for ( - let lineIndex = 0; - lineIndex < templateContent.length; - lineIndex++ - ) { - const fileTag = getTag(templateContent[lineIndex]); - if (fileTag !== undefined) { - const tagLine = templateContent[lineIndex]; - const snippetContent = getSnippetContent(fileTag, tagLine); - const snippetName = getSnippetName(fileTag, tagLine); - fs.appendFileSync( - outputFilePath, - `${CODE_BLOCK_HEADER.replace('', snippetName)}\n` - ); - fs.appendFileSync(outputFilePath, `${snippetContent}\n`); - fs.appendFileSync(outputFilePath, `${CODE_BLOCK}\n`); - } else { - fs.appendFileSync( - outputFilePath, - `${templateContent[lineIndex]}\n` - ); - } - } - } catch (e) { - console.log(`\tUnable to build template ${templateFileName}`); - throw e; - } -} - -// Function to get all the template files in the template directory -function getTemplateFiles(): string[] { - const files = fs - .readdirSync(TEMPLATE_DIR) - .filter((f) => f.toLowerCase().endsWith('.md')); - console.log(`\t${files.length} template markdown files found`); - return files; -} - -// Main function to build the template files -function main(): void { - console.log('Replacing code snippets in template files:'); - const mdTemplates = getTemplateFiles(); - for (const mdTemplate of mdTemplates) { - buildTemplate(mdTemplate); - } -} - -main(); diff --git a/docs/certificates.md b/docs/certificates.md deleted file mode 100644 index 5ccdf6912..000000000 --- a/docs/certificates.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -description: Certificate related functions. ---- - -# Certificates - -In the VeChainThor blockchain, a certificate is a data structure used for client-side self-signed certificates. -It plays a crucial role in providing a mechanism for secure identification and validation of data. -For example, when signing in to a Dapp, users typically need to sign a certificate as part of the authentication process. -This certificate serves as cryptographic proof of their identity and authorization. -Users use their private keys to sign the certificate, demonstrating their ownership and enabling secure access to the Dapp's services. - -## Purpose of Certificates - -Certificates are primarily used for purposes like attestation, validation, and verification of data authenticity. -They are used as proofs of authenticity and origin for data exchanged within the VeChain ecosystem. - -## Structure of a Certificate - -A Certificate in the VeChainThor blockchain typically consists of the following components: - -1. **Purpose**: The purpose field indicates the intended use or context of the certificate. - For example, it could be used for identification, verification, or attestation. -2. **Payload**: The payload field holds the actual content of the certificate. - This content can be of various types, such as text, images, or other data. -3. **Domain**: The domain field represents the specific context or domain for which the certificate is valid. - It helps ensure that the certificate is only applicable within the intended context. -4. **Timestamp**: The timestamp field records the time at which the certificate was created or issued. - This provides a temporal reference for the certificate's validity. -5. **Signer**: The signer field indicates the address of the entity that signs the certificate. - It is the public key address of the entity that issues the certificate. -6. **Signature**: The signature field contains the cryptographic signature generated by the issuer's private key. - This signature ensures the integrity and authenticity of the certificate's content. - -## Usage of Certificates - -Certificates are used in various scenarios within the VeChainThor blockchain, including: - -* **Proof of Authenticity**: Certificates can be used to prove the authenticity and origin of data, ensuring that the data has not been tampered with or altered. -* **Identification**: Certificates can be employed to establish the identity of a specific entity or participant within the blockchain ecosystem. -* **Verification**: Certificates can be used to verify the validity of data or transactions, providing a mechanism for trust and validation. - -## Self-Signed Certificates - -It's important to note that certificates in the VeChainThor blockchain are self-signed, which means that they are issued and signed by the same entity or user. The signature from the issuer's private key serves as proof of the certificate's authenticity. - -```typescript { name=sign_verify, category=example } -// 1 - Generate a private key and address for the signer - -const privateKey = await Secp256k1.generatePrivateKey(); -const publicKey = Secp256k1.derivePublicKey(privateKey); -const signerAddress = Address.ofPublicKey(publicKey).toString(); - -// 2 - Create a certificate - -const certificate = Certificate.of({ - purpose: 'identification', - payload: { - type: 'text', - content: 'fyi' - }, - domain: 'localhost', - timestamp: 1545035330, - signer: signerAddress -}); - -// 3 - Sign certificate - -certificate.sign(privateKey); - -// Verify certificate -certificate.verify(); -``` - diff --git a/docs/contracts-deposit.md b/docs/contracts-deposit.md deleted file mode 100644 index 52914f5bf..000000000 --- a/docs/contracts-deposit.md +++ /dev/null @@ -1,43 +0,0 @@ -# Deposit Contract - -This example illustrates the deployment of a deposit contract, executing a deposit transaction, and querying the balance associated with a specific address. - -## Contract Deployment and Interaction - -The main deployment steps are as follows: - -1. **Contract Factory Creation**: A contract factory is instantiated using the `ThorClient`, the contract's ABI, its bytecode, and the deployer's private key. -2. **Contract Deployment**: The contract is deployed to the VeChain blockchain. The deployment process is asynchronous and awaits confirmation. -3. **Deposit Transaction**: A deposit transaction is initiated by calling the `deposit` function of the deployed contract with a specified value (1000 Wei in this case). The value is the amount of VET sent with the transaction. This transaction is also asynchronous and awaits confirmation. -4. **Balance Query**: The balance of the deployer address is queried using the `getBalance` function of the contract. - - -## Example - -```typescript { name=contract-deposit, category=example } -// Creating the contract factory -const contractFactory = thorSoloClient.contracts.createContractFactory( - depositContractAbi, - depositContractBytecode, - signer -); - -const contract = await ( - await contractFactory.startDeployment() -).waitForDeployment(); - -await (await contract.transact.deposit({ value: 1000 })).wait(); - -const balance = await contract.read.getBalance(deployerAccount.address); - -expect(balance).toEqual([BigInt(1000)]); -``` - - - -## Conclusion - -This snippet serves as a practical guide for developers looking to understand the deployment and interaction with smart contracts on the VeChain blockchain, specifically focusing on deposit transactions and balance queries. - - - diff --git a/docs/contracts-erc20.md b/docs/contracts-erc20.md deleted file mode 100644 index 1fea5a48a..000000000 --- a/docs/contracts-erc20.md +++ /dev/null @@ -1,135 +0,0 @@ -# Create a sample ERC20 token - -### Overview -The ERC20 token standard is widely used for creating and issuing smart contracts on Ethereum blockchain. Vechain, being compatible with Ethereum's EVM, allows for the implementation of ERC20 tokens on its platform. This provides the benefits of VeChain's features, such as improved scalability and lower transaction costs, while maintaining the familiar ERC20 interface. - -### Example - -The VeChain SDK allows to create a sample ERC20 token with a few lines of code. The example below shows how to create a sample ERC20 token with the name "SampleToken" and symbol "ST" with a total supply of 1000000000000000000000000. - -#### Compile the contract - -The first step is to compile the contract using a solidity compiler. In this example we will compile an ERC20 token contract based on the OpenZeppelin ERC20 implementation. The contract is the following one: - -The bytecode and the ABI have been obtained by compiling the following contract: - -```solidity -pragma solidity ^0.8.20; - -import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; - -contract SampleToken is ERC20 { - constructor() ERC20("SampleToken", "ST") { - _mint(msg.sender, 1000000 * (10 ** uint256(decimals()))); - } -} -``` - -#### Deploy the contract - -Once the contract is compiled, we can deploy it using the VeChain SDK. The following code shows how to deploy the contract: - - -```typescript { name=contract-create-erc20-token, category=example } -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount]) -); -const signer = (await provider.getSigner( - deployerAccount.address -)) as VeChainSigner; - -// Creating the contract factory -const contractFactory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer -); - -// Deploying the contract -await contractFactory.startDeployment(); - -// Awaiting the contract deployment -const contract = await contractFactory.waitForDeployment(); - -// Awaiting the transaction receipt to confirm successful contract deployment -const receipt = contract.deployTransactionReceipt; - -// Asserting that the contract deployment didn't revert, indicating a successful deployment -expect(receipt.reverted).toEqual(false); - -const balance = await contract.read.balanceOf(deployerAccount.address); - -const expectedBalance = Units.parseUnits('1000000', Units.ether).bi; -// Asserting that the initial balance of the deployer is the expected amount (1e24 wei = 1e6 ether) -expect(balance).toEqual([expectedBalance]); -``` - - -#### Transfer tokens to another address - -Once the contract is deployed, we can transfer tokens to another address using the VeChain SDK. The following code shows how to transfer 10000 token smallest unit to another address: - -```typescript { name=contract-transfer-erc20-token, category=example } -const transferResult = await contract.transact.transfer( - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - 10000n -); - -// Wait for the transfer transaction to complete and obtain its receipt -const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - -// Asserting that the transaction has not been reverted -expect(transactionReceiptTransfer.reverted).toEqual(false); -``` - - -#### Filter the Transfer event - -In blockchain and smart contract contexts, events are significant occurrences or state changes within a contract that are emitted (or logged) for external systems and interfaces to detect and act upon. These events provide a way to signal to external entities that something of note has occurred within the contract, without requiring constant monitoring of the contract's state. They are especially useful in decentralized applications (dApps) for triggering updates in the UI in response to contract state changes. - -The Transfer event is a common event found in token contracts, especially those following standards like ERC-20 or ERC-721. It signifies the transfer of tokens from one address to another and typically includes information such as the sender's address, the recipient's address, and the amount transferred. - -Filtering events allows applications to listen for specific occurrences within a contract rather than polling the contract's state continually. This is both efficient and effective for staying updated with relevant contract interactions. - - - -For instance, once an ERC20 token contract is deployed, we can filter the Transfer events using the x1x\ SDK. The following code shows the filtering of a transfer event for a specific receiver address - -```typescript { name=contract-event-filter, category=example } -// Starting from a deployed contract instance, transfer some tokens to a specific address -const transferResult = await contractErc20.transact.transfer( - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - 10000n -); - -// Wait for the transfer transaction to complete and obtain its receipt -const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - -// Asserting that the transaction has not been reverted -expect(transactionReceiptTransfer.reverted).toEqual(false); - -// 1. passing an array of arguments -const transferEventsArrayArgs = await contractErc20.filters - .Transfer([undefined, '0x9e7911de289c3c856ce7f421034f66b6cde49c39']) - .get(); - -// 2. passing an object with the arguments as properties -const transferEventsObjectArgs = await contractErc20.filters - .Transfer({ - to: '0x9e7911de289c3c856ce7f421034f66b6cde49c39' - }) - .get(); - -// Asserting that the transfer event has been emitted -expect(transferEventsArrayArgs.length).toEqual(1); -expect(transferEventsObjectArgs.length).toEqual(1); - -// log the transfer events -console.log(transferEventsArrayArgs); -``` - -We are transferring tokens from the deployer address to another address. We can filter the Transfer event to get the transfer details by passing the receiver address (to restrict the event logs to a specific receiver). The filter parameters depend on the event signature and the indexed parameters of the event. In this example, the Transfer event has two indexed parameters, `from` and `to`. We are filtering the event logs by passing the `to` address. diff --git a/docs/contracts.md b/docs/contracts.md deleted file mode 100644 index 7906a8d5b..000000000 --- a/docs/contracts.md +++ /dev/null @@ -1,254 +0,0 @@ -# VeChain Contracts Interaction - -The following sections provide detailed information on interacting with VeChain smart contracts using the VeChain SDK. - -## Building clauses - - -VeChain uses clauses to interact with smart contracts. A clause is a single operation that can be executed on the blockchain. The VeChain SDK provides a `ClauseBuilder` class to create clauses for various operations. - - - -> ⚠️ **Warning:** -> To execute the clauses, you need to build a transaction and sign it with a wallet. The signed transaction can then be sent to the blockchain. This process is covered ahead in the documentation. - -### Transfer VET and VTHO clauses - -The following example shows you how to build clauses to transfer the two main token of VeChain, the token VET and the energy token VTHO (the one used to pay for transaction fees) - -```typescript { name=contract-clauses, category=example } -import { - Address, - Clause, - Units, - VET, - VTHO, - VTHO_ADDRESS -} from '@vechain/sdk-core'; - -// build some example clauses - -// 1. Transfer vet - -const transferVetClause = Clause.transferVET( - Address.of('0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54'), - VET.of(300n, Units.wei) -); - -// 2. Transfer VTHO - -const transferVTHOClause = Clause.transferToken( - Address.of(VTHO_ADDRESS), - Address.of('0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54'), - VTHO.of(300n, Units.wei) -); - -``` - -### Deploying a Smart Contract Clause - -#### Steps: - -1. **Clause Construction**: Use `clauseBuilder.deployContract` from `@vechain/sdk-core` to construct a deployment clause. -2. **Smart Contract Bytecode**: Pass the compiled contract's bytecode to deploy it. -3. **Clause Building**: create the deployment clause - -```typescript { name=contract-deploy, category=example } -// 1 - Init contract bytecode to deploy - -const contractBytecode = HexUInt.of( - '0x608060405234801561000f575f80fd5b506101438061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c806360fe47b1146100385780636d4ce63c14610054575b5f80fd5b610052600480360381019061004d91906100ba565b610072565b005b61005c61007b565b60405161006991906100f4565b60405180910390f35b805f8190555050565b5f8054905090565b5f80fd5b5f819050919050565b61009981610087565b81146100a3575f80fd5b50565b5f813590506100b481610090565b92915050565b5f602082840312156100cf576100ce610083565b5b5f6100dc848285016100a6565b91505092915050565b6100ee81610087565b82525050565b5f6020820190506101075f8301846100e5565b9291505056fea2646970667358221220427ff5682ef89b62b910bb1286c1028d32283512122854159ad59f1c71fb6d8764736f6c63430008160033' -); - -// 2 - Create a clause to deploy the contract -const clause = Clause.deployContract(contractBytecode); -``` - -### Calling a Contract Function Clause - -### Steps: - -1. **Understand the ABI**: The ABI (JSON format) defines contract functions and parameters. -2. **Clause Creation**: Use `clauseBuilder.functionInteraction` to create a clause for function calls. -3. **Clause Building**: Build the clause, e.g., calling `setValue(123)` to modify the contract state. - -```typescript { name=contract-function-call, category=example } -// 1 - Init a simple contract ABI -const contractABI = [ - { - constant: false, - inputs: [ - { - name: 'value', - type: 'uint256' - } - ], - name: 'setValue', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'getValue', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - } -] as const; - -// 2 - Create a clause to call setValue(123) -const clause = Clause.callFunction( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), // just a sample deployed contract address - ABIContract.ofAbi(contractABI).getFunction('setValue'), - [123] -); -``` - - -or you can load the contract using the thor client and then you can build the clause using the contract object. - -```typescript { name=contract-function-call, category=example } -// 1 - Build the thor client and load the contract - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -const contract = thorSoloClient.contracts.load( - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - contractABI -); - -// 2 - Create a clause to call setValue(123) -const setValueClause = contract.clause.setValue(123); -``` - - -## Multi-Clause Contract Interaction - -Now that we have seen how to build clauses, let's see how to send it to the blockchain. VeChain allows multiple clauses in a single transaction, enabling interactions with multiple contracts or operations. - -### Multiple Clauses in a Single Transaction - -In the following example we will see how to execute multiple read operations to get information regarding a deployed ERC20 token contract. - -```typescript { name=contract-create-erc20-token, category=example } -// Reading data from multiple clauses in a single call -const multipleClausesResult = - await thorSoloClient.contracts.executeMultipleClausesCall([ - contract.clause.totalSupply(), - contract.clause.name(), - contract.clause.symbol(), - contract.clause.decimals() - ]); - -expect(multipleClausesResult[0]).toEqual({ - success: true, - result: { - plain: expectedBalance, - array: [expectedBalance] - } -}); -expect(multipleClausesResult[1]).toEqual({ - success: true, - result: { - plain: 'SampleToken', - array: ['SampleToken'] - } -}); -expect(multipleClausesResult[2]).toEqual({ - success: true, - result: { - plain: 'ST', - array: ['ST'] - } -}); -expect(multipleClausesResult[3]).toEqual({ - success: true, - result: { - plain: 18, - array: [18] - } -}); -``` - -> ⚠️ **Warning:** -> The example above shows a multi clause read call. It's also possible to execute multi clause transactions with the method executeMultipleClausesTransaction, but you need to build a signer first. Please refer to the signer section for more information - - -## Commenting Contract Invocations - -Add comments to operations when using wallets, helping users understand transaction details during signing. - -```typescript { name=contract-transfer-erc20-token, category=example } -// Transfer tokens to another address with a comment - -await contract.transact.transfer( - { comment: 'Transferring 100 ERC20 tokens' }, - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - Units.parseEther('100').bi -); -``` - -## Specifying Revisions in Read Functions - -You can specify revisions (`best` or `finalized`) for read functions, similar to adding comments. - -## Delegating a Contract Call - -VeChain supports delegated contract calls where fees are paid by the delegator. - -```typescript { name=contract-delegation-erc20, category=example } -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount], { - delegator: { - delegatorPrivateKey: delegatorAccount.privateKey - } - }), - true -); -const signer = (await provider.getSigner( - deployerAccount.address -)) as VeChainSigner; - -// Defining a function for deploying the ERC20 contract -const setupERC20Contract = async (): Promise> => { - const contractFactory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - // Deploying the contract - await contractFactory.startDeployment(); - - // Waiting for the contract to be deployed - return await contractFactory.waitForDeployment(); -}; - -// Setting up the ERC20 contract and getting its address -const contract = await setupERC20Contract(); - -// Transferring 10000 tokens to another address with a delegated transaction -const transferResult = await contract.transact.transfer( - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - 10000n -); - -// Wait for the transfer transaction to complete and obtain its receipt -const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - -// Asserting that the transaction has not been reverted -expect(transactionReceiptTransfer.reverted).toEqual(false); -``` - diff --git a/docs/cryptography.md b/docs/cryptography.md deleted file mode 100644 index 14d1d8dab..000000000 --- a/docs/cryptography.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -description: Main cryptography related functions. ---- - -# Cryptography - -## Hash functions - -Hash functions are algorithms that take input data of differing size as an input, and it produces a fixed-size output. -The output of a hash function is typically represented as a sequence of numbers and letters. Hash functions are commonly used in computer science for various purposes, such as ensuring data integrity, securing storing passwords, and creating unique identifiers for data. - -vechain sdk supports _blake2b256 and _keccak256 hash functions. - -### Blake2b256 - -Blake2b256 is a specific type of hash function known for its speed and security. It takes any input data and generates a 256-bit (32-byte) hash value. The _blake2b256 part refers to the specific design of the algorithm, and the 256 indicates the length of the resulting hash code. Blake2b256 is widely used in cryptographic applications, blockchain technologies, and secure data storage. - -```typescript { name=blake2b256, category=example } -// Input of hash function must be an expression representable as an array of bytes. -// The class Txt assures a consistent byte encoding for textual strings. -const toHash = Txt.of('hello world'); - -const hash = Blake2b256.of(toHash.bytes); -``` - -### Keccak256 - -Keccak256 is another type of hash function, and it's particularly well-known for its use in the blockchain world, specifically in cryptocurrencies like Ethereum. Similar to Blake2b256, Keccak256 also takes input data and generates a 256-bit (32-byte) hash value. The Keccak part refers to the family of algorithms, and again, 256 denotes the length of the output hash code. - -```typescript { name=keccak256, category=example } -// Input of hash function must be an expression representable as an array of bytes. -// The class Txt assures a consistent byte encoding for textual strings. -const toHash = Txt.of('hello world'); - -// -const hash = Keccak256.of(toHash.bytes); -``` - -## Public key cryptography - -vechain sdk uses Secp256k1 to handle public key cryptography. - -Secp256k1 is a specific elliptic curve used in public key cryptography. It is defined by the standard organization "Standards for Efficient Cryptography Group" (SECG) and is particularly well-known for its use in cryptocurrencies, most notably Bitcoin. - -Secp256k1 is mainly used for generating public and private key pairs in cryptographic systems. It is a critical component in securing blockchain networks and other applications where digital signatures and secure transactions are required. The security of Secp256k1 is based on the difficulty of solving certain mathematical problems related to elliptic curves, making it highly resistant to attacks. - -* **Key Generation**: In Secp256k1, the public and private keys are mathematically related. The private key is a randomly generated 256-bit (32-byte) integer, while the public key is derived from the private key using the elliptic curve multiplication operation defined by the Secp256k1 curve. This process ensures that the public key can be calculated from the private key, but it is computationally infeasible to deduce the private key from the public key. -* **Digital Signatures**: An essential feature of Secp256k1 is generating and verifying digital signatures, public key cryptography. To sign a message, the private key holder performs a mathematical operation involving the message and the private key to produce a signature. The signature, along with the original message, can be publicly verified using the corresponding public key. This process ensures the authenticity and integrity of the message without revealing the private key. -* **Security Considerations**: The security of Secp256k1 relies on the difficulty of the elliptic curve discrete logarithm problem. Breaking this problem requires an impractical amount of computational power, making Secp256k1 a secure choice for cryptographic applications, including blockchain networks. - -```typescript { name=secp256k1, category=example } -// 1 - Generate a private key. - -const privateKey = await Secp256k1.generatePrivateKey(); -console.log('Private key:', Hex.of(privateKey).toString()); -// Private key: ...SOME_PRIVATE_KEY... - -// 2 - Derive the public key and address from private key. -// By default, the key is returned in compressed form. - -const publicKey = Secp256k1.derivePublicKey(privateKey); -const userAddress = Address.ofPublicKey(publicKey).toString(); -console.log('User address:', userAddress); -// User address: 0x...SOME_ADDRESS... - -// 3 - Sign message - -const messageToSign = Txt.of('hello world'); -const hash = Keccak256.of(messageToSign.bytes); -console.log(`Hash: ${hash.toString()}`); - -const signature = Secp256k1.sign(hash.bytes, privateKey); -console.log('Signature:', Hex.of(signature).toString()); -// Signature: ...SOME_SIGNATURE... -``` - diff --git a/docs/debug.md b/docs/debug.md deleted file mode 100644 index 15ce3c891..000000000 --- a/docs/debug.md +++ /dev/null @@ -1,208 +0,0 @@ ---- -description: Thor debug functionalities. ---- - -# Debug - -The [DebugModule](../packages/network/src/thor-client/debug/debug-module.ts) -class encapsulates functionality to debug the VeChainThor blockchain. - -The module provides methods to interact with the debug end points provided by - -* [**Retrieve Storage Range**](#retrieve-storage-range) - https://testnet.vechain.org/doc/swagger-ui/#/Debug/post_debug_storage_range -* [**Trace Contract Call**](#trace-contract-call) - https://testnet.vechain.org/doc/swagger-ui/#/Debug/post_debug_tracers_call -* [**Trace Transaction Clause**](#trace-transaction-clause) - https://testnet.vechain.org/doc/swagger-ui/#/Debug/post_debug_tracers - -## Retrieve Storage Range - -The `retrieveStorageRange` method provides information about the storage range of an account, -including the nextKey which is a string that can be null, and storage which is an object. - -In this example the `thorClient` connects to the *testnet* to retrieve the storage range for the coordinates passed -as `input` parameter. - -```typescript { name=debug-retrieve-storage-range, category=example } -// 1 - Create thor client for testnet -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Retrieve the storage range. -const result = await thorClient.debug.retrieveStorageRange({ - target: { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 0, - clauseIndex: 0 - }, - options: { - address: Address.of('0x0000000000000000000000000000456E65726779'), - keyStart: BlockId.of( - '0x0000000000000000000000000000000000000000000000000000000000000000' - ), - maxResult: 10 - } -}); - -// 3 - Print the result. -console.log(result); -``` - -
-The result will show the storage. - -```json -{ - storage: { - '0x004f6609cc5d569ecfdbd606d943edc5d83a893186f2942aef5e133e356ed17c': { - key: '0x9a92ca715ec8529b3ee4dbefd75e142176b92c3d93701808be4e36296718a5f3', - value: '0x000000000000000000000000000000000000046ff5af2138c51ba45a80000000' - }, - '0x0065bf3c383c7f05733ee6567e3a1201970bb5f4288d1bdb6d894167f8fc68dd': { - key: '0xf3dfa1b3c541595cd415aef361e508553fc80af15b3e2e0d9a4e2408f2111ed8', - value: '0xfffffffffffffffffffffffffffffffffffffffffffffe280bc404dc5470db3e' - }, - '0x01783f86c9e29f37f3277ed5abb62353ef8baf304337e511f1b5edefc9756b23': { - key: '0x01cfb1f8b52bdbeb1178ba8fc499479815330143d1acddb9c9d5686cd596ec24', - value: '0x0000000000000000000000000000000000000010000000000000000000000000' - }, - '0x0195180093382541d5396e797bd49250b1664fe8db68ff5c1d53ca95046f4549': { - key: '0x3f4626c77582db20d0d690ce3ad9bfde8f9dd508c0212a187684678bd9dc397a', - value: '0x000000000000000000000000000000000000000082eed4d8eb7286de6e540000' - }, - '0x02631b1c9d1e3f1360c4c6ee00ea48161dc85a0e153a0a484429bbcef16e581e': { - key: '0xc5e3f1ff368ddfee94124549ec19d8a50547b5cb0cc55ba72188b7159fb3ab3f', - value: '0x00000000000000000000000000000000000000000052b7d2dcc80cd2e4000000' - }, - '0x038658243306b2d07b512b04e6ddd4d70c49fd93969d71d51b0af7cf779d1c8f': { - key: '0x87b232cdb2002f97b61df380acf088f13e5006543d63780567aa2b886c6a1a90', - value: '0x00000000000000000000000000000000000000000052b7cd7100aea580f00000' - }, - '0x03969104d4e5233e212c939a85ef26b8156e2fbb0485d6d751c677e854e9ba55': { - key: '0xa887493a2b531915738a065a24263abae3722b9a8928a96c14c1f52a05964f23', - value: '0x00000000000000000000000000000000000000000000003635c9adc5dea00000' - }, - '0x04379cd040e82a999f53dba26500b68e4dd783b2039d723fe9e06edecfc8c9f1': { - key: '0x831ade39167b84e87f89fd4cd0bcec5783d2281fe44d2bc6cb93daaff46d569e', - value: '0x000000000000000000000000000000000000000000002a1b4ae1206dd9bd0000' - }, - '0x0465f4b6f9fccdb2ad6f4eac8aa7731bfe4c78f6cf22f397b5ef10398d4d5771': { - key: '0x5d56afd38de44f293bdce388b7d98120f55971a0f3a608797f1ddaced0f2b047', - value: '0x00000000000000000000000000000000000000000052b7c8053950781de00000' - }, - '0x04af8500fb85efaaa5f171ef60708fc306c474011fabb6fbafcb626f09661a01': { - key: '0x136aee904ebcade77dc8d3c6e48a2365b1d9dff83f78eb90d2f6e5ef4a6466c6', - value: '0x000000000000000000000000008ca1a3b5cbedeb0f1a0900000080845b322ac0' - } - }, - nextKey: '0x04e9569439bd218fce594dbd705b41f2afe6b6d8abcb9c5aaa5b1a52b7ab7cea' -} -``` -
- -## Trace Contract Call - -The `traceContractCall` traces the contract call execution. - -In this example the `thorClient` connects to the *testnet* to trace the contract at the coordinates specified in -the `input` parameter. - -```typescript { name=debug-trace-contract-call, category=example } -// 1 - Create thor client for testnet -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Trace the contract call. -const result = await thorClient.debug.traceContractCall( - { - target: { - to: Address.of('0x0000000000000000000000000000456E65726779'), - data: HexUInt.of( - '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000' - ), - value: VET.of(0) - }, - options: { - caller: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - gasPayer: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - expiration: 18, - blockRef: '0x0101d05409d55cce' - }, - config: {} - }, - // Note that in the testnet only the 'call' option is available. - 'call' -); - -// 3 - Print the result. -console.log(result); -``` - -
-The result shows the trace, here only the first element is shown. - -```json -{ - gas: 0, - failed: false, - returnValue: '0000000000000000000000000000000000000000000000000000000000000001', - structLogs: [ - { - pc: 0, - op: 'PUSH1', - gas: 50000000, - gasCost: 3, - depth: 1, - stack: [] - } - ] -} -``` -
- -## Trace Transaction Clause - -The `traceTransactionClause` method trace the transactions specified in the clause at the -coordinates expressed in the `input` parameter. - -In this example the `thorClient` connects to the *testnet* to trace the clause at the coordinates specified in -the `input` parameter. - -```typescript { name=debug-trace-transaction-clause, category=example } -// 1 - Create thor client for testnet -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Trace the clause. -const result = await thorClient.debug.traceTransactionClause( - { - target: { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: BlockId.of( - '0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f' - ), - clauseIndex: 0 - }, - config: {} - }, - 'call' as TracerName -); - -// 3 - Print the result. -console.log(result); -``` - -
-The result shows the following. - -```json -{ - from: '0x105199a26b10e55300cb71b46c5b5e867b7df427', - gas: '0x8b92', - gasUsed: '0x50fa', - to: '0xaa854565401724f7061e0c366ca132c87c1e5f60', - input: '0xf14fcbc800d770b9faa11ba944366f3e7a14c166f780ece542e557e0b7fe4870fcbe8dbe', - value: '0x0', - type: 'CALL' -} -``` -
diff --git a/docs/diagrams/architecture/accounts-module.md b/docs/diagrams/architecture/accounts-module.md deleted file mode 100644 index ba63acf06..000000000 --- a/docs/diagrams/architecture/accounts-module.md +++ /dev/null @@ -1,33 +0,0 @@ -```mermaid -classDiagram - class AccountData { - <> - string balance - string energy - boolean hasCode - } - class AccountDetails { - VET vet - VTHO vtho - AccountDetails constructor(AccountData accountData) - } - class AccountInputOptions { - <> - Revision revision - } - class AccountsModule { - AccountModule constructor(HttpClient httpClient) - Promise~AccountDetail~ getAccount(Address address, AccountInputOptions options) - Promise~HexUInt~ getBytecode(Address adderess, AccountInputOptions options) - Promise~HexUInt~ getStorageAt(Address address, BlockId blockId, AccountInputOptions options) - } - namespace http { - class HttpClient { - <> - } - } - AccountData <|-- AccountDetails - AccountDetails <|.. AccountsModule - AccountInputOptions o-- AccountsModule - HttpClient o-- AccountsModule -``` diff --git a/docs/diagrams/architecture/certificate.md b/docs/diagrams/architecture/certificate.md deleted file mode 100644 index 8f6afde4a..000000000 --- a/docs/diagrams/architecture/certificate.md +++ /dev/null @@ -1,25 +0,0 @@ -```mermaid -classDiagram - class Certificate { - +boolean isSigned() - +Certificate of(CertificateData data)$ - +Certificate sign(Uint8Array privateKey) - +void verify() - } - class CertificateData { - <> - +string domain - +Payload payload - +string purpose - +string|undefined signature - +string signer - +number timestamp - } - class Payload { - <> - +string content - +string type - } - CertificateData <|.. Certificate - CertificateData "1" ..|> "1" Payload -``` diff --git a/docs/diagrams/architecture/core-package.md b/docs/diagrams/architecture/core-package.md deleted file mode 100644 index 00f279607..000000000 --- a/docs/diagrams/architecture/core-package.md +++ /dev/null @@ -1,57 +0,0 @@ -# Core Package C4 Architecture diagram -Main diagram for the `core package`. -It represents the architecture of the `core package` with its most important components. - -```mermaid -C4Context - title "Vechain SDK architecture overview: core package" - - Boundary(core, "core", "package") { - Boundary(core_modules, "Core modules") { - System(abi, "ABI module", "Handle all ABI related operations.") - Boundary(certificate_module, "Certificate module", "Handle certificate related operations.") { - System(Certificate, "Certificate class", "Handle certificate related operations.") - } - System(contract, "Smart contract module", "Handle smart contract related operations.") - System(encoding, "RLP encoding module", "Handle RLP encoding related operations.") - Boundary(hdkey, "HDKey module", "Handle Hierarchical Deterministic Key related operations.") { - System(KDKey, "HDKey class", "Handle Hierarchical Deterministic Key related operations.") - } - System(keystore, "Keystore module", "Handle keystore related operations.") - Boundary(secp256k1, "Secp256k1 module", "Handle cryprographic operations.") { - System(Secp256k1, "Secp256k1 class", "Handle SECP256K1 related operations.") - } - Boundary(transaction, "Transaction module", "Handle transactions with Thor.") { - System(Clause, "Clause class", "Handles clause related operations.") - System(Transaction, "Transaction class", "Handle transaction related operations.") - } - Boundary(vcdm, "VeChain Data Model module", "Provide types and methods to represent the data in Thor.") { - Boundary(account, "Account module", "Handle account related operations.") { - System(Account, "Account class", "Handle account related operations.") - } - System(Address, "Address class", "Handle address related operations.") - System(BloomFilter, "BloomFilter class", "Handle Bloom filter related operations.") - Boundary(currency, "Currency module", "Handle monetary amount representation.") { - System(Coin, "Coin class", "Implements currency properties and base methods common to currencies.") - System(Units, "Units", "Format and parse currency units (magnitude).") - System(VET, "VET class", "Represent VET monetary amounts.") - System(VTHO, "VTHO class", "Represent VTHO monetary amounts.") - } - System(FixedPointNumber, "FixedPointNumber class", "Handle Fixed Point Number math.") - Boundary(hash, "Hash module", "Provide hashing algorithms.") { - System(Blake2b256, "Blake2b256 class") - System(Keccak, "Blake2b256 class") - System(Sha256, "Sha256 class") - } - System(Hex, "Hex class", "Handle data in hexadecimal representation.") - System(HexInt, "HexInt class", "Handle the hexadecimal representation
for integer values.") - System(HexUInt, "HexUInt class", "Handle the hexadecimal representation
for unsigned integer (natural number) values.") - System(Mnemonic, "Mnemonic class", "Handle all BIP32 mnemonic related operations.") - System(Quantity, "Quantity class", "Represent Thor quantities.") - System(Revision, "Revision class", "Represents a revision for a Thor transaction or block.") - } - } - } - - UpdateLayoutConfig($c4ShapeInRow="2", $c4BoundaryInRow="1") -``` diff --git a/docs/diagrams/architecture/debug-module.md b/docs/diagrams/architecture/debug-module.md deleted file mode 100644 index 902972981..000000000 --- a/docs/diagrams/architecture/debug-module.md +++ /dev/null @@ -1,93 +0,0 @@ -```mermaid -classDiagram - class ContractTraceTarget { - <> - Address|null to - Hex data - VET value - } - class ContractTraceOptions { - <> - } - class DebugModule { - DebugModule constructor(HttpClient httpClient) - Promise~RetrieveStorageRange~ retrieveStorageRange(RetrieveStorageRangeInput input) - Promise~TraceReturnType~T~~ traceContractCall(TraceContractCallInput input, TracerName name) - Promise~TraceReturnType~T~~ traceTransactionClause(TraceTransactionClauseInput input, TracerName name) - } - namespace http { - class HttpClient { - <> - } - } - class RetrieveStorageRange { - string|null nestKey - Record~string, Record~ key, value~storage~~ - } - class RetrieveStorageRangeInput { - <> - TransactionTraceTarget target - RetrieveStorageRangeOptions options - } - class RetrieveStorageRangeOptions { - <> - Address address - BlockId blockId - number maxResult - } - class TraceContractCallInput { - <> - ContractTraceTarget target - ContractTraceOptions options - TracerConfig config - } - class TraceTransactionClauseInput { - <> - TransactionTraceTarget target - TracerConfig config - } - class TraceReturnType~TracerName|undefined~ - namespace transactions-module { - class SimulateTransactionOptions { - <> - } - } - class TracerConfig~TracerName|undefined~ { - <> - } - class TracerName { - <> - 4byte - call - empty - evmdis - noop - null - opcount - prestate - trigram - unigram - } - class TransactionTraceTarget { - <> - BlockId blockId - number clauseIndex - BlockId|number transaction - } - ContractTraceTarget --* TraceContractCallInput - ContractTraceOptions --* TraceContractCallInput - HttpClient o-- DebugModule - RetrieveStorageRange <|.. DebugModule - RetrieveStorageRangeInput --* DebugModule - RetrieveStorageRangeOptions --* RetrieveStorageRangeInput - string <|-- TracerName - SimulateTransactionOptions <|.. ContractTraceOptions - TraceContractCallInput --* DebugModule - TraceTransactionClauseInput --* DebugModule - TransactionTraceTarget --* RetrieveStorageRangeInput - TracerConfig --* TraceContractCallInput - TracerConfig --* TraceTransactionClauseInput - TracerName <|.. TracerConfig - TracerName <|.. TraceReturnType - TraceReturnType <|.. DebugModule -``` diff --git a/docs/diagrams/architecture/errors-package.md b/docs/diagrams/architecture/errors-package.md deleted file mode 100644 index 47c1080a8..000000000 --- a/docs/diagrams/architecture/errors-package.md +++ /dev/null @@ -1,54 +0,0 @@ -# Errors Package C4 Architecture diagram -Main diagram for the `errors package`. -It represents the architecture of the `errors package` with its most important components. - -```mermaid -C4Context - title "Vechain SDK architecture overview: errors package" - - Boundary(b0, "errors", "package") { - Boundary(b1, "Model") { - Boundary(b2, "Core") { - System(abi, "Abi", "Abi related errors") - System(address, "Address", "Address related errors") - System(bloom, "Bloom", "Bloom related errors") - System(certificate, "Certificate", "Certificate related errors") - System(contract, "Contract", "Contract related errors") - System(data, "Data", "Data related errors") - System(hdnode, "HDNode", "HDNode related errors") - System(keystore, "Keystore", "Keystore related errors") - System(rlp, "RLP", "RLP related errors") - System(secp256k1, "Secp256k1", "Secp256k1 related errors") - System(transaction, "Transaction", "Transaction related errors") - } - - Boundary(b3, "EIP1193") { - System(eip1193, "EIP1193", "EIP1193 related errors") - } - - Boundary(b4, "Generic") { - System(function, "Function", "Function related errors") - } - - Boundary(b5, "Json-RPC") { - System(json-rpc, "Json-RPC", "Json-RPC related errors") - } - - Boundary(b6, "Network") { - System(http-client, "HTTPClient", "HTTPClient related errors") - System(poll, "Poll", "Poll related errors") - } - } - - Boundary(b7, "Types") { - System(error-types, "ErrorTypes", "The error types from the error code") - } - - Boundary(b8, "Utils") { - System(assert, "Assert", "Assert that the condition is true, otherwise throw an error") - System(error-builder, "ErrorBuilder", "Build error object according to the error code provided") - System(error-message-builder, "ErrorMessageBuilder", "Build an error message") - System(hardhat, "Hardhat", "Build a hardhat error") - } - } -``` \ No newline at end of file diff --git a/docs/diagrams/architecture/hardhat-plugin-package.md b/docs/diagrams/architecture/hardhat-plugin-package.md deleted file mode 100644 index ca8b58105..000000000 --- a/docs/diagrams/architecture/hardhat-plugin-package.md +++ /dev/null @@ -1,14 +0,0 @@ -# Hardhat Plugin Package C4 Architecture diagram -Main diagram for the `hardhat-plugin package`. -It represents the architecture of the `hardhat-plugin package` with its most important components. - -```mermaid -C4Context - title "Vechain SDK architecture overview: hardhat-plugin package" - - Boundary(b0, "hardhat-plugin", "package") { - Boundary(b1, "Helpers") { - System(provider-helper, "Provider Helper", "Create a wallet from the hardhat network configuration") - } - } -``` \ No newline at end of file diff --git a/docs/diagrams/architecture/hdkey.md b/docs/diagrams/architecture/hdkey.md deleted file mode 100644 index 369e1ec5e..000000000 --- a/docs/diagrams/architecture/hdkey.md +++ /dev/null @@ -1,57 +0,0 @@ -```mermaid -classDiagram - namespace scure-32bip { - class scure-bip32_HDKey["HDKey"] { - +Uint8Array|null chainCode - +number: fingerprint - +number depth - +Uint8Array|undefined identifier - +number index - +number parentFingerprint - +Uint8Array|undefined pubKeyHash - +Uint8Array|undefined privateKey - +Uint8Array|undefined publicKey - +Uint8Array|undefined privateExtendedKey - +Uint8Array|undefined publicExtendedKey - +Versions version - +scure-bip32_HDKey constructor(HDKeyOpt opt) - +scure-bip32_HDKey derive(string path) - +scure-bip32_HDKey deriveChild(string path) - +scure-bip32_HDKey fromMasterSeed(Uint8Array seed, Versions versions?) - +scure-bip32_HDKey fromExtendedKey(string base58key, Versions version?) - +scure-bip32_HDKey fromJSON(Xpriv: json) - +Uint8Array sign(Uint8Array hash) - +boolean verify(Uint8Array hash, Uint8Array signature) - +scure-bip32_HDKey wipePrivateData() - } - class HDKeyOpt { - <> - +Versions versions? - +number depth? - +number index? - +number parentFingerprint? - +Uint8Array chainCode? - +Uint8Array publicKey? - +Uint8Array|bigint privateKey? - } - class Versions { - <> - +number private - +number public - } - class Xpriv { - <> - +string xpriv - } - } - class HDKey { - +HDKey fromMnemonic(string[] words, string path)+ - +HDKey fromPrivateKey(Uint8Array publicKey, Uint8Array chainCode)+ - +HDKey fromPublicKey(Uint8Array publicKey, Uint8Array chainCode)+ - +boolean isDerivationPathValid(string derivationPath)+ - } - scure-bip32_HDKey <|-- HDKey - scure-bip32_HDKey "1" ..|> "1" Versions : has - scure-bip32_HDKey ..|> HDKeyOpt - scure-bip32_HDKey "1" <..> Xpriv -``` diff --git a/docs/diagrams/architecture/http.md b/docs/diagrams/architecture/http.md deleted file mode 100644 index 7cca9dbe4..000000000 --- a/docs/diagrams/architecture/http.md +++ /dev/null @@ -1,30 +0,0 @@ -```mermaid -classDiagram - class HttpClient { - <> - string baseUrl - Promise~unknown~ get(string path, HttpParams path) - Promise~unknown~ http(HttpMethod method, string path, HttpParams path) - Promise~unknown~ post(string path, HttpParams path) - } - class HttpMethod { - <> - GET$ - POST$ - } - class HttpParams { - <> - unknown body - Record~string, string~ headers - Record~string, string~ query - validateResponse(Record~string, string~ headers) - } - class SimpleHttpClient { - number DEFAULT_TIMEOUT$ - HeadersInit headers - number timeout - } - HttpMethod o-- HttpClient - HttpParams *-- HttpClient - HttpClient <|.. SimpleHttpClient -``` diff --git a/docs/diagrams/architecture/logging-package.md b/docs/diagrams/architecture/logging-package.md deleted file mode 100644 index 2ee8f257c..000000000 --- a/docs/diagrams/architecture/logging-package.md +++ /dev/null @@ -1,16 +0,0 @@ -# Logging Package C4 Architecture diagram -Main diagram for the `logging package`. -It represents the architecture of the `logging package` with its most important components. - -```mermaid -C4Context - title "Vechain SDK architecture overview: logging package" - - Boundary(b0, "logging", "package") { - Boundary(b1, "Logger") { - System(error-logger, "Error Logger", "Error logger internal function") - System(log-logger, "Log Logger", "Log logger internal function") - System(warning-logger, "Warning Logger", "Warning logger internal function") - } - } -``` \ No newline at end of file diff --git a/docs/diagrams/architecture/network-package.md b/docs/diagrams/architecture/network-package.md deleted file mode 100644 index c80e65a1d..000000000 --- a/docs/diagrams/architecture/network-package.md +++ /dev/null @@ -1,70 +0,0 @@ -# Network Package C4 Architecture diagram -Main diagram for the `network package`. -It represents the architecture of the `network package` with its most important components. - -```mermaid -C4Context - title "Vechain SDK architecture overview: network package" - - Boundary(b0, "network", "package") { - Boundary(b1, "Assertions") { - System(transactions, "Transactions", "Transaction related assertions") - } - - Boundary(b2, "Thor Client") { - System(accounts_module, "Accounts Module", "Provides API methods for account management") - System(blocks_module, "Blocks Module", "Enables querying and interacting with blockchain blocks") - System(contracts_module, "Contracts Module", "Handles smart contract interactions including deployment and execution") - System(debug_module, "Debug Module", "Encapsulates functionality to handle Debug on the VeChainThor blockchain") - System(gas_module, "Gas Module", "Handles gas related operations and provides convenient methods for estimating the gas cost of a transaction") - System(logs_module, "Logs Module", "Facilitates retrieval and monitoring of transaction logs") - System(nodes_module, "Nodes Module", "Manages node operations such as health checks and network status") - System(transactions_module, "Transactions Module", "Handles creation, signing, and broadcasting of transactions") - } - - Boundary(b3, "Utils") { - System(const, "Const", "Constants about default timout, regex and healthcheck timing") - System(helpers, "Helpers", "Conversion helpers") - System(http, "HTTP", "Customized HTTP client for efficient network request handling") - System(poll, "Poll", "Synchronous and Asynchronous Event Polling") - System(subscriptions, "Subscriptions", "Contains functions for obtaining URLs for subscribing to events through a websocket connection") - System(thorest, "Thorest", "Endpoints for the REST API") - } - - Boundary(b4, "Provider") { - Boundary(b41, "EIP-1193") { - System(types, "Types", "Interface for EIP-1193 provider request arguments") - } - - Boundary(b42, "Providers") { - System(hardhat-provider, "Hardhat Provider", "It exposes the interface that Hardhat expects, and uses the VeChainProvider as wrapped provider") - System(vechain-provider, "Vechain Provider", "Core provider class for vechain") - } - - Boundary(b43, "Utils") { - System(const, "Const", "Commonly used constants") - System(formatter, "Formatter", "Functions used for formatting") - System(helper, "Helper", "Helpers functions") - System(rpc-mapper, "RPC Mapper", "Map of RPC methods to their implementations with the SDK") - } - - Boundary(b44, "Provider Internal Wallets") { - System(provider-internal-base-wallet, "BaseProviderInternalWallet", "Basical wallet a provider can use internally") - System(provider-internal-hd-wallet, "HDProviderInternalWallet", "HD wallet a provider can use internally") - } - } - - Boundary(b5, "Signer") { - Boundary(b51, "Signers") { - System(signers, "Signers", "List of available signers") - } - } - - Boundary(b6, "External Blockchain Interaction") { - System_Ext(VeChainThor, "Thor Blockchain", "Represents the blockchain platform with which the SDK interacts") - } - - } - - UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1") -``` \ No newline at end of file diff --git a/docs/diagrams/architecture/network.md b/docs/diagrams/architecture/network.md deleted file mode 100644 index a80fb41ec..000000000 --- a/docs/diagrams/architecture/network.md +++ /dev/null @@ -1,93 +0,0 @@ -```mermaid -classDiagram - class AccountsModule { - HttpClient httpClient - AccountsModule constructor(HttpClient httpClient) - Promise~AccountDetail~ getAccount(Address address, AccountInputOption options) - Promise~HexUInt~ getByteCode(Address address, AccountInputOption options) - Promise~HexUInt~ getStorageAt(Address address, ThorId position, AccountInputOptions options) - } - class BlocksModule { - HttpClient httpClient - BlocksModule constructor(HttpClient httpClient) - } - class ContractsModule { - } - class DebugModule { - HttpClient httpClient - DebugModule constructor(HttpClient httpClient) - Promise ~RetrieveStorageRange~ retrieveStorageRange(input: RetrieveStorageRangeInput) - Promise ~TraceReturnType~typeof name~~ traceContractCall(input: TraceContractCallInput, name: TracerName) - Promise~TraceReturnType~typeof name~~ traceTransactionClause(input: TraceTransactionClauseInput, name: TracerName) - } - class GasModule { - } - class HttpClient { - <> - string baseUrl - Promise~unknown~ get(string path, HttpParams path) - Promise~unknown~ post(string path, HttpParams path) - } - class LogsModule { - } - class NodesModule { - } - class RetrieveStorageRangeInput { - <> - TransactionTraceTarget target - RetrieveStorageRangeOptions options - } - class RetrieveStorageRange { - <> - string|null nextKey - Record~string, Record~string key, string value~~ - } - class ThorClient { - AccountModule accounts; - ThorClient at(string url, BlockModuleOptions options)$ - destroy() - } - class TraceContractCallInput { - <> - ContractTraceTarget target - ContractTraceOptions options - TracerConfig~typeof name~ config - } - class TraceTransactionClauseInput { - <> - TransactionTraceTarget target - TracerConfig~typeof name~ config - } - class TraceTransactionTarget { - <> - ThorId blockID - number|ThorId transaction - number clauseIndex - } - class TransactionsModule { - } - AccountsModule *-- ThorClient - BlocksModule *-- GasModule - BlocksModule *-- NodesModule - BlocksModule *-- ThorClient - BlocksModule *-- ThorClient - BlocksModule *-- TransactionsModule - ContractsModule *-- ThorClient - DebugModule *-- ThorClient - DebugModule *-- TransactionsModule - GasModule *-- ThorClient - HttpClient o-- AccountsModule - HttpClient o-- BlocksModule - HttpClient o-- DebugModule - HttpClient o-- ThorClient - LogsModule *-- ThorClient - NodesModule *-- ThorClient - RetrieveStorageRangeInput o-- DebugModule - TraceContractCallInput o-- DebugModule - TraceTransactionClauseInput o-- DebugModule - TraceTransactionTarget *-- RetrieveStorageRangeInput - TraceTransactionTarget *-- TraceTransactionClauseInput - TransactionsModule *-- ContractsModule - TransactionsModule *-- GasModule - TransactionsModule *-- ThorClient -``` diff --git a/docs/diagrams/architecture/rpc-proxy-package.md b/docs/diagrams/architecture/rpc-proxy-package.md deleted file mode 100644 index b636d0b6b..000000000 --- a/docs/diagrams/architecture/rpc-proxy-package.md +++ /dev/null @@ -1,12 +0,0 @@ -# RPC Proxy Package C4 Architecture diagram -Main diagram for the `rpc-proxy package`. -It represents the architecture of the `rpc-proxy package` with its most important components. - -```mermaid -C4Context - title "Vechain SDK architecture overview: rpc-proxy package" - - Boundary(b0, "rpc-proxy", "package") { - System(rpc-proxy, "PRC Proxy", "Proxy Thor's RESTful API to Eth JSON-RPC") - } -``` \ No newline at end of file diff --git a/docs/diagrams/architecture/secp256k1.md b/docs/diagrams/architecture/secp256k1.md deleted file mode 100644 index 1e422da9e..000000000 --- a/docs/diagrams/architecture/secp256k1.md +++ /dev/null @@ -1,14 +0,0 @@ -```mermaid -classDiagram - class Secp256K1 { - +Uint8Array compressPublicKey(Uint8Array publicKey)$ - +Uint8Array derivePublicKey(Uint8Array privateKey, boolean isCompressed)$ - +Promise~Uint8Array~ async generatePrivateKey()$ - +Uint8Array inflatePublicKey(Uint8Array publicKey)$ - +boolean isValidMessageHash(Uint8Array hash)$ - +boolean isValidPrivateKey(Uint8Array privateKey)$ - +Uint8Array randomBytes(number|undefined bytesLength?)$ - +Uint8Array recover(Uint8Array messageHash, Uint8Array sig)$ - +Uint8Array sign(Uint8Array messageHash, Uint8Array privateKey)$ - } -``` diff --git a/docs/diagrams/architecture/thor-client.md b/docs/diagrams/architecture/thor-client.md deleted file mode 100644 index f0a12ce3d..000000000 --- a/docs/diagrams/architecture/thor-client.md +++ /dev/null @@ -1,50 +0,0 @@ -```mermaid -classDiagram - namespace http { - class HttpClient - } - namespace account-module { - class AccountModule - } - namespace blocks-module { - class BlocksModule - } - namespace contracts-module { - class ContractsModule - } - namespace debug-module { - class DebugModule - } - namespace gas-module { - class GasModule - } - namespace logs-module { - class LogsModule - } - namespace nodes-module { - class NodesModule - } - namespace transactions-module { - class TransactionsModule - } - class ThorClient - AccountModule --* ThorClient - BlocksModule o-- LogsModule - BlocksModule o-- NodesModule - BlocksModule --* ThorClient - BlocksModule o-- TransactionsModule - ContractsModule --* ThorClient - DebugModule --* ThorClient - DebugModule o-- TransactionsModule - GasModule --* ThorClient - HttpClient o-- AccountModule - HttpClient o-- BlocksModule - HttpClient o-- DebugModule - HttpClient o-- ThorClient - LogsModule --* ThorClient - LogsModule o-- TransactionsModule - NodesModule --* ThorClient - TransactionsModule o-- ContractsModule - TransactionsModule o-- GasModule - TransactionsModule --* ThorClient -``` diff --git a/docs/diagrams/architecture/transaction.md b/docs/diagrams/architecture/transaction.md deleted file mode 100644 index 35bade25a..000000000 --- a/docs/diagrams/architecture/transaction.md +++ /dev/null @@ -1,72 +0,0 @@ -```mermaid -classDiagram - class Clause { - +FixedPointNumber amount() - +Clause callFunction(Address contractAddress, ABIFunction, functionABI, unknown[] args, VET amount, ClauseOptions: clauseOptions) - +Clause deployContract(HexUInt contractBytecode, DeployParams deployParams?, ClauseOptions clauseOptions?) - +Clause transferNFT(Address contractAddress, Address senderAddress, Address recipientAddress, HexUInt tokenId, ClauseOptions clauseOptions?) - +Clause transferToken(Address tokenAddress, Address: senderAddress, VTHO amount, ClauseOptions clauseOptions?) - +Cluase transferVET(Address recipientAddress, VET amount, ClauseOptions clauseOptions?) - } - class ClauseOption{ - <> - +string comment? - +boolean includeABI? - } - class DeployParams { - <> - ParamType[]|string[] types - string[] values - } - class Reserved { - <> - +number features? - +Uint8Array[] unused? - } - class Transaction { - +TransactionBody body - +Uint8Array encoded - +Address gasPayer - +Blake2b256 id - +VTHO intrisicGas - +boolean isDelegated - +boolean isSigned - +Address origin - +Uint8Array signature? - +Transaction decode(Uint8Array rawTransaction, boolean isSigned)$ - +Blake2b256 getTransactionHash(Address delegator?) - +VTHO intrinsicGas(TransactionClause[] clauses)$ - +boolean isValidBody(TransactionBody body)$ - +Transaction of(TransactionBody: body, Uint8Array signature?)$ - +Transaction sign(Uint8Array senderPrivateKey) - +Transaction signAsGasPayer(Address sender, Uint8Array gasPayerPrivateKey) - +Transaction signAsSender(Uint8Array senderPrivateKey) - +Transaction signAsSenderAndGasPayer(Uint8Array senderPrivateKey, Uint8Array gasPayerPrivateKey) - } - class TransactionBody { - <> - +string blockRef - +number chainTag - +TransactionClause[] clauses - +null|string dependsOn - +number expiration - +numer|string gas - +number gasPriceCoef - +number|string nonce - Reserved reserved? - } - class TransactionClause { - <> - +string abi? - +string comment? - +string data - +null|string to - +number|string value - } - Clause --> ClauseOption - Clause --> DeployParams - TransactionBody *-- Transaction - TransactionBody --* Reserved - TransactionClause *-- TransactionBody - TransactionClause <|.. Clause -``` diff --git a/docs/diagrams/architecture/vcdm.md b/docs/diagrams/architecture/vcdm.md deleted file mode 100644 index defbd82e3..000000000 --- a/docs/diagrams/architecture/vcdm.md +++ /dev/null @@ -1,239 +0,0 @@ -```mermaid -classDiagram - class ABI { - +ABI of(string|AbiParameter[] types, unknown[] values)$ - +ABI ofEncoded(string|AbiParameter[] types, string|Uint8Array[] dataEncoded)$ - +unknown[] parseObjectValues(object obj) - +ReturnType getFirstDecodedValue(object obj) - +Hex toHex() - } - class ABIContract { - +ABIContract ofAbi(ViemABI abi)$ - +ABIFunction getFunction(string name) - +ABIEvent getEvent(string name) - +Hex encodeFunctionInput(string functionName, unknown[] functionData) - +DecodeFunctionDataReturnType decodeFunctionInput(string functionName, Hex encodedFunctionInput) - +DecodeFunctionResultReturnType decodeFunctionOutput(string functionName, Hex encodedFunctionOutput) - +ABIEventData encodeEventLog(string eventName, unknown[] eventArgs) - +DecodeEventLogReturnType decodeEventLog(string eventName, ABIEventData eventToDecode) - +DecodeEventLogReturnType parseLog(Hex data, Hex[] topics) - } - class ABIEvent { - +DecodeEventLogReturnType parseLog(ViemABI abi, Hex data, Hex[] topics)$ - +DecodeEventLogReturnType decodeEventLog(ABIEventData event) - +EncodeEventTopicsReturnType encodeFilterTopics(TValue[] event) - +ABIEventData encodeEventLog(TValue[] dataToEncode) - } - class ABIFunction { - +DecodeFunctionDataReturnType decodeData(Hex data) - +Hex encodeData(TValue[] dataToEncode) - +DecodeFunctionResultReturnType decodeResult(Hex data) - } - class ABIItem { - <> - +string signatureHash() - +string format('json' | 'string' formatType) - +string ofSignature(new(signature: string) => T ABIItemConstructor, string signature)$ - } - class Account { - #address: Address - #balance: Currency - } - class Address { - +number DIGITS$ - +string checksum(HexUInt huint)$ - +boolean isValid(string exp)$ - +Address of(bigint|number|string|Uint8Array|HexUInt exp)$ - +Address ofPrivateKey(Uint8Array privateKey, boolean: isCompressed)$ - +Address ofPublicKey(Uint8Array privateKey)$ - } - class Blake2b256 { - +Blake2b256 of(bigint|string|Uint8Array|Hex exp)$ - } - class BlockId { - +boolean isValid0x(string exp) - +BlockId of(bigint|number|string|Uint8Array|HexInt exp)$ - } - class BlockRef { - +boolean isValid0x(string exp) - +BlockRef of(bigint|number|string|Uint8Array|HexInt exp)$ - } - class BloomFilter { - +number k - +number computeBestBitsPerKey(number k)$ - +number computeBestHashFunctionsQuantity(number m)$ - +boolean contains(Hex|Uint8Array key) - +boolean isJoinable(BloomFilter other) - +BloomFilter join(BloomFilter other) - +BloomFilter of(Hex[]|Uint8Array[] ...keys)$ - } - class Coin - class Contract - class Currency { - +Txt code - +FixedPointNumber value - } - class FixedPointNumber { - +bigint fractionalDigits - +bigint scaledValue - +FixedPointNumber NaN$ - +FixedPointNumber NEGATIVE_INFINITY$ - +FixedPointNumber ONE$ - +FixedPointNumber POSITIVE_INFINITY$ - +FixedPointNumber ZERO$ - +FixedPointNumber abs() - +null|number comparedTo(FixedPointNumber that) - +FixedPointNumber div(FixedPointNumber that) - +FixedPointNumber dp(bigint|number decimalPlaces) - +boolean eq(FixedPointNumber that) - +boolean gt(FixedPointNumber that) - +boolean gte(FixedPointNumber that) - +FixedPointNumber idiv(FixedPointNumber that) - +boolean isFinite() - +boolean isInfinite() - +boolean isInteger() - +boolean isIntegerExpression(string exp)$ - +boolean isNaN() - +boolean isNaturalExpression(string exp)$ - +boolean isNegative() - +boolean isNegativeInfinite() - +boolean isNumberExpression(string exp)$ - +boolean isPositive() - +boolean isPositiveInfinite() - +boolean isZero() - +boolean lt(FixedPointNumber that) - +boolean lte(FixedPointNumber that) - +FixedPointNumber minus(FixedPointNumber that) - +FixedPointNumber modulo(FixedPointNumber that) - +FixedPointNumber negated() - +FixedPointNumber of(bigint|number|string|FixedPointNumber exp)$ - +FixedPointNumber plus(FixedPointNumber that) - +FixedPointNumber pow(FixedPointNumber that) - +FixedPointNumber sqrt() - +FixedPointNumber times(FixedPointNumber that) - } - class Hex { - +Hex abs - +number sign - +Hex alignToBytes() - +Hex fit(number digits) - +boolean isValid(string exp)$ - +boolean isValid0x(string exp)$ - +Hex of(bigint|number|string|Uint8Array exp)$ - +Hex random(number bytes)$ - } - class HexInt { - +HexInt of(bigint|number|string|Uint8Array|Hex exp)$ - } - class HexUInt { - +HexUInt of(bigint|number|string|Uint8Array|HexInt exp)$ - } - class Keccak256 { - +Keccak256 of(bigint|number|string|Uint8Array|Hex exp)$ - } - class Mnemonic { - +Mnemonic of(string exp)$ - } - class Quantity { - +Quantity of(bigint|number exp)$ - } - class Revision { - +Revision BEST$ - +Revision FINALIZED$ - +boolean isValid(number|string value)$ - +Revision of(bigint|number|string|Uint8Array|Hex value)$ - } - class RLP { - +Uint8Array encoded - +RLPInput decoded - +Hex toHex() - +RLP of(RLPInput data)$ - +RLP ofEncoded(Uint8Array encodedData)$ - #packData(RLPValidObject obj, RLPProfile profile, string context)$ - #unpackData(RLPInput packed, RLPProfile profile, string context)$ - } - class RLPProfiler { - +RLPValueType object - +ofObject(RLPValidObject validObject, RLPProfile profile)$ - +ofObjectEncoded(RLPValidObject validObject, RLPProfile profile)$ - } - class Sha256 { - +Sha256 of(bigint|number|string|Uint8Array|Hex exp)$ - } - class String - class Txt { - +Txt of(bigint|number|string|Uint8Array exp)$ - } - class Units { - <> - +0 wei$ - +3 kwei$ - +6 mwei$ - +9 gwei$ - +12 szabo$ - +15 finney$ - +18 ether$ - +string formatEther(FixedPointNumber wei)$ - +string formatUnit(FixedPointNumber wei, Units unit)$ - +FixedPointNumber parseEther(string: ether)$ - +FixedPointNumber parseUnit(string exp, Unit unit)$ - } - class NetAddr { - +Uint8Array ipAddress - +number port - +NetAddr of(string exp) - +string toString() - } - class VeChainDataModel { - <> - +bigint bi - +Uint8Array bytes - +number n - +number compareTo(~T~ that) - +boolean isEqual(~T~ that) - +boolean isNumber() - } - class VET { - +Txt CODE$ - +bigint wei - +VET of(bigint|number|string|FixedPointNumber value)$ - } - class VTHO { - +Txt CODE$ - +bigint wei - +VTHO of(bigint|number|string|FixedPointNumber value)$ - } - ABI <|-- ABIContract - ABI <|-- ABIItem - ABIItem <|-- ABIEvent - ABIItem <|-- ABIFunction - Account "1" ..|> "1" Address: has - Account "1" ..|> "1" Currency: has - Account <|-- Contract - Coin <|-- VET - Coin <|-- VTHO - Currency <|.. Coin - FixedPointNumber <|-- VET - FixedPointNumber <|-- VTHO - Hex <|-- HexInt - HexInt <|-- HexUInt - HexUInt <|-- Address - HexUInt <|-- Blake2b256 - HexUInt <|-- BlockId - HexUInt <|-- BlockRef - HexUInt <|-- Keccak256 - HexUInt <|-- Quantity - HexUInt <|-- Sha256 - RLP <|-- RLPProfiler - String <|-- Txt - Txt <|-- Revision - Txt <|-- Mnemonic - VeChainDataModel <|.. ABI - VeChainDataModel <|.. BloomFilter - VeChainDataModel <|.. Currency - VeChainDataModel <|.. FixedPointNumber - VeChainDataModel <|.. Hex - VeChainDataModel <|.. RLP - VeChainDataModel <|.. Txt - VeChainDataModel <|.. NetAddr -``` diff --git a/docs/diagrams/v2/core/transaction/transaction_id.md b/docs/diagrams/v2/core/transaction/transaction_id.md deleted file mode 100644 index 346b8ecb9..000000000 --- a/docs/diagrams/v2/core/transaction/transaction_id.md +++ /dev/null @@ -1,197 +0,0 @@ -# Transaction IDs May Collide - -The class [`Transaction`](../../../../../packages/core/src/transaction/Transaction.ts) -provides the computed property `Transaction.id()` to compute the transaction's identifier -as (l.242) - -```typescript -public get id(): Blake2b256 { - if (this.isSigned) { - return Blake2b256.of( - nc_utils.concatBytes( - this.getTransactionHash().bytes, - this.origin.bytes - ) - ); - } - throw new UnavailableTransactionField( - 'Transaction.id()', - 'not signed transaction: id unavailable', - {fieldName: 'id'} - ); -} -``` - -The following flowchart shows the inputs, methods and properties involved. - -```mermaid -flowchart TD - start((Start)) - stop(((stop))) - body[/TransactionBody/] - subgraph origin["Transaction.origin()"] - origin_txHash[["getTransactionHash()"]] - origin_signature[\signature\] - origin_recover[["Secp256k1.recover(txHash,signature)"]] - origin_address["Address.ofPublicKey(publicKey)"] - origin_recover --> origin_address - origin_signature --> origin_recover - - end - subgraph tx_hash["Transaction.getTransactionHash(gasPayer?)"] - txHash_encodeHash[Blake256.of] - txHash_encodePayer[Blake2b256.of] - txHash_encode[[encode]] - txHash_payer?{gasPayer?} - txHash_payer[/gasPayer/] - txHash_encode --> txHash_encodeHash - txHash_encodeHash --> txHash_payer? - txHash_payer? -. yes .-> txHash_encodePayer - txHash_payer --> txHash_encodePayer - end - subgraph tx_id["Transaction.id()"] - id_hash[Blake2b256.of] - id_origin[["origin()"]] - id_txHash[["getTransactionHash()"]] - id_origin --> id_hash - id_txHash --> id_hash - end - body --> txHash_encode - id_hash --> stop - origin_address --> id_origin - origin_txHash --> origin_recover - start --> body - txHash_encodePayer --> id_txHash - txHash_payer? -- no --> id_txHash - -``` - -## Not Delegated Transaction ID - -NCC claims - -_1. ... The transaction signature is not incorporated into the hash computation; only the transaction hash as well as -the -originator’s address are taken into account._ (p.12) - -but we observe **the origin's address is derived by the origin's signature because the computed property** -`Transaction.origin` (l.304). - -```typescript -public get origin(): Address -{ - if (this.signature !== undefined) { - return Address.ofPublicKey( - // Get the origin public key. - Secp256k1.recover( - this.getTransactionHash().bytes, - // Get the (r, s) of ECDSA digital signature without gas payer params. - this.signature.slice(0, Secp256k1.SIGNATURE_LENGTH) - ) - ); - } - throw new UnavailableTransactionField( - 'Transaction.origin()', - 'not signed transaction, no origin', - {fieldName: 'origin'} - ); -} -``` - -NCC clams - -_ ... if a transaction was signed by a signer multiple times (or in case of different -transactions with colliding getTransactionHash()), the resulting signed transactions would -have the same ID._ (p.13) - -We observe if the transaction is signed multiple times, it results the same id if the -`TransactionBody` object is equal and the origin's signature is the same. - -### Question - ask NCC - -Since the origin's address is a function of the origin's signature, **what is the difference -between to compute BLAKE2B256** - -* **from the transaction hash and the origin's signature**, and -* **from the transaction hash and the origin's address derived from its signature?** - ---- - -## Delegated Transaction ID - -NCC claims - -_2. In the case of delegated transactions, the function above also fails to take the gas -payer’s (aka delegator’s) signature and address into account._ (p.13) - -We observe the claim is true: in the `Transaction.id` computed property at l.246 - -```typescript -this.getTransactionHash().bytes -``` - -does not pass the `gasPayer` as argument, hence NCC is right to claim - -_... if a given to-be-delegated transaction were -signed by multiple different gas payers, the resulting IDs would all be equal (and would also -be equal to the ID of a non-delegated transaction)._ (p.13) - -We observe the `reserved` flag in the `Transaction` body participates in the computed hash, hence -a delegated transaction should result in a different id then a not delegated transaction, -this is the only input in the BLAKE2B256 hash to differentiate the id transactions of the same -`TransactionBody` between the cases when the transaction is delegated and when is not. Since a transaction must -include the origin signature and if is delegated, must include the `reserved` property and a gas payer's signature, -we do not think there is a real useful case to forge the `reserved` field, nevertheless we think ** - -NCC recommends - -_Consider modifying the id() function such that it includes the signer’s signature, and the -delegator’s (wrong name for the "gas payer") address and signature, if the transaction is delegated._ (p.13) - -We think this should be done, but we must evaluate what is done in Thor as well and if the Thor ID algorithm must change -following the NCC recommendations. - -NCC recommends - -_... reflect on whether the id() function should product a different digest than the -getTransactionHash() of a delegated transaction._ (p.13) - -**We think the id of delegated transaction should be different form its transaction's hash, we observe they are -different - matter of test - because the `Transaction.id` hashes the result of `Transaction.getTransactionHash` -concatenated with the transaction;s origin address.** - ---- - -### Question - ask the protocol team - -**The `gasPayer` signature or its derived address is never considered in the computation of the transaction hash!** - -* **What is the algorithm used in the protocol**? - * **Is the same algorithm implemented the in e SDK?** - * **The algorithm in the protocol does consider the `taxPayer` address and signature in the computation of the id?** - -**According to our tests, Thor and SDK produce the same id for the same transaction!** ---- - -## ID Equality - -We presume is correct to state equal -[`TransactionBody`](../../../../../packages/core/src/transaction/TransactionBody.d.ts) -instances signed by the same origin and gas payer should return the same id. -Since Thor rejects a transaction with a spent id, the above criteria should never be a problem; -Thor blockchain should never have two transaction with the same id, ids should be unique. -However, the `TransactionBody` class exposes the `nonce` property that is involved in the computation -of the transaction's hash. - -### Question - ask the protocol team - -The `Transaction.encode` method processes an object of the -[`TransactionBody`](../../../../../packages/core/src/transaction/TransactionBody.d.ts) -class, the class provides the `nonce` property -The `nonce` property should be different for each transaction even if -the other properties of the transaction are equal, however no assumption are made about `nonce`. -* **Who sets the `nonce` property?** - ---- - - diff --git a/docs/diagrams/v2/core/transaction/transaction_id.mmd b/docs/diagrams/v2/core/transaction/transaction_id.mmd deleted file mode 100644 index 8e66f78b5..000000000 --- a/docs/diagrams/v2/core/transaction/transaction_id.mmd +++ /dev/null @@ -1,38 +0,0 @@ -flowchart TD - start((Start)) - stop(((stop))) - body[/TransactionBody/] - subgraph origin["Transaction.origin()"] - origin_txHash[["getTransactionHash()"]] - origin_signature[\signature\] - origin_recover[["Secp256k1.recover(txHash,signature)"]] - origin_address["Address.ofPublicKey(publicKey)"] - origin_recover --> origin_address - origin_signature --> origin_recover - - end - subgraph tx_hash["Transaction.getTransactionHash(gasPayer?)"] - txHash_encodeHash[Blake256.of] - txHash_encodePayer[Blake2b256.of] - txHash_encode[[encode]] - txHash_payer?{gasPayer?} - txHash_payer[/gasPayer/] - txHash_encode --> txHash_encodeHash - txHash_encodeHash --> txHash_payer? - txHash_payer? -. yes .-> txHash_encodePayer - txHash_payer --> txHash_encodePayer - end - subgraph tx_id["Transaction.id()"] - id_hash[Blake2b256.of] - id_origin[["origin()"]] - id_txHash[["getTransactionHash()"]] - id_origin --> id_hash - id_txHash --> id_hash - end - body --> txHash_encode - id_hash --> stop - origin_address --> id_origin - origin_txHash --> origin_recover - start --> body - txHash_encodePayer --> id_txHash - txHash_payer? -- no --> id_txHash diff --git a/docs/diagrams/v2/net/http/http.md b/docs/diagrams/v2/net/http/http.md deleted file mode 100644 index 0178766de..000000000 --- a/docs/diagrams/v2/net/http/http.md +++ /dev/null @@ -1,35 +0,0 @@ -```mermaid -classDiagram - class FetchHttpClient { - baseURL: string - onRequest: OnRequest - onResponse: OnResponse - at(baseURL: string, onRequest: OnRequest, onResponse: OnResponse) FetchHttpClient - } - class HttpClient { - <> - get(httpPath: HttpPath, httpQuery: HttpQuery) Promise~Response~ - post(httpPath: HttpPath, httpQuery: HttpQuery, body?: unknown) Promise~Response~ - } - class HttpPath { - <> - path: string - } - class HttpQuery { - <> - query(): string; - } - class OnRequest { - <> - onRequest(request: Request) Request - } - class OnResponse{ - <> - onResponse(response: Response) Response - } - FetchHttpClient *--> OnRequest - FetchHttpClient *--> OnResponse - HttpClient <|.. FetchHttpClient - HttpPath <-- "get - post" HttpClient - HttpQuery <-- "get - post" HttpClient -``` diff --git a/docs/diagrams/v2/net/thor/accounts/accounts.md b/docs/diagrams/v2/net/thor/accounts/accounts.md deleted file mode 100644 index bf9020525..000000000 --- a/docs/diagrams/v2/net/thor/accounts/accounts.md +++ /dev/null @@ -1,218 +0,0 @@ -```mermaid -classDiagram - namespace JS { - class Array~Type~ { - <> - } - } - namespace http { - class HttpClient { - <> - get(httpPath: HttpPath) Promise~Response~ - post(httpPath: HttpPath, body?: unknown) Promise~Response~ - } - class HttpPath { - <> - path: string - } - } - namespace thor { - class ThorRequest~RequestClass~ { - <> - askTo(httpClient: HttpClient Promise~ThorResponse~ResponseClass~~; - } - class ThorResponse~ResponseClass~ { - <> - request: ThorRequest~RequestClass~ - response: ResponseClass - } - } - namespace transactions { - class Clause { - to: Address | null - value: VET - data: HexUInt - constructor(json: ClauseJSON) - toJSON() ClauseJSON - } - class ClauseJSON { - to: string | null - value: string - data: string - } - class Event { - address: Address - topics: ThorId[] - data: HexUInt - constructor(json: EventJSON) Event - toJSON() EventJSON - } - class EventJSON { - <> - address: string - topics: string[] - data: string - } - class Transfer { - sender: Address - recipient: Address - amount: VET - constructor(json: TransferJSON) Transfer - toJSON() TransferJSON - } - class TransferJSON { - <> - sender: string - recipient: string - amount: string - } - } - class ContractBytecode { - code HexUInt - constructor(json ContractBytecodeJSON) ContractBytecode - toJSON() ContractBytecodeJSON - } - class ContractBytecodeJSON { - <> - code: string - } - class ExecuteCodesRequest { - provedWork?: string - gasPayer?: Address - expiration?: UInt - blockRef?: BlockRef - clauses?: Clause[] - gas?: VTHO - gasPrice?: VTHO - caller?: Address - constructor(json: ExecuteCodesRequestJSON) ExecuteCodesRequest - toJSON() ExecuteCodesRequestJSON - } - class ExecuteCodesRequestJSON { - <> - provedWork?: string - gasPayer?: string - expiration?: number - blockRef?: string - clauses?: ClauseJSON[] - gas?: number - gasPrice?: string - caller?: string - } - class ExecuteCodeResponse { - data: HexUInt - events: Event[] - transfers: Transfer[] - gasUsed: VTHO - reverted: boolean - vmError: string - constructor(json: ExecuteCodeResponseJSON) - toJSON() ExecuteCodeResponseJSON - } - class ExecuteCodeResponseJSON { - <> - data: string - events: EventJSON[] - transfers: TransferJSON[] - gasUsed: number - reverted: boolean - vmError: string - } - class ExecuteCodesResponse { - constructor(json: ExecuteCodesResponseJSON) ExecuteCodesResponse - } - class ExecuteCodesResponseJSON { - <> - } - class GetAccountResponse { - balance: VET - energy: VTHO - hasCode: boolean - constructor(json: GetAccountResponseJSON) GetAccountResponse - } - class GetAccountResponseJSON { - <> - balance: string - energy: string - hasCode: boolean - } - class GetStorageResponse { - value: ThorId - constructor(json: GetStorageResponseJSON) GetStorageResponse - toJSON() GetStorageResponseJSON - } - class GetStorageResponseJSON { - <> - value: string - } - class InspectClauses { - PATH: HttpPath$ - askTo(httpClient: HttpClient) Promise~ThorResponse~ExecuteCodesResponse~~ - of(request: ExecuteCodesRequestJSON) InspectClauses$ - withRevision(revision: Revision) InspectClauses - } - class RetrieveAccountDetails { - path: RetrieveAccountDetailsPath - askTo(httpClient: HttpClient) Promise~ThorResponse~GetAccountResponse~~ - of(address: Address) RetrieveAccountDetails$ - } - class RetrieveAccountDetailsPath { - address: Address - } - class RetrieveContractBytecode { - path: RetrieveContractBytecodePath - askTo(httpClient: HttpClient) Promise~ThorResponse~ContractBytecode~~ - of(address: Address) RetrieveContractBytecode - } - class RetrieveContractBytecodePath { - address: Address - } - class RetrieveStoragePositionValue { - path: RetrieveStoragePositionValuePath - askTo(httpClient: HttpClient) Promise~ThorResponse~GetStorageResponse~~ - of(address: Address, key: BlockId) RetrieveStoragePositionValue$ - } - class RetrieveStoragePositionValuePath { - address: Address - key: BlockId - } - Clause --> "new - toJSON" ClauseJSON - ContractBytecode --> "new - toJSON" ContractBytecodeJSON - Event --> "new - toJSON" EventJSON - ExecuteCodeResponse *--> Event - ExecuteCodeResponse *--> Transfer - ExecuteCodeResponse --> "new - toJSON" ExecuteCodeResponseJSON - ExecuteCodeResponseJSON *--> EventJSON - ExecuteCodeResponseJSON *--> TransferJSON - ExecuteCodeResponseJSON --|> Array - ExecuteCodesRequest *--> Clause - ExecuteCodesRequest --> "new - toJSON" ExecuteCodesRequestJSON - ExecuteCodesRequestJSON *--> ClauseJSON - ExecuteCodesResponse *--> "ExecuteCodeResponseJSON[]" ExecuteCodeResponse - ExecuteCodesResponse --> "new - toJSON" ExecuteCodesResponseJSON - ExecuteCodesResponse --|> Array - ExecuteCodesResponseJSON *--> "ExecuteCodeResponseJSON[]" ExecuteCodeResponseJSON - GetAccountResponse --> "new - toJSON" GetAccountResponseJSON - GetStorageResponse --> "new - toJSON" GetStorageResponseJSON - HttpClient --> "get - post" HttpPath - HttpPath <|.. RetrieveAccountDetailsPath - HttpPath <|.. RetrieveContractBytecodePath - HttpPath <|.. RetrieveStoragePositionValuePath - InspectClauses --> "askTo" ExecuteCodesResponse - RetrieveAccountDetails *--> RetrieveAccountDetailsPath - RetrieveAccountDetails --> "askTo" GetAccountResponse - RetrieveContractBytecode *--> RetrieveContractBytecodePath - RetrieveContractBytecode --> "askTo" ContractBytecode - RetrieveStoragePositionValue *--> RetrieveStoragePositionValuePath - RetrieveStoragePositionValue --> "askTo" GetStorageResponse - ThorRequest <--* ThorResponse - ThorRequest <|.. InspectClauses - ThorRequest <|.. RetrieveAccountDetails - ThorRequest <|.. RetrieveContractBytecode - ThorRequest <|.. RetrieveStoragePositionValue - ThorResponse <-- "askTo" InspectClauses - ThorResponse <-- "askTo" RetrieveAccountDetails - ThorResponse <-- "askTo" RetrieveContractBytecode - ThorResponse <-- "askTo" RetrieveStoragePositionValue - Transfer --> "new - toJSON" TransferJSON -``` diff --git a/docs/diagrams/v2/net/thor/blocks/blocks.md b/docs/diagrams/v2/net/thor/blocks/blocks.md deleted file mode 100644 index 36ac7d6b6..000000000 --- a/docs/diagrams/v2/net/thor/blocks/blocks.md +++ /dev/null @@ -1,84 +0,0 @@ -```mermaid -classDiagram - namespace http { - class HttpClient { - <> - get(httpPath: HttpPath) Promise~Response~ - post(httpPath: HttpPath, body?: unknown) Promise~Response~ - } - class HttpPath { - <> - path: string - } - } - namespace thor { - class ThorRequest~RequestClass~ { - <> - askTo(httpClient: HttpClient Promise~ThorResponse~ResponseClass~~; - } - class ThorResponse~ResponseClass~ { - <> - request: ThorRequest~RequestClass~ - response: ResponseClass - } - } - class RegularBlockResponse { - number: UInt - id: ThorId - size: UInt - parentID: ThorId - timestamp: UInt - gasLimit: VTHO - beneficiary: Address - gasUsed: VTHO - totalScore: UInt - txsRoot: ThorId - txsFeatures: UInt - stateRoot: ThorId - receiptsRoot: ThorId - com: boolean - signer: Address - isTrunk: boolean - isFinalized: boolean - transactions: ThorId[] - constructor(json: RegularBlockResponseJSON) RegularBlockResponse - toJSON() RegularBlockResponseJSON - } - class RegularBlockResponseJSON { - <> - number: number - id: string - size: number - parentID: string - timestamp: number - gasLimit: number - beneficiary: string - gasUsed: number - totalScore: number - txsRoot: string - txsFeatures: number - stateRoot: string - receiptsRoot: string - com: boolean - signer: string - isTrunk: boolean - isFinalized: boolean - transactions: string[] - } - class RetrieveBlock { - path: RetrieveBlockPath - askTo(httpClient: HttpClient) Promise~ThorResponse~RegularBlockResponse~~ - of(revision: Revision) RetrieveBlock$ - } - class RetrieveBlockPath { - revision: Revision - } - ThorResponse <-- "askTo" RetrieveBlock - ThorRequest <|.. RetrieveBlock - ThorRequest <--* ThorResponse - HttpPath <|.. RetrieveBlockPath - RetrieveBlock --> "askTo" RegularBlockResponse - RetrieveBlock *--> RetrieveBlockPath - RegularBlockResponse --> "new - toJSON" RegularBlockResponseJSON - HttpClient --> "get - post" HttpPath -``` diff --git a/docs/diagrams/v2/net/thor/debug/debug.md b/docs/diagrams/v2/net/thor/debug/debug.md deleted file mode 100644 index f18a551b6..000000000 --- a/docs/diagrams/v2/net/thor/debug/debug.md +++ /dev/null @@ -1,205 +0,0 @@ -```mermaid -classDiagram - namespace JS { - class unknown { - <> - } - } - namespace http { - class HttpClient { - <> - get(httpPath: HttpPath) Promise~Response~ - post(httpPath: HttpPath, body?: unknown) Promise~Response~ - } - class HttpPath { - <> - path: string - } - } - namespace thor { - class ThorRequest~RequestClass~ { - <> - askTo(httpClient: HttpClient Promise~ThorResponse~ResponseClass~~ - } - class ThorResponse~ResponseClass~ { - <> - request: ThorRequest~RequestClass~ - response: ResponseClass - } - } - class Bigram { - NAME: string$ - } - class Call { - NAME: string$ - } - class EvmDis { - NAME: string$ - } - class FourByte { - NAME: string$ - } - class Noop { - NAME: string$ - } - class Null { - NAME: string$ - } - class OpCount { - NAME: string$ - } - class PostDebugTracerCallRequest { - name?: TracerName - config?: unknown - value: VET - data: HexUInt - to?: Address - gas?: VTHO - gasPrice?: VTHO - caller?: Address - provedWork?: string - gasPayer?: Address - expiration?: UInt - blockRef?: BlockRef - constructor(json: PostDebugTracerCallRequestJSON) PostDebugTracerCallRequest - toJSON() PostDebugTracerCallRequestJSON - } - class PostDebugTracerCallRequestJSON { - <> - name?: string - config?: unknown - value: string - data: string - to?: string - gas?: number - gasPrice?: string - caller?: string - provedWork?: string - gasPayer?: string - expiration?: number - blockRef?: string - } - class PostDebugTracerRequest { - name?: TracerName - config?: unknown - target: string - constructor(json: PostDebugTracerRequestJSON) PostDebugTracerRequest - toJSON() PostDebugTracerRequestJSON - } - class PostDebugTracerRequestJSON { - <> - name?: string - config?: unknown - target: string - } - class Presate { - NAME: string$ - } - class RetrieveStorageRange { - PATH: HttpPath$ - request: StorageRangeOption - askTo(httpClient: HttpClient): Promise~ThorResponse~StorageRange~~ - of(request: StorageRangeOptionJSON) RetrieveStorageRange$ - } - class StorageRange { - nextKey?: ThorId - storage: unknown - constructor(json: StorageRangeJSON) StorageRange - toJSON() StorageRangeJSON - } - class StorageRangeJSON { - <> - nextKey?: string - storage: unknown - } - class StorageRangeOption { - address: Address - keyStart?: ThorId - maxResult?: UInt - target: string - } - class StorageRangeOptionJSON { - <> - address: string - keyStart?: string - maxResult?: number - target: string - } - class StructLogger { - NAME: string$ - } - class TraceCall { - PATH: HttpPath$ - request: PostDebugTracerCallRequest - askTo(httpClient: HttpClient): Promise~ThorResponse~unknown~~ - of(request: PostDebugTracerCallRequestJSON) TraceCall$ - } - class Tracer { - of(name: string): TracerName$ - } - class TracerName { - <> - toString: string - } - class TraceTransactionClause { - PATH: HttpPath$ - request: PostDebugTracerRequest - askTo(httpClient: HttpClient): Promise~ThorResponse~unknown~~ - of(request: PostDebugTracerRequestJSON) TraceTransactionClause$ - } - class Trigram { - NAME: string$ - } - class Unigram { - NAME: string$ - } - Bigram <-- "of" Tracer - Call <-- "of" Tracer - EvmDis <-- "of" Tracer - FourByte <-- "of" Tracer - HttpClient --> "get - post" HttpPath - HttpPath <--* RetrieveStorageRange - HttpPath <--* TraceCall - HttpPath <--* TraceTransactionClause - Noop <-- "of" Tracer - Null <-- "of" Tracer - OpCount <-- "of" Tracer - PostDebugTracerCallRequest *--> TracerName - PostDebugTracerCallRequest --> "new - toJSON" PostDebugTracerCallRequestJSON - PostDebugTracerRequest *--> TracerName - PostDebugTracerRequest --> "new - toJSON" PostDebugTracerRequestJSON - Presate <-- "of" Tracer - Prestate <-- "of" Tracer - RetrieveStorageRange *--> StorageRangeOption - RetrieveStorageRange --> "askTo" StorageRange - RetrieveStorageRange --> "of" StorageRangeOptionJSON - StorageRange --> "new - toJSON" StorageRangeJSON - StorageRangeOption --> "new - toJSON" StorageRangeOptionJSON - StructLogger <-- "of" Tracer - ThorRequest <--* ThorResponse - ThorRequest <|.. RetrieveStorageRange - ThorRequest <|.. TraceCall - ThorRequest <|.. TraceTransactionClause - ThorResponse <-- "askTo" RetrieveStorageRange - ThorResponse <-- "askTo" TraceCall - TraceCall *--> PostDebugTracerCallRequest - TraceCall --> "askTo" unknown - TraceCall --> "of" PostDebugTracerCallRequestJSON - TraceTransactionClause *--> PostDebugTracerCallRequest - TraceTransactionClause --> "askTo" unknown - TraceTransactionClause --> "of" PostDebugTracerRequestJSON - TracerName <|-- Bigram - TracerName <|-- Call - TracerName <|-- EvmDis - TracerName <|-- FourByte - TracerName <|-- Noop - TracerName <|-- Null - TracerName <|-- OpCount - TracerName <|-- Presate - TracerName <|-- Prestate - TracerName <|-- StructLogger - TracerName <|-- Trigram - TracerName <|-- Unigram - Trigram <-- "of" Tracer - Unigram <-- "of" Tracer -``` diff --git a/docs/diagrams/v2/net/thor/logs/logs.md b/docs/diagrams/v2/net/thor/logs/logs.md deleted file mode 100644 index 752be6233..000000000 --- a/docs/diagrams/v2/net/thor/logs/logs.md +++ /dev/null @@ -1,230 +0,0 @@ -```mermaid -classDiagram - namespace JS { - class Array~Type~ { - <> - } - } - namespace http { - class HttpClient { - <> - get(httpPath: HttpPath) Promise~Response~ - post(httpPath: HttpPath, body?: unknown) Promise~Response~ - } - class HttpPath { - <> - path: string - } - } - namespace thor { - class ThorRequest~RequestClass~ { - <> - askTo(httpClient: HttpClient Promise~ThorResponse~ResponseClass~~ - } - class ThorResponse~ResponseClass~ { - <> - request: ThorRequest~RequestClass~ - response: ResponseClass - } - } - class EventCriteria { - address?: Address - topic0?: ThorId - topic1?: ThorId - topic2?: ThorId - topic3?: ThorId - topic4?: ThorId - constructor(json: EventCriteriaJSON) EventCriteria - toJSON() EventCriteriaJSON - } - class EventCriteriaJSON { - <> - address?: string - topic0?: string - topic1?: string - topic2?: string - topic3?: string - topic4?: string - } - class EventLogFilterRequest { - range?: FilterRange - options?: FilterOptions - criteriaSet?: EventCriteria[] - order?: LogSort - constructor(json: EventLogFilterRequestJSON) EventLogFilterRequest - toJSON() EventLogFilterRequestJSON - } - class EventLogFilterRequestJSON { - range?: FilterRangeJSON - options?: FilterOptionsJSON - criteriaSet?: EventCriteriaJSON[] - order?: string - } - class EventLogResponse { - address: Address - topics: ThorId[] - data: HexUInt - meta: LogMeta - constructor(json: EventLogResponseJSON) EventLogResponse - toJSON() EventLogResponseJSON - } - class EventLogResponseJSON { - <> - address: string - topics: string[] - data: string - meta: LogMetaJSON - } - class EventLogsResponse { - constructor(json: EventLogsResponseJSON) EventLogsResponse - } - class EventLogsResponseJSON { - <> - } - class FilterOptions { - limit?: UInt - offset?: UInt - constructor(json: FilterOptionsJSON) FilterOptions - toJSON() FilterOptionsJSON - } - class FilterOptionsJSON { - limit?: number - offset?: number - } - class LogMeta { - blockID: BlockId - blockNumber: UInt - blockTimestamp: UInt - txID: TxId - txOrigin: Address - clauseIndex: UInt - constructor(json: LogMetaJSON) - toJSON() LogMetaJSON - } - class LogMetaJSON { - <> - blockID: string - blockNumber: number - blockTimestamp: number - txID: string - txOrigin: string - clauseIndex: number - } - class LogSort { - <> - asc: string - desc: string - } - class FilterRange { - unit?: FilterRangeUnits - from?: UInt - to?: UInt - constructor(json: FilterRangeJSON) FilterRange - toJSON() FilterRangeJSON - } - class FilterRangeJSON { - unit?: string - from?: number - to?: number - } - class FilterRangeUnits { - <> - block = 'block', - time = 'time' - } - class QuerySmartContractEvents { - PATH: HttpPath$ - request: EventLogFilterRequest - constructor(request: EventLogFilterRequest) QuerySmartContractEvents - askTo(httpClient: HttpClient) Promise~ThorResponse~EventLogsResponse~~ - static of(request: EventLogFilterRequestJSON) QuerySmartContractEvents$ - } - class QueryVETTransferEvents { - PATH: HttpPath$ - request: TransferLogFilterRequest - constructor(request: TransferLogFilterRequest) QueryVETTransferEvents - askTo(httpClient: HttpClient) Promise~ThorResponse~TransferLogsResponse~~ - of(request: TransferLogFilterRequestJSON) QueryVETTransferEvents$ - } - class TransferCriteria { - txOrigin?: Address - sender?: Address - recipient?: Address - constructor(json: TransferCriteriaJSON) TransferCriteria - toJSON() TransferCriteriaJSON - } - class TransferCriteriaJSON { - txOrigin?: string - sender?: string - recipient?: string - } - class TransferLogFilterRequest { - range?: FilterRange - options?: FilterOptions - criteriaSet?: TransferCriteria[] - order?: LogSort - constructor(json: TransferLogFilterRequestJSON) TransferLogFilterRequest - toJSON() TransferLogFilterRequestJSON - } - class TransferLogFilterRequestJSON { - range?: FilterRangeJSON - options?: FilterOptionsJSON - criteriaSet?: TransferCriteriaJSON[] - order?: string - } - class TransferLogResponse { - sender: Address - recipient: Address - amount: VET - meta: LogMeta - constructor(json: TransferLogResponseJSON) TransferLogResponse - toJSON() TransferLogResponseJSON - } - class TransferLogResponseJSON { - sender: string - recipient: string - amount: string - meta: LogMetaJSON - } - EventCriteria --> "new - toJSON" EventCriteriaJSON - EventLogFilterRequest *--> EventCriteria - EventLogFilterRequest *--> LogSort - EventLogFilterRequest --> "new - toJSON" EventLogFilterRequestJSON - EventLogFilterRequestJSON *--> EventCriteriaJSON - EventLogResponse *--> LogMeta - EventLogResponse --> "new - toJSON" EventLogResponseJSON - EventLogResponseJSON *--> LogMetaJSON - EventLogsResponse *--> EventLogResponse - EventLogsResponse --|> Array - EventLogsResponseJSON *--> EventLogResponseJSON - EventLogsResponseJSON --|> Array - FilterOptions --> "new - toJSON" FilterOptionsJSON - FilterRange *--> FilterRangeUnits - FilterRange --> "new - toJSON" FilterRangeJSON - HttpClient --> "get - post" HttpPath - HttpPath <--* QuerySmartContractEvents - HttpPath <--* QueryVETTransferEvents - LogMeta --> "new - toJSON" LogMetaJSON - QuerySmartContractEvents *--> EventLogFilterRequest - QuerySmartContractEvents --> "askTo" EventLogsResponse - QueryVETTransferEvents *--> TransferLogFilterRequest - QueryVETTransferEvents --> "askTo" TransferLogsResponse - ThorRequest <--* ThorResponse - ThorRequest <|.. QuerySmartContractEvents - ThorRequest <|.. QueryVETTransferEvents - ThorResponse <-- "askTo" QuerySmartContractEvents - ThorResponse <-- "askTo" QueryVETTransferEvents - TransferCriteria --> "new - toJSON" TransferCriteriaJSON - TransferLogFilterRequest *--> FilterOptions - TransferLogFilterRequest *--> FilterRange - TransferLogFilterRequest *--> LogSort - TransferLogFilterRequest *--> TransferCriteria - TransferLogFilterRequest --> "new - toJSON" TransferLogFilterRequestJSON - TransferLogResponse *--> LogMeta - TransferLogResponse --> "new - toJSON" TransferLogResponseJSON - TransferLogsResponse *--> TransferLogResponse - TransferLogsResponse --> "new - toJSON" TransferLogsResponseJSON - TransferLogsResponse --|> Array - TransferLogsResponseJSON *--> TransferLogResponseJSON - TransferLogsResponseJSON --|> Array -``` diff --git a/docs/diagrams/v2/net/thor/node/node.md b/docs/diagrams/v2/net/thor/node/node.md deleted file mode 100644 index 9e59c80be..000000000 --- a/docs/diagrams/v2/net/thor/node/node.md +++ /dev/null @@ -1,71 +0,0 @@ -```mermaid -classDiagram - namespace JS { - class Array~Type~ { - <> - } - } - namespace http { - class HttpClient { - <> - get(httpPath: HttpPath) Promise~Response~ - post(httpPath: HttpPath, body?: unknown) Promise~Response~ - } - class HttpPath { - <> - path: string - } - } - namespace thor { - class ThorRequest~RequestClass~ { - <> - askTo(httpClient: HttpClient Promise~ThorResponse~ResponseClass~~ - } - class ThorResponse~ResponseClass~ { - <> - request: ThorRequest~RequestClass~ - response: ResponseClass - } - } - class GetPeersResponse { - constructor(json: GetPeersResponseJSON) GetPeersResponse - } - class GetPeersResponseJSON { - <> - } - class PeerStat { - name: string - bestBlockID: BlockId - totalScore: UInt - peerID: string - netAddr: string - inbound: boolean - duration: UInt - constructor(json: PeerStatJSON) PeerStat - toJSON() PeerStatJSON - } - class PeerStatJSON { - name: string - bestBlockID: string - totalScore: number - peerID: string - netAddr: string - inbound: boolean - duration: number - } - class RetrieveConnectedPeers { - PATH: HttpPath$ - askTo(httpClient: HttpClient) Promise~ThorResponse~GetPeersResponse~~ - } - GetPeersResponse *--> PeerStat - GetPeersResponse --> "new - toJSON" GetPeersResponseJSON - GetPeersResponse --|> Array - GetPeersResponseJSON --|> Array - GetPeersResponseJSON *--> PeerStatJSON - HttpClient --> "get - post" HttpPath - HttpPath <--* RetrieveConnectedPeers - PeerStat --> "new - toJSON" PeerStatJSON - RetrieveConnectedPeers --> "askTo" GetPeersResponse - ThorRequest <-- "askTo" RetrieveConnectedPeers - ThorResponse <|.. RetrieveConnectedPeers -``` diff --git a/docs/diagrams/v2/net/thor/subscriptions/subscriptions.md b/docs/diagrams/v2/net/thor/subscriptions/subscriptions.md deleted file mode 100644 index f9484eac0..000000000 --- a/docs/diagrams/v2/net/thor/subscriptions/subscriptions.md +++ /dev/null @@ -1,215 +0,0 @@ -```mermaid -classDiagram - namespace log { - class LogMeta { - blockID: BlockId - blockNumber: UInt - blockTimestamp: UInt - txID: TxId - txOrigin: Address - clauseIndex: UInt - constructor(json: LogMetaJSON) LogMeta - toJSON() LogMetaJSON - } - class LogMetaJSON { - blockID: string - blockNumber: number - blockTimestamp: number - txID: string - txOrigin: string - clauseIndex: number - } - } - namespace trasactions { - class TXID { - id: ThorId - constructor(json: TXIDJSON): TXID - toJSON() TXIDJSON - } - class TXIDJSON { - <> - id: string - } - } - namespace ws { - class WebSocketClient { - <> - baseURL: string - addMessageListener(listener: WebSocketListener) - close(): WebSocketClient - open(path: HttpPath): WebSocketClient - removeListener(listener: WebSocketListener): WebSocketClient - } - class WebSocketListener~EventType~ { - <> - onClose(event: Event) - onError(event: Event) - onMessage(event: MessageEvent~EventType~) - onOpen(event: Event) - } - } - class BeatsSubscription { - PATH: HttpPath$ - addMessageListener(listener: WebSocketListener~SubscriptionBeat2Response~) BeatsSubscription - at(wsc: WebSocketClient) BeatsSubscription$ - close() BeatsSubscription - open() BeatsSubscription - removeListener(listener: WebSocketListener~SubscriptionBeat2Response~) BeatsSubscription - } - class BlocksSubscription { - PATH: HttpPath$ - addMessageListener(listener: WebSocketListener~SubscriptionBlockResponse~) BlocksSubscription - at(wsc: WebSocketClient) BlocksSubscription$ - atPos(pos?: BlockId) - close() BlocksSubscription - open() BlocksSubscription - removeListener(listener: WebSocketListener~SubscriptionBlockResponse~) BlocksSubscription - } - class EventsSubscription { - PATH: HttpPath$ - addMessageListener(listener: WebSocketListener~SubscriptionEventResponse~) EventsSubscription - at(wsc: WebSocketClient) EventsSubscription$ - atPos(pos?: ThorId) EventsSubscription - close() EventsSubscription - open() EventsSubscription - removeListener(listener: WebSocketListener~SubscriptionEventResponse~) EventsSubscription - withContractAddress(contractAddress?: Address) EventsSubscription - withFilters(t0?: ThorId?, t1?: ThorId, t2: ThorId, t3: ThorId) EventsSubscription - } - class NewTransactionSubscription { - PATH: HttpPath$ - addMessageListener(listener: WebSocketListener~TXID~) NewTransactionSubscription - at(wsc: WebSocketClient) NewTransactionSubscription$ - close() NewTransactionSubscription - open() NewTransactionSubscription - } - class TransfersSubscription { - PATH: HttpPath$ - addMessageListener(listener: WebSocketListener~SubscriptionTransferResponse~) TransfersSubscription - at(wsc: WebSocketClient) TransfersSubscription - close() TransfersSubscription - open() TransfersSubscription - removeListener(listener: WebSocketListener~SubscriptionTransferResponse~) TransfersSubscription - } - class SubscriptionBeat2Response { - gasLimit: VTHO - obsolete: boolean - number: UInt - id: BlockId - parentID: BlockId - timestamp: UInt - txsFeatures: UInt - bloom: HexUInt - k: UInt - constructor(json: SubscriptionBeat2ResponseJSON): SubscriptionBeat2Response - toJSON() SubscriptionBeat2ResponseJSON - } - class SubscriptionBeat2ResponseJSON { - <> - gasLimit: number - obsolete: boolean - number: number - id: string - parentID: string - timestamp: number - txsFeatures: number - bloom: string - k: number - } - class SubscriptionBlockResponse { - number: UInt - id: BlockId - size: UInt - parentID: BlockId - timestamp: UInt - gasLimit: VTHO - beneficiary: Address - gasUsed: VTHO - totalScore: UInt - txsRoot: ThorId - txsFeatures: UInt - stateRoot: ThorId - receiptsRoot: ThorId - com: boolean - signer: Address - obsolete: boolean - transactions: TxId[] - } - class SubscriptionBlockResponseJSON { - <> - number: number - id: string - size: number - parentID: string - timestamp: number - gasLimit: number - beneficiary: string - gasUsed: number - totalScore: number - txsRoot: string - txsFeatures: number - stateRoot: string - receiptsRoot: string - com: boolean - signer: string - obsolete: boolean - transactions: string[] - } - class SubscriptionEventResponse { - address: Address; - topics: ThorId[]; - data: HexUInt; - obsolete: boolean; - meta: LogMeta; - constructor(json: SubscriptionEventResponseJSON) SubscriptionEventResponse - toJSON() SubscriptionEventResponseJSON - } - class SubscriptionEventResponseJSON { - <> - address: string - topics: string[] - data: string - obsolete: boolean - meta: LogMetaJSON - } - class SubscriptionTransferResponse { - sender: Address - recipient: Address - amount: VET - obsolete: boolean - meta: LogMeta - } - class SubscriptionTransferResponseJSON { - <> - sender: string - recipient: string - amount: string - obsolete: boolean - meta: LogMetaJSON - } - WebSocketClient <|.. BeatsSubscription - WebSocketClient <|.. BlocksSubscription - WebSocketClient <|.. EventsSubscription - WebSocketClient <|.. NewTransactionSubscription - WebSocketClient <|.. TransfersSubscription - WebSocketListener <|.. BeatsSubscription - WebSocketListener <|.. BlocksSubscription - WebSocketListener <|.. EventsSubscription - WebSocketListener <|.. NewTransactionSubscription - WebSocketListener <|.. TransfersSubscription - BeatsSubscription --> "onMessage" SubscriptionBeat2Response - BlocksSubscription --> "onMessage" SubscriptionBlockResponse - EventsSubscription --> "onMessage" SubscriptionEventResponse - NewTransactionSubscription --> "onMessage" TXID - TransfersSubscription --> "onMessage" SubscriptionTransferResponse - SubscriptionEventResponse *--> LogMeta - SubscriptionEventResponseJSON *--> LogMetaJSON - SubscriptionTransferResponse *--> LogMeta - SubscriptionTransferResponseJSON *-- LogMetaJSON - LogMeta --> "new - toJSON" LogMetaJSON - SubscriptionBeat2Response --> "new - toJSON" SubscriptionBeat2ResponseJSON - SubscriptionBlockResponse --> "new - toJSON" SubscriptionBlockResponseJSON - SubscriptionEventResponse --> "new - toJSON" SubscriptionEventResponseJSON - SubscriptionTransferResponse --> "new - toJSON" SubscriptionTransferResponseJSON - TXID --> "new - toJSON" TXIDJSON -``` diff --git a/docs/diagrams/v2/net/thor/thor.md b/docs/diagrams/v2/net/thor/thor.md deleted file mode 100644 index fe72d1385..000000000 --- a/docs/diagrams/v2/net/thor/thor.md +++ /dev/null @@ -1,18 +0,0 @@ -```mermaid -classDiagram - class ThorNetworks { - <> - MAINNET: string - TESTNET: string - } - class ThorRequest~RequestClass~ { - <> - askTo(httpClient: HttpClient Promise~ThorResponse~ResponseClass~~; - } - class ThorResponse~ResponseClass~ { - <> - request: ThorRequest~RequestClass~ - response: ResponseClass - } - ThorRequest <--* ThorResponse -``` diff --git a/docs/diagrams/v2/net/thor/transactions/transactions.md b/docs/diagrams/v2/net/thor/transactions/transactions.md deleted file mode 100644 index ba12b2f6e..000000000 --- a/docs/diagrams/v2/net/thor/transactions/transactions.md +++ /dev/null @@ -1,281 +0,0 @@ -```mermaid -classDiagram - namespace http { - class HttpClient { - <> - get(httpPath: HttpPath) Promise~Response~ - post(httpPath: HttpPath, body?: unknown) Promise~Response~ - } - class HttpPath { - <> - path: string - } - class HttpQuery { - <> - query(): string; - } - } - namespace thor { - class ThorRequest~RequestClass~ { - <> - askTo(httpClient: HttpClient Promise~ThorResponse~ResponseClass~~ - of(txId: TxId) RetrieveTransactionByID$ - withHead(head?: BlockId) RetrieveTransactionByID - withPending(pending: boolean) RetrieveTransactionByID - } - class ThorResponse~ResponseClass~ { - <> - request: ThorRequest~RequestClass~ - response: ResponseClass - } - } - class Clause { - to?: Address | null - value: VET - data: HexUInt - constructor(json: ClauseJSON) Clause - toJSON() ClauseJSON - } - class ClauseJSON { - to?: string | null - value: string - data: string - } - class Event { - address: Address - topics: ThorId[] - data: HexUInt - constructor(json: EventJSON) Event - toJSON() EventJSON - } - class EventJSON { - address: string - topics: string[] - data: string - } - class GetRawTxResponse { - raw: HexUInt - meta: TxMeta - constructor(json: GetRawTxResponseJSON) GetRawTxResponse - toJSON() GetRawTxResponseJSON - } - class GetRawTxResponseJSON { - raw: string - meta: TxMetaJSON - } - class GetTxReceiptResponse { - meta: ReceiptMeta - constructor(json: GetTxReceiptResponseJSON) GetTxReceiptResponse - toJSON() GetTxReceiptResponseJSON - } - class GetTxReceiptResponseJSON { - meta: ReceiptMetaJSON - } - class GetTxResponse { - id: TxId - origin: Address - delegator: Address | null - size: UInt - chainTag: UInt - blockRef: BlockId - expiration: UInt - clauses: Clause[] - gasPriceCoef: UInt - gas: VTHO - dependsOn?: TxId - nonce: Nonce - meta: TxMeta - constructor(json: GetTxResponseJSON) GetTxResponse - toJSON() GetTxResponseJSON - } - class GetTxResponseJSON { - id: string - origin: string - delegator: string | null - size: number - chainTag: number - blockRef: string - expiration: number - clauses: ClauseJSON[] - gasPriceCoef: number - gas: number - dependsOn?: string - nonce: string - meta: TxMetaJSON - } - class TxMeta { - blockID: BlockId - blockNumber: UInt - blockTimestamp: UInt - constructor(json: TxMetaJSON) TxMeta - toJSON() TxMetaJSON - } - class TxMetaJSON { - blockID: string - blockNumber: number - blockTimestamp: number - } - class Receipt { - gasUsed: VTHO - gasPayer: Address - paid: VTHO - reward: VTHO - reverted: boolean - outputs: ReceiptOutput[] - constructor(json: ReceiptJSON) Receipt - toJSON() ReceiptJSON - } - class ReceiptJSON { - gasUsed: number - gasPayer: string - paid: string - reward: string - reverted: boolean - outputs: ReceiptOutputJSON[] - } - class ReceiptMeta { - txID: TxId - txOrigin: Address - constructor(json: ReceiptMetaJSON) ReceiptMeta - toJSON() ReceiptMetaJSON - } - class ReceiptMetaJSON { - txID: string - txOrigin: string - } - class ReceiptOutput { - contractAddress: Address - events: Event[] - transfers: Transfer[] - constructor(json: ReceiptOutputJSON) ReceiptOutput - toJSON() ReceiptOutputJSON - } - class ReceiptOutputJSON { - contractAddress: string - events: EventJSON[] - transfers: TransferJSON[] - } - class RetrieveRawTransactionByID { - path: RetrieveRawTransactionByIDPath - query: RetrieveRawTransactionByIDQuery - askTo(httpClient: HttpClient) Promise~ThorResponse~ - of(txId: TxId) RetrieveRawTransactionByID$ - withHead(head?: BlockId) RetrieveTransactionByID$ - withPending(pending: boolean) RetrieveTransactionByID$ - } - class RetrieveTransactionByID { - path: RetrieveTransactionByIDPath - query: RetrieveTransactionByIDQuery - askTo(httpClient: HttpClient) Promise~ThorRespons~GetTxResponse~~ - } - class RetrieveTransactionByIDPath { - txId: TxId - } - class RetrieveTransactionByIDQuery { - head?: BlockId - pending: boolean - } - class RetrieveTransactionReceipt { - path: RetrieveTransactionReceiptPath - query: RetrieveTransactionReceiptQuery - askTo(httpPath: HttpPath) Promise~ThorResponse~GetTxReceiptResponse~~ - of(txId: TxId) RetrieveTransactionReceipt$ - withHead(head?: BlockId) RetrieveTransactionReceipt - } - class RetrieveTransactionReceiptPath { - txId: TxId - } - class RetrieveTransactionReceiptQuery { - head?: BlockId - } - class SendTransaction { - PATH: HttpPath$ - encoded: Uint8Array - askTo(httpPath: HttpPath) Promise~ThorResponse~TXID~~ - of(encoded: Uint8Array) SendTransaction$ - } - class Transfer { - sender: Address - recipient: Address - amount: VET - constructor(json: TransferJSON) Transfer - toJSON() TransferJSON - } - class TransferJSON { - sender: string - recipient: string - amount: string - } - class TXID { - id: ThorId - constructor(json: TXIDJSON): TXID - toJSON() TXIDJSON - } - class TXIDJSON { - <> - id: string - } - class TxMeta { - blockID: BlockId - blockNumber: UInt - blockTimestamp: UInt - constructor(json: TxMetaJSON) TxMeta - toJSON() TxMetaJSON - } - class TxMetaJSON { - blockID: string - blockNumber: number - blockTimestamp: number - } - Clause --> "new - toJSON" ClauseJSON - Event --> "new - toJSON" EventJSON - GetRawTxResponse *--> TxMeta - GetRawTxResponse --> "new - toJSON" GetRawTxResponseJSON - GetRawTxResponse <-- "askTo" RetrieveRawTransactionByID - GetRawTxResponseJSON *--> TxMetaJSON - GetTxReceiptResponse *--> ReceiptMeta - GetTxReceiptResponse --> "new - toJSON" GetTxReceiptResponseJSON - GetTxReceiptResponseJSON *--> ReceiptMetaJSON - GetTxResponse *--> "*" Clause - GetTxResponse --> "new - toJSON" GetTxResponseJSON - GetTxResponseJSON *--> "*" ClauseJSON - HttpPath <--* SendTransaction - HttpPath <|.. RetrieveTransactionByIDPath - HttpPath <|.. RetrieveTransactionReceiptPath - HttpQuery <|.. RetrieveTransactionByIDQuery - HttpQuery <|.. RetrieveTransactionReceiptQuery - Receipt *--> "*" ReceiptOutput - Receipt --> "new - toJSON" ReceiptJSON - Receipt <|-- GetTxReceiptResponse - ReceiptJSON *--> "*" ReceiptOutputJSON - ReceiptJSON <|-- GetTxReceiptResponseJSON - ReceiptMeta --> "new - toJSON" ReceiptMetaJSON - ReceiptOutput *--> "*" Event - ReceiptOutput *--> "*" Transfer - ReceiptOutput --> "new - toJSON" ReceiptOutputJSON - ReceiptOutputJSON *--> "*" EventJSON - ReceiptOutputJSON *--> "*" TransferJSON - RetrieveRawTransactionByID *--> RetrieveRawTransactionByIDPath - RetrieveRawTransactionByID *--> RetrieveRawTransactionByIDQuery - RetrieveRawTransactionByID --> "askTo" GetRawTxResponse - RetrieveTransactionByID --> "askTo" GetTxResponse - RetrieveTransactionByIDPath <|-- RetrieveRawTransactionByIDPath - RetrieveTransactionByIDQuery <|-- RetrieveRawTransactionByIDQuery - RetrieveTransactionReceipt *--> RetrieveTransactionReceiptPath - RetrieveTransactionReceipt *--> RetrieveTransactionReceiptQuery - RetrieveTransactionReceipt --> "askTo" GetTxReceiptResponse - SendTransaction --> "askTo" TXID - ThorRequest <|.. RetrieveRawTransactionByID - ThorRequest <|.. RetrieveTransactionByID - ThorRequest <|.. RetrieveTransactionReceipt - ThorRequest <|.. SendTransaction - ThorResponse <-- "askTo" RetrieveRawTransactionByID - ThorResponse <-- "askTo" RetrieveTransactionByID - ThorResponse <-- "askTo" RetrieveTransactionReceipt - ThorResponse <-- "askTo" SendTransaction - Transfer --> "new - toJSON" TransferJSON - TXID --> "new - toJSON" TXIDJSON - TxMeta --> "new - toJSON" TxMetaJSON - TxMeta <|-- ReceiptMeta - TxMetaJSON <|-- ReceiptMetaJSON -``` diff --git a/docs/diagrams/v2/net/ws/ws.md b/docs/diagrams/v2/net/ws/ws.md deleted file mode 100644 index a23307e2d..000000000 --- a/docs/diagrams/v2/net/ws/ws.md +++ /dev/null @@ -1,23 +0,0 @@ -```mermaid -classDiagram - class MozillaWebSocketClient { - constructor(baseURL: string) MozillaWebSocketClient - } - class WebSocketClient { - <> - baseURL: string - addMessageListener(listener: WebSocketListener~EventType~) - close(): WebSocketClient - open(path: HttpPath): WebSocketClient - removeListener(listener: WebSocketListener): WebSocketClient - } - class WebSocketListener~EventType~ { - <> - onClose(event: Event) - onError(event: Event) - onMessage(event: MessageEvent~EventType~) - onOpen(event: Event) - } - WebSocketClient <|.. MozillaWebSocketClient - WebSocketListener <--o WebSocketClient -``` diff --git a/docs/encoding.md b/docs/encoding.md deleted file mode 100644 index a2d5a0f27..000000000 --- a/docs/encoding.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -description: Transaction and contract encoding ---- - -# Encoding - -Vechain SDK extends its support to handle both Application Binary Interface (ABI) and Recursive Length Prefix (RLP) encoding. - -## ABI - -Vechain SDK provides functionality to interact with smart contracts on the VeChainThor blockchain using ABI's. An ABI is a standardised interface format that defines the method signatures, input parameters, and output types of smart contract functions. With VeChain SDK, developers can conveniently encode and decode data for interacting with smart contracts, making it easier to call contract functions and process their results. - -```typescript { name=abi, category=example } -// 1 - Create a simple function to encode into ABI - -const simpleAbiFunction = new ABIFunction({ - constant: false, - inputs: [ - { - name: 'a1', - type: 'uint256' - }, - { - name: 'a2', - type: 'string' - } - ], - name: 'f1', - outputs: [ - { - name: 'r1', - type: 'address' - }, - { - name: 'r2', - type: 'bytes' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' -}); - -// 2 - Encode function - -const encodedFunction = simpleAbiFunction.encodeData([1, 'foo']).toString(); -``` - -## Contract - -The contract interface is used to provide a higher level of abstraction to allow direct interaction with a smart contract. To create a contract interface is necessary to have a compatible smart contract ABI.VeChain SDK provides a full implementation of the Contract interface as well as some methods to encode directly a specific ABI item of the smart contract (until now only function and event ABIs are supported). Encoding and decoding are based on the ABI one. - -```typescript { name=contract, category=example } -// 1 - Create a new function - -const contractABI = [ - { - constant: false, - inputs: [ - { - name: 'value', - type: 'uint256' - } - ], - name: 'setValue', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'getValue', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - } -] as const; - -// 2 - Encode the function input, ready to be used to send a tx -const encodedData = ABIContract.ofAbi(contractABI).encodeFunctionInput( - 'setValue', - [123] -); - -// 3 - Decode the function input data -const decodedData = String( - ABIContract.ofAbi(contractABI).decodeFunctionInput('setValue', encodedData) - .args[0] -); // decode the function input data -``` - -## RLP Encoding - -RLP is a serialisation technique used on the VeChainThor blockchain. It is used to efficiently encode and decode data structures for storage and transmission on the blockchain.VeChain SDK includes dedicated methods for RLP encoding and decoding, enabling developers to handle data serialization and deserialization with ease. - -By supporting ABI and RLP encoding handling, VeChainSDK equips developers with the necessary tools to interact with smart contracts and handle data efficiently on the VeChainThor blockchain. This further enhances the library's capabilities and contributes to the seamless development of decentralised applications on the platform. - -```typescript { name=rlp, category=example } -// 1 - Define the profile for tx clause structure - -const profile = { - name: 'clause', - kind: [ - { name: 'to', kind: new OptionalFixedHexBlobKind(20) }, - { name: 'value', kind: new NumericKind(32) }, - { name: 'data', kind: new HexBlobKind() } - ] -}; - -// 2 - Create clauses - -const clause = { - to: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - value: 10, - data: '0x' -}; - -// 3 - RLPProfiler Instance to encode and decode - -// Encoding and Decoding -const data = RLPProfiler.ofObject(clause, profile).encoded; -const obj = RLPProfiler.ofObjectEncoded(data, profile).object; -``` - diff --git a/docs/events.md b/docs/events.md deleted file mode 100644 index 1901f0247..000000000 --- a/docs/events.md +++ /dev/null @@ -1,101 +0,0 @@ -# Events - -The VeChain SDK allows querying the blockchain for events emitted by smart contracts. - -## Filtering a single Transfer Event - -With the VeChain SDK the contract object could be used also for filtering events emitted from the contract. It is also possible to specify some filtering options (range, result limit, etc) - -Following an example on how to listen to a Transfer Event: - -```typescript { name=contract-event-filter, category=example } -// Starting from a deployed contract instance, transfer some tokens to a specific address -const transferResult = await contractErc20.transact.transfer( - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - 10000n -); - -// Wait for the transfer transaction to complete and obtain its receipt -const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - -// Asserting that the transaction has not been reverted -expect(transactionReceiptTransfer.reverted).toEqual(false); - -// 1. passing an array of arguments -const transferEventsArrayArgs = await contractErc20.filters - .Transfer([undefined, '0x9e7911de289c3c856ce7f421034f66b6cde49c39']) - .get(); - -// 2. passing an object with the arguments as properties -const transferEventsObjectArgs = await contractErc20.filters - .Transfer({ - to: '0x9e7911de289c3c856ce7f421034f66b6cde49c39' - }) - .get(); - -// Asserting that the transfer event has been emitted -expect(transferEventsArrayArgs.length).toEqual(1); -expect(transferEventsObjectArgs.length).toEqual(1); - -// log the transfer events -console.log(transferEventsArrayArgs); -``` - - -## Multi-Clause Event Filtering - -Filter events from different contracts in a single call using contract addresses and event signatures. - -```typescript { name=contract-event-filter, category=example } -const contractEventExample = await setupEventExampleContract(); - -await (await contractEventExample.transact.setValue(3000n)).wait(); - -const transferCriteria = contractErc20.criteria.Transfer({ - to: '0x9e7911de289c3c856ce7f421034f66b6cde49c39' -}); - -const valueCriteria = contractEventExample.criteria.ValueSet(); - -const events = await thorSoloClient.logs.filterEventLogs({ - criteriaSet: [transferCriteria, valueCriteria] -}); - -console.log(events); - -// Asserting that I'm filtering a previous transfer event and the new value set event -expect(events.map((x) => x.decodedData)).toEqual([ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 10000n - ], - ['0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', 3000n] -]); -``` - -### Grouping Events by Topic Hash - -Use `filterGroupedEventLogs` to group events by topic hash, useful for categorizing events. The result is an array of arrays, one for each criterion. - -```typescript { name=contract-event-filter, category=example } -const groupedEvents = await thorSoloClient.logs.filterGroupedEventLogs({ - criteriaSet: [transferCriteria, valueCriteria] -}); - -// Asserting that I'm filtering a previous transfer event and the new value set event -expect(groupedEvents[0].map((x) => x.decodedData)).toEqual([ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 10000n - ] -]); - -expect(groupedEvents[1].map((x) => x.decodedData)).toEqual([ - ['0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', 3000n] -]); -``` - - diff --git a/docs/evm-extension.md b/docs/evm-extension.md deleted file mode 100644 index 6846050af..000000000 --- a/docs/evm-extension.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: EVM Extension ---- - -The VeChainThor Extension Contracts are a collection of Solidity smart contracts tailored for utilization on the VeChainThor blockchain platform. VeChainThor, a blockchain ecosystem emphasizing enterprise solutions and decentralized applications (dApps), benefits from these contracts to extend the Ethereum Virtual Machine (EVM) global functions, thereby enhancing blockchain interaction capabilities. - -## Purpose - -The primary objective of these contracts is to provide developers with streamlined access to critical blockchain functionalities specific to the VeChainThor network. They serve as a bridge between smart contracts deployed on VeChainThor and the underlying blockchain infrastructure. By encapsulating native operations within accessible Solidity functions, these contracts simplify the development process for decentralized applications and smart contracts on the platform. - -## Features - -The Extension Contracts offer a comprehensive set of functions covering essential blockchain operations: - - - Retrieval of block-specific details, including block ID, total score, time, and signer address. - - Access to transaction information, such as transaction ID, block reference, and expiration time. - - Querying the total supply of tokens and proven work for transactions. - -## Example - -```typescript { name=evm-extension, category=example } -// Create an instance of the ThorClient class -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// Call the getTotalSupply function of the `TestingContract` smart contract -const totalSupply = await thorSoloClient.contracts.executeCall( - TESTING_CONTRACT_ADDRESS, - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction('getTotalSupply'), - [] -); -``` diff --git a/docs/examples/accounts/bip32.ts b/docs/examples/accounts/bip32.ts deleted file mode 100644 index 7b5aa37a0..000000000 --- a/docs/examples/accounts/bip32.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Address, HDKey, Mnemonic } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: Bip32Snippet - -// 1 - Generate BIP39 mnemonic words, default to 12 words (128bit strength) - -const randomMnemonic = Mnemonic.of(); - -console.log('Mnemonic words', randomMnemonic); -// Mnemonic words: "w1 w2 ... w12" - -// 2 - Create BIP32 HD node from mnemonic words - -const hdnode = HDKey.fromMnemonic(randomMnemonic); - -// 3 - Derive 5 child private keys - -for (let i = 0; i < 5; i++) { - const child = hdnode.deriveChild(i); - console.log( - `children ${i} address`, - Address.ofPublicKey(child.publicKey).toString() - ); - console.log(`children ${i} private key`, child.privateKey); - // children 0 0x... - // children 1 0x... - // ... - // children 4 0x... -} - -// END_SNIPPET: Bip32Snippet - -// In the recovery process, validation is recommended -expect(Mnemonic.isValid(randomMnemonic)).toBeTruthy(); diff --git a/docs/examples/accounts/bip39.ts b/docs/examples/accounts/bip39.ts deleted file mode 100644 index b00148c20..000000000 --- a/docs/examples/accounts/bip39.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Hex, Mnemonic } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: Bip39Snippet - -// 1 - Generate BIP39 mnemonic words, default to 12 words (128bit strength) - -const randomMnemonic = Mnemonic.of(); - -console.log('Mnemonic words', randomMnemonic); -// Mnemonic words: "w1 w2 ... w12" - -// 2 - Derive private key from mnemonic words according to BIP32, using the path `m/44'/818'/0'/0`. - -// Defined for VET at https://github.com/satoshilabs/slips/blob/master/slip-0044.md -const privateKey = Mnemonic.toPrivateKey(randomMnemonic); - -console.log(Hex.of(privateKey).toString()); -// ...SOME PRIVATE KEY... - -// END_SNIPPET: Bip39Snippet - -// In recovery process, validation is recommended -expect(Mnemonic.isValid(randomMnemonic)).toBeTruthy(); diff --git a/docs/examples/accounts/keystore.ts b/docs/examples/accounts/keystore.ts deleted file mode 100644 index de3d5e41d..000000000 --- a/docs/examples/accounts/keystore.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { keystore, Secp256k1 } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: KeystoreSnippet - -// 1 - Create private key using Secp256k1 - -const privateKey = await Secp256k1.generatePrivateKey(); - -// @NOTE you can use BIP 39 too! -// const words = Mnemonic.of() -// const privateKey = Mnemonic.toPrivateKey(words) - -// ... - -// 2 - Encrypt/decrypt private key using Ethereum's keystore scheme - -// @NOTE the password should not be represented as a string, -// the Ethereum canonical representation to of password used in -// keystore encryption is UTF-8 NFKC. -const keyStorePassword = 'your password'; - -const newKeyStore = await keystore.encrypt(privateKey, keyStorePassword); - -// @NOTE the `encrypt` function wipes private key and password after use. - -// 3 - Throw the wrong password - -const recoveredPrivateKey = await keystore.decrypt( - newKeyStore, - keyStorePassword -); - -// @NOTE the `decrypt`` function wipes private key and password after use. - -console.log(recoveredPrivateKey.privateKey.toString()); -// 0x... - -// END_SNIPPET: KeystoreSnippet - -// Roughly check the keystore format -expect(keystore.isValid(newKeyStore)).toBeTruthy(); -// Key store ok true diff --git a/docs/examples/accounts/pubkey.ts b/docs/examples/accounts/pubkey.ts deleted file mode 100644 index de126fe12..000000000 --- a/docs/examples/accounts/pubkey.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Address, Hex, HDKey } from '@vechain/sdk-core'; - -// START_SNIPPET: PubKeySnippet - -// 1 - Create HD node from xpub (extended private key) and chain code - -const xpub = Hex.of( - '0x04dc40b4324626eb393dbf77b6930e915dcca6297b42508adb743674a8ad5c69a046010f801a62cb945a6cb137a050cefaba0572429fc4afc57df825bfca2f219a' -).bytes; - -const chainCode = Hex.of( - '0x105da5578eb3228655a8abe70bf4c317e525c7f7bb333634f5b7d1f70e111a33' -).bytes; - -// 2 - Create BIP32 HD node from xpub - -const hdKey = HDKey.fromPublicKey(xpub, chainCode); - -// 3 - Derive 5 child public keys - -for (let i = 0; i < 5; i++) { - const child = hdKey.deriveChild(i); - - console.log(`children ${i}`, Address.ofPublicKey(child.publicKey)); - // children 0 0x... - // children 1 0x... - // ... - // children 4 0x... -} - -// 4 - Wipe private data to avoid any hack. - -hdKey.wipePrivateData(); - -// END_SNIPPET: PubKeySnippet diff --git a/docs/examples/address/address-derivation.ts b/docs/examples/address/address-derivation.ts deleted file mode 100644 index 5a924355b..000000000 --- a/docs/examples/address/address-derivation.ts +++ /dev/null @@ -1,28 +0,0 @@ -// START_SNIPPET: AddressDerivationSnippet - -import { Address, Hex } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// Derive address from a private key -const addressFromPrivateKey = Address.ofPrivateKey( - Hex.of('0x7582be841ca040aa940fff6c05773129e135623e41acce3e0b8ba520dc1ae26a') - .bytes -).toString(); -console.log(addressFromPrivateKey); // 0xd989829d88B0eD1B06eDF5C50174eCfA64F14A64 - -// Derive address from a public key -const addressFromExtendedPublicKey = Address.ofPublicKey( - Hex.of( - '04b90e9bb2617387eba4502c730de65a33878ef384a46f1096d86f2da19043304afa67d0ad09cf2bea0c6f2d1767a9e62a7a7ecc41facf18f2fa505d92243a658f' - ).bytes -).toString(); -console.log(addressFromExtendedPublicKey); // 0xd989829d88B0eD1B06eDF5C50174eCfA64F14A64 - -// END_SNIPPET: AddressDerivationSnippet - -expect(addressFromPrivateKey).toEqual( - '0xd989829d88B0eD1B06eDF5C50174eCfA64F14A64' -); -expect(addressFromExtendedPublicKey).toEqual( - '0xd989829d88B0eD1B06eDF5C50174eCfA64F14A64' -); diff --git a/docs/examples/address/address-erc55-checksum.ts b/docs/examples/address/address-erc55-checksum.ts deleted file mode 100644 index 6ea9babe3..000000000 --- a/docs/examples/address/address-erc55-checksum.ts +++ /dev/null @@ -1,20 +0,0 @@ -// START_SNIPPET: AddressERC55ChecksumSnippet - -import { Address, HexUInt } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// Address without ERC55 checksum -const unchecksummedAddress = HexUInt.of( - '0x8617E340B3D01FA5F11F306F4090FD50E238070D'.toLowerCase() -); - -// Address with ERC55 checksum -const checksummedAddress = Address.checksum(unchecksummedAddress); - -console.log(checksummedAddress); // 0x8617E340B3D01FA5F11F306F4090FD50E238070D - -// END_SNIPPET: AddressERC55ChecksumSnippet - -expect(checksummedAddress).toEqual( - '0x8617E340B3D01FA5F11F306F4090FD50E238070D' -); diff --git a/docs/examples/address/address-validation.ts b/docs/examples/address/address-validation.ts deleted file mode 100644 index 2363ffa48..000000000 --- a/docs/examples/address/address-validation.ts +++ /dev/null @@ -1,18 +0,0 @@ -// START_SNIPPET: AddressValidationSnippet - -import { Address } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// Valid address -console.log(Address.isValid('0x8617E340B3D01FA5F11F306F4090FD50E238070D')); // true - -// Invalid address -console.log(Address.isValid('52908400098527886E0F7030069857D2E4169EE7')); // false - -// END_SNIPPET: AddressValidationSnippet - -expect( - Address.isValid('0x8617E340B3D01FA5F11F306F4090FD50E238070D') -).toBeTruthy(); - -expect(Address.isValid('52908400098527886E0F7030069857D2E4169EE7')).toBeFalsy(); diff --git a/docs/examples/bloom/bloom.ts b/docs/examples/bloom/bloom.ts deleted file mode 100644 index 88895c669..000000000 --- a/docs/examples/bloom/bloom.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { BloomFilter, HexUInt } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: BloomSnippet - -// 1 - Get best value of k (bits per key) - -const m = 100; // Number of hash functions used in the bloom filter, -const k = BloomFilter.computeBestHashFunctionsQuantity(m); -console.log(k); - -// 2 - Create an empty bloom filter with 14 bits per key. - -const bloomGenerator = BloomFilter.of(); - -// 3 - Add number from 0 to 99 to the bloom generator - -for (let i = 0; i < 100; i++) { - bloomGenerator.add(HexUInt.of(i).bytes); -} - -// 4 - Create the filter - -const bloomFilter = bloomGenerator.build(k, m); - -// Positive case (number from 0 to 99 must be present in the bloom filter) -for (let i = 0; i < 100; i++) { - const inFilter = bloomFilter.contains(HexUInt.of(i).bytes); // All true - expect(inFilter).toBeTruthy(); -} - -// Negative case (number from 100 must not be present in the bloom filter) -const notInFilter = bloomFilter.contains(HexUInt.of(100).bytes); // False -expect(notInFilter).toBeFalsy(); - -// END_SNIPPET: BloomSnippet diff --git a/docs/examples/certificates/sign_verify.ts b/docs/examples/certificates/sign_verify.ts deleted file mode 100644 index 30843549d..000000000 --- a/docs/examples/certificates/sign_verify.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Address, Certificate, Secp256k1 } from '@vechain/sdk-core'; - -// START_SNIPPET: SignVerifySnippet - -// 1 - Generate a private key and address for the signer - -const privateKey = await Secp256k1.generatePrivateKey(); -const publicKey = Secp256k1.derivePublicKey(privateKey); -const signerAddress = Address.ofPublicKey(publicKey).toString(); - -// 2 - Create a certificate - -const certificate = Certificate.of({ - purpose: 'identification', - payload: { - type: 'text', - content: 'fyi' - }, - domain: 'localhost', - timestamp: 1545035330, - signer: signerAddress -}); - -// 3 - Sign certificate - -certificate.sign(privateKey); - -// Verify certificate -certificate.verify(); - -// END_SNIPPET: SignVerifySnippet diff --git a/docs/examples/contracts/contract-clauses.ts b/docs/examples/contracts/contract-clauses.ts deleted file mode 100644 index 7bd603675..000000000 --- a/docs/examples/contracts/contract-clauses.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - Address, - Clause, - Units, - VET, - VTHO, - VTHO_ADDRESS -} from '@vechain/sdk-core'; - -// build some example clauses - -// 1. Transfer vet - -const transferVetClause = Clause.transferVET( - Address.of('0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54'), - VET.of(300n, Units.wei) -); - -// 2. Transfer VTHO - -const transferVTHOClause = Clause.transferToken( - Address.of(VTHO_ADDRESS), - Address.of('0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54'), - VTHO.of(300n, Units.wei) -); diff --git a/docs/examples/contracts/contract-create-ERC20-token.ts b/docs/examples/contracts/contract-create-ERC20-token.ts deleted file mode 100644 index 51a2bc6ab..000000000 --- a/docs/examples/contracts/contract-create-ERC20-token.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { ERC20_ABI, HexUInt, Units } from '@vechain/sdk-core'; -import { - ProviderInternalBaseWallet, - type ProviderInternalWalletAccount, - THOR_SOLO_URL, - ThorClient, - VeChainProvider, - type VeChainSigner -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// ERC20 contract bytecode -const erc20ContractBytecode: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600b81526020017f53616d706c65546f6b656e0000000000000000000000000000000000000000008152506040518060400160405280600281526020017f535400000000000000000000000000000000000000000000000000000000000081525081600390816200008f91906200062c565b508060049081620000a191906200062c565b505050620000e633620000b9620000ec60201b60201c565b60ff16600a620000ca919062000896565b620f4240620000da9190620008e7565b620000f560201b60201c565b62000a3a565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200016a5760006040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000161919062000977565b60405180910390fd5b6200017e600083836200018260201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603620001d8578060026000828254620001cb919062000994565b92505081905550620002ae565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101562000267578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016200025e93929190620009e0565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620002f9578060026000828254039250508190555062000346565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620003a5919062000a1d565b60405180910390a3505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043457607f821691505b6020821081036200044a5762000449620003ec565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620004b47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000475565b620004c0868362000475565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200050d620005076200050184620004d8565b620004e2565b620004d8565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b84845462000482565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000450565b620005b18462000465565b81016020851015620005c1578190505b620005d9620005d08562000465565b8301826200056a565b50505b505050565b600082821c905092915050565b60006200060160001984600802620005e1565b1980831691505092915050565b60006200061c8383620005ee565b9150826002028217905092915050565b6200063782620003b2565b67ffffffffffffffff811115620006535762000652620003bd565b5b6200065f82546200041b565b6200066c82828562000591565b600060209050601f831160018114620006a457600084156200068f578287015190505b6200069b85826200060e565b8655506200070b565b601f198416620006b48662000450565b60005b82811015620006de57848901518255600182019150602085019450602081019050620006b7565b86831015620006fe5784890151620006fa601f891682620005ee565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620007a15780860481111562000779576200077862000713565b5b6001851615620007895780820291505b8081029050620007998562000742565b945062000759565b94509492505050565b600082620007bc57600190506200088f565b81620007cc57600090506200088f565b8160018114620007e55760028114620007f05762000826565b60019150506200088f565b60ff84111562000805576200080462000713565b5b8360020a9150848211156200081f576200081e62000713565b5b506200088f565b5060208310610133831016604e8410600b8410161715620008605782820a9050838111156200085a576200085962000713565b5b6200088f565b6200086f84848460016200074f565b9250905081840481111562000889576200088862000713565b5b81810290505b9392505050565b6000620008a382620004d8565b9150620008b083620004d8565b9250620008df7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620007aa565b905092915050565b6000620008f482620004d8565b91506200090183620004d8565b92508282026200091181620004d8565b915082820484148315176200092b576200092a62000713565b5b5092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200095f8262000932565b9050919050565b620009718162000952565b82525050565b60006020820190506200098e600083018462000966565b92915050565b6000620009a182620004d8565b9150620009ae83620004d8565b9250828201905080821115620009c957620009c862000713565b5b92915050565b620009da81620004d8565b82525050565b6000606082019050620009f7600083018662000966565b62000a066020830185620009cf565b62000a156040830184620009cf565b949350505050565b600060208201905062000a346000830184620009cf565b92915050565b610e558062000a4a6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610aa9565b60405180910390f35b6100d060048036038101906100cb9190610b64565b610292565b6040516100dd9190610bbf565b60405180910390f35b6100ee6102b5565b6040516100fb9190610be9565b60405180910390f35b61011e60048036038101906101199190610c04565b6102bf565b60405161012b9190610bbf565b60405180910390f35b61013c6102ee565b6040516101499190610c73565b60405180910390f35b61016c60048036038101906101679190610c8e565b6102f7565b6040516101799190610be9565b60405180910390f35b61018a61033f565b6040516101979190610aa9565b60405180910390f35b6101ba60048036038101906101b59190610b64565b6103d1565b6040516101c79190610bbf565b60405180910390f35b6101ea60048036038101906101e59190610cbb565b6103f4565b6040516101f79190610be9565b60405180910390f35b60606003805461020f90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461023b90610d2a565b80156102885780601f1061025d57610100808354040283529160200191610288565b820191906000526020600020905b81548152906001019060200180831161026b57829003601f168201915b5050505050905090565b60008061029d61047b565b90506102aa818585610483565b600191505092915050565b6000600254905090565b6000806102ca61047b565b90506102d7858285610495565b6102e2858585610529565b60019150509392505050565b60006012905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461034e90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610d2a565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050505050905090565b6000806103dc61047b565b90506103e9818585610529565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b610490838383600161061d565b505050565b60006104a184846103f4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146105235781811015610513578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161050a93929190610d6a565b60405180910390fd5b6105228484848403600061061d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361059b5760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105929190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361060d5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016106049190610da1565b60405180910390fd5b6106188383836107f4565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361068f5760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016106869190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036107015760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016106f89190610da1565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080156107ee578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516107e59190610be9565b60405180910390a35b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084657806002600082825461083a9190610deb565b92505081905550610919565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156108d2578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016108c993929190610d6a565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361096257806002600082825403925050819055506109af565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a0c9190610be9565b60405180910390a3505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610a53578082015181840152602081019050610a38565b60008484015250505050565b6000601f19601f8301169050919050565b6000610a7b82610a19565b610a858185610a24565b9350610a95818560208601610a35565b610a9e81610a5f565b840191505092915050565b60006020820190508181036000830152610ac38184610a70565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610afb82610ad0565b9050919050565b610b0b81610af0565b8114610b1657600080fd5b50565b600081359050610b2881610b02565b92915050565b6000819050919050565b610b4181610b2e565b8114610b4c57600080fd5b50565b600081359050610b5e81610b38565b92915050565b60008060408385031215610b7b57610b7a610acb565b5b6000610b8985828601610b19565b9250506020610b9a85828601610b4f565b9150509250929050565b60008115159050919050565b610bb981610ba4565b82525050565b6000602082019050610bd46000830184610bb0565b92915050565b610be381610b2e565b82525050565b6000602082019050610bfe6000830184610bda565b92915050565b600080600060608486031215610c1d57610c1c610acb565b5b6000610c2b86828701610b19565b9350506020610c3c86828701610b19565b9250506040610c4d86828701610b4f565b9150509250925092565b600060ff82169050919050565b610c6d81610c57565b82525050565b6000602082019050610c886000830184610c64565b92915050565b600060208284031215610ca457610ca3610acb565b5b6000610cb284828501610b19565b91505092915050565b60008060408385031215610cd257610cd1610acb565b5b6000610ce085828601610b19565b9250506020610cf185828601610b19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610d4257607f821691505b602082108103610d5557610d54610cfb565b5b50919050565b610d6481610af0565b82525050565b6000606082019050610d7f6000830186610d5b565b610d8c6020830185610bda565b610d996040830184610bda565b949350505050565b6000602082019050610db66000830184610d5b565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df682610b2e565b9150610e0183610b2e565b9250828201905080821115610e1957610e18610dbc565b5b9291505056fea2646970667358221220912f5265edaea44910db734f0d00fccd257c78dba79c126931551eaad1a334f764736f6c63430008170033'; - -// Defining the deployer account, which has VTHO for deployment costs -const deployerAccount: ProviderInternalWalletAccount = { - privateKey: HexUInt.of( - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff' - ).bytes, - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' -}; - -// START_SNIPPET: CreateERC20TokenSnippet - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount]) -); -const signer = (await provider.getSigner( - deployerAccount.address -)) as VeChainSigner; - -// Creating the contract factory -const contractFactory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer -); - -// Deploying the contract -await contractFactory.startDeployment(); - -// Awaiting the contract deployment -const contract = await contractFactory.waitForDeployment(); - -// Awaiting the transaction receipt to confirm successful contract deployment -const receipt = contract.deployTransactionReceipt; - -// Asserting that the contract deployment didn't revert, indicating a successful deployment -expect(receipt.reverted).toEqual(false); - -const balance = await contract.read.balanceOf(deployerAccount.address); - -const expectedBalance = Units.parseUnits('1000000', Units.ether).bi; -// Asserting that the initial balance of the deployer is the expected amount (1e24 wei = 1e6 ether) -expect(balance).toEqual([expectedBalance]); - -// END_SNIPPET: CreateERC20TokenSnippet - -// START_SNIPPET: ERC20MultiClausesReadSnippet - -// Reading data from multiple clauses in a single call -const multipleClausesResult = - await thorSoloClient.contracts.executeMultipleClausesCall([ - contract.clause.totalSupply(), - contract.clause.name(), - contract.clause.symbol(), - contract.clause.decimals() - ]); - -expect(multipleClausesResult[0]).toEqual({ - success: true, - result: { - plain: expectedBalance, - array: [expectedBalance] - } -}); -expect(multipleClausesResult[1]).toEqual({ - success: true, - result: { - plain: 'SampleToken', - array: ['SampleToken'] - } -}); -expect(multipleClausesResult[2]).toEqual({ - success: true, - result: { - plain: 'ST', - array: ['ST'] - } -}); -expect(multipleClausesResult[3]).toEqual({ - success: true, - result: { - plain: 18, - array: [18] - } -}); - -// END_SNIPPET: ERC20MultiClausesReadSnippet diff --git a/docs/examples/contracts/contract-delegation-ERC20.ts b/docs/examples/contracts/contract-delegation-ERC20.ts deleted file mode 100644 index 6138b99b7..000000000 --- a/docs/examples/contracts/contract-delegation-ERC20.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { ERC20_ABI, Hex, HexUInt } from '@vechain/sdk-core'; -import { - type Contract, - ProviderInternalBaseWallet, - type ProviderInternalWalletAccount, - THOR_SOLO_URL, - ThorClient, - type TransactionReceipt, - VeChainProvider, - type VeChainSigner -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// ERC20 contract bytecode -const erc20ContractBytecode: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600b81526020017f53616d706c65546f6b656e0000000000000000000000000000000000000000008152506040518060400160405280600281526020017f535400000000000000000000000000000000000000000000000000000000000081525081600390816200008f91906200062c565b508060049081620000a191906200062c565b505050620000e633620000b9620000ec60201b60201c565b60ff16600a620000ca919062000896565b620f4240620000da9190620008e7565b620000f560201b60201c565b62000a3a565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200016a5760006040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000161919062000977565b60405180910390fd5b6200017e600083836200018260201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603620001d8578060026000828254620001cb919062000994565b92505081905550620002ae565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101562000267578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016200025e93929190620009e0565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620002f9578060026000828254039250508190555062000346565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620003a5919062000a1d565b60405180910390a3505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043457607f821691505b6020821081036200044a5762000449620003ec565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620004b47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000475565b620004c0868362000475565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200050d620005076200050184620004d8565b620004e2565b620004d8565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b84845462000482565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000450565b620005b18462000465565b81016020851015620005c1578190505b620005d9620005d08562000465565b8301826200056a565b50505b505050565b600082821c905092915050565b60006200060160001984600802620005e1565b1980831691505092915050565b60006200061c8383620005ee565b9150826002028217905092915050565b6200063782620003b2565b67ffffffffffffffff811115620006535762000652620003bd565b5b6200065f82546200041b565b6200066c82828562000591565b600060209050601f831160018114620006a457600084156200068f578287015190505b6200069b85826200060e565b8655506200070b565b601f198416620006b48662000450565b60005b82811015620006de57848901518255600182019150602085019450602081019050620006b7565b86831015620006fe5784890151620006fa601f891682620005ee565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620007a15780860481111562000779576200077862000713565b5b6001851615620007895780820291505b8081029050620007998562000742565b945062000759565b94509492505050565b600082620007bc57600190506200088f565b81620007cc57600090506200088f565b8160018114620007e55760028114620007f05762000826565b60019150506200088f565b60ff84111562000805576200080462000713565b5b8360020a9150848211156200081f576200081e62000713565b5b506200088f565b5060208310610133831016604e8410600b8410161715620008605782820a9050838111156200085a576200085962000713565b5b6200088f565b6200086f84848460016200074f565b9250905081840481111562000889576200088862000713565b5b81810290505b9392505050565b6000620008a382620004d8565b9150620008b083620004d8565b9250620008df7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620007aa565b905092915050565b6000620008f482620004d8565b91506200090183620004d8565b92508282026200091181620004d8565b915082820484148315176200092b576200092a62000713565b5b5092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200095f8262000932565b9050919050565b620009718162000952565b82525050565b60006020820190506200098e600083018462000966565b92915050565b6000620009a182620004d8565b9150620009ae83620004d8565b9250828201905080821115620009c957620009c862000713565b5b92915050565b620009da81620004d8565b82525050565b6000606082019050620009f7600083018662000966565b62000a066020830185620009cf565b62000a156040830184620009cf565b949350505050565b600060208201905062000a346000830184620009cf565b92915050565b610e558062000a4a6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610aa9565b60405180910390f35b6100d060048036038101906100cb9190610b64565b610292565b6040516100dd9190610bbf565b60405180910390f35b6100ee6102b5565b6040516100fb9190610be9565b60405180910390f35b61011e60048036038101906101199190610c04565b6102bf565b60405161012b9190610bbf565b60405180910390f35b61013c6102ee565b6040516101499190610c73565b60405180910390f35b61016c60048036038101906101679190610c8e565b6102f7565b6040516101799190610be9565b60405180910390f35b61018a61033f565b6040516101979190610aa9565b60405180910390f35b6101ba60048036038101906101b59190610b64565b6103d1565b6040516101c79190610bbf565b60405180910390f35b6101ea60048036038101906101e59190610cbb565b6103f4565b6040516101f79190610be9565b60405180910390f35b60606003805461020f90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461023b90610d2a565b80156102885780601f1061025d57610100808354040283529160200191610288565b820191906000526020600020905b81548152906001019060200180831161026b57829003601f168201915b5050505050905090565b60008061029d61047b565b90506102aa818585610483565b600191505092915050565b6000600254905090565b6000806102ca61047b565b90506102d7858285610495565b6102e2858585610529565b60019150509392505050565b60006012905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461034e90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610d2a565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050505050905090565b6000806103dc61047b565b90506103e9818585610529565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b610490838383600161061d565b505050565b60006104a184846103f4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146105235781811015610513578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161050a93929190610d6a565b60405180910390fd5b6105228484848403600061061d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361059b5760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105929190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361060d5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016106049190610da1565b60405180910390fd5b6106188383836107f4565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361068f5760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016106869190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036107015760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016106f89190610da1565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080156107ee578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516107e59190610be9565b60405180910390a35b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084657806002600082825461083a9190610deb565b92505081905550610919565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156108d2578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016108c993929190610d6a565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361096257806002600082825403925050819055506109af565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a0c9190610be9565b60405180910390a3505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610a53578082015181840152602081019050610a38565b60008484015250505050565b6000601f19601f8301169050919050565b6000610a7b82610a19565b610a858185610a24565b9350610a95818560208601610a35565b610a9e81610a5f565b840191505092915050565b60006020820190508181036000830152610ac38184610a70565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610afb82610ad0565b9050919050565b610b0b81610af0565b8114610b1657600080fd5b50565b600081359050610b2881610b02565b92915050565b6000819050919050565b610b4181610b2e565b8114610b4c57600080fd5b50565b600081359050610b5e81610b38565b92915050565b60008060408385031215610b7b57610b7a610acb565b5b6000610b8985828601610b19565b9250506020610b9a85828601610b4f565b9150509250929050565b60008115159050919050565b610bb981610ba4565b82525050565b6000602082019050610bd46000830184610bb0565b92915050565b610be381610b2e565b82525050565b6000602082019050610bfe6000830184610bda565b92915050565b600080600060608486031215610c1d57610c1c610acb565b5b6000610c2b86828701610b19565b9350506020610c3c86828701610b19565b9250506040610c4d86828701610b4f565b9150509250925092565b600060ff82169050919050565b610c6d81610c57565b82525050565b6000602082019050610c886000830184610c64565b92915050565b600060208284031215610ca457610ca3610acb565b5b6000610cb284828501610b19565b91505092915050565b60008060408385031215610cd257610cd1610acb565b5b6000610ce085828601610b19565b9250506020610cf185828601610b19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610d4257607f821691505b602082108103610d5557610d54610cfb565b5b50919050565b610d6481610af0565b82525050565b6000606082019050610d7f6000830186610d5b565b610d8c6020830185610bda565b610d996040830184610bda565b949350505050565b6000602082019050610db66000830184610d5b565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df682610b2e565b9150610e0183610b2e565b9250828201905080821115610e1957610e18610dbc565b5b9291505056fea2646970667358221220912f5265edaea44910db734f0d00fccd257c78dba79c126931551eaad1a334f764736f6c63430008170033'; - -// Defining the deployer account, which has VTHO for deployment costs -const deployerAccount: ProviderInternalWalletAccount = { - privateKey: HexUInt.of( - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff' - ).bytes, - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' -}; - -// Defining the delegator account, which has VTHO for transaction costs -const delegatorAccount = { - privateKey: - '521b7793c6eb27d137b617627c6b85d57c0aa303380e9ca4e30a30302fbc6676', - address: '0x062F167A905C1484DE7e75B88EDC7439f82117DE' -}; - -// START_SNIPPET: ERC20FunctionCallDelegatedSnippet - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount], { - delegator: { - delegatorPrivateKey: delegatorAccount.privateKey - } - }), - true -); -const signer = (await provider.getSigner( - deployerAccount.address -)) as VeChainSigner; - -// Defining a function for deploying the ERC20 contract -const setupERC20Contract = async (): Promise> => { - const contractFactory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - // Deploying the contract - await contractFactory.startDeployment(); - - // Waiting for the contract to be deployed - return await contractFactory.waitForDeployment(); -}; - -// Setting up the ERC20 contract and getting its address -const contract = await setupERC20Contract(); - -// Transferring 10000 tokens to another address with a delegated transaction -const transferResult = await contract.transact.transfer( - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - 10000n -); - -// Wait for the transfer transaction to complete and obtain its receipt -const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - -// Asserting that the transaction has not been reverted -expect(transactionReceiptTransfer.reverted).toEqual(false); - -// END_SNIPPET: ERC20FunctionCallDelegatedSnippet diff --git a/docs/examples/contracts/contract-deploy.ts b/docs/examples/contracts/contract-deploy.ts deleted file mode 100644 index 2cf151b83..000000000 --- a/docs/examples/contracts/contract-deploy.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Clause, HexUInt } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: ContractDeploySnippet - -// 1 - Init contract bytecode to deploy - -const contractBytecode = HexUInt.of( - '0x608060405234801561000f575f80fd5b506101438061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c806360fe47b1146100385780636d4ce63c14610054575b5f80fd5b610052600480360381019061004d91906100ba565b610072565b005b61005c61007b565b60405161006991906100f4565b60405180910390f35b805f8190555050565b5f8054905090565b5f80fd5b5f819050919050565b61009981610087565b81146100a3575f80fd5b50565b5f813590506100b481610090565b92915050565b5f602082840312156100cf576100ce610083565b5b5f6100dc848285016100a6565b91505092915050565b6100ee81610087565b82525050565b5f6020820190506101075f8301846100e5565b9291505056fea2646970667358221220427ff5682ef89b62b910bb1286c1028d32283512122854159ad59f1c71fb6d8764736f6c63430008160033' -); - -// 2 - Create a clause to deploy the contract -const clause = Clause.deployContract(contractBytecode); - -// END_SNIPPET: ContractDeploySnippet - -// The first clause of the transaction should be a deployed contract clause -expect(clause.data).toEqual(contractBytecode.toString()); diff --git a/docs/examples/contracts/contract-deposit.ts b/docs/examples/contracts/contract-deposit.ts deleted file mode 100644 index ce6419e81..000000000 --- a/docs/examples/contracts/contract-deposit.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { expect } from 'expect'; -import { - ProviderInternalBaseWallet, - type ProviderInternalWalletAccount, - THOR_SOLO_URL, - ThorClient, - VeChainProvider, - type VeChainSigner -} from '@vechain/sdk-network'; -import { HexUInt } from '@vechain/sdk-core'; - -// Deposit contract bytecode -const depositContractBytecode: string = - '0x608060405234801561001057600080fd5b50610405806100206000396000f3fe6080604052600436106100345760003560e01c806327e235e314610039578063d0e30db014610076578063f8b2cb4f14610080575b600080fd5b34801561004557600080fd5b50610060600480360381019061005b9190610268565b6100bd565b60405161006d91906102ae565b60405180910390f35b61007e6100d5565b005b34801561008c57600080fd5b506100a760048036038101906100a29190610268565b6101bd565b6040516100b491906102ae565b60405180910390f35b60006020528060005260406000206000915090505481565b60003411610118576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161010f9061034c565b60405180910390fd5b346000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610166919061039b565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167fd15c9547ea5c06670c0010ce19bc32d54682a4b3801ece7f3ab0c3f17106b4bb346040516101b391906102ae565b60405180910390a2565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102358261020a565b9050919050565b6102458161022a565b811461025057600080fd5b50565b6000813590506102628161023c565b92915050565b60006020828403121561027e5761027d610205565b5b600061028c84828501610253565b91505092915050565b6000819050919050565b6102a881610295565b82525050565b60006020820190506102c3600083018461029f565b92915050565b600082825260208201905092915050565b7f4465706f73697420616d6f756e74206d7573742062652067726561746572207460008201527f68616e2030000000000000000000000000000000000000000000000000000000602082015250565b60006103366025836102c9565b9150610341826102da565b604082019050919050565b6000602082019050818103600083015261036581610329565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103a682610295565b91506103b183610295565b92508282019050808211156103c9576103c861036c565b5b9291505056fea2646970667358221220fd4fcedf2b3aacc02a6c483409206998028d766cf51d642f6c5c35d6f81118e864736f6c63430008180033'; - -// Defining the deployer account, which has VTHO for deployment costs -const deployerAccount: ProviderInternalWalletAccount = { - privateKey: HexUInt.of( - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff' - ).bytes, - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' -}; - -const depositContractAbi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'depositor', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256' - } - ], - name: 'DepositMade', - type: 'event' - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - name: 'balances', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'deposit', - outputs: [], - stateMutability: 'payable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'addr', - type: 'address' - } - ], - name: 'getBalance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; - -// Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount]) -); -const signer = (await provider.getSigner( - deployerAccount.address -)) as VeChainSigner; - -// START_SNIPPET: DepositContractSnippet - -// Creating the contract factory -const contractFactory = thorSoloClient.contracts.createContractFactory( - depositContractAbi, - depositContractBytecode, - signer -); - -const contract = await ( - await contractFactory.startDeployment() -).waitForDeployment(); - -await (await contract.transact.deposit({ value: 1000 })).wait(); - -const balance = await contract.read.getBalance(deployerAccount.address); - -expect(balance).toEqual([BigInt(1000)]); - -// END_SNIPPET: DepositContractSnippet diff --git a/docs/examples/contracts/contract-event-filter.ts b/docs/examples/contracts/contract-event-filter.ts deleted file mode 100644 index f8314f934..000000000 --- a/docs/examples/contracts/contract-event-filter.ts +++ /dev/null @@ -1,206 +0,0 @@ -import { ERC20_ABI, HexUInt } from '@vechain/sdk-core'; -import { - type Contract, - ProviderInternalBaseWallet, - type ProviderInternalWalletAccount, - THOR_SOLO_URL, - ThorClient, - type TransactionReceipt, - VeChainProvider, - type VeChainSigner -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// ERC20 contract bytecode -const erc20ContractBytecode: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600b81526020017f53616d706c65546f6b656e0000000000000000000000000000000000000000008152506040518060400160405280600281526020017f535400000000000000000000000000000000000000000000000000000000000081525081600390816200008f91906200062c565b508060049081620000a191906200062c565b505050620000e633620000b9620000ec60201b60201c565b60ff16600a620000ca919062000896565b620f4240620000da9190620008e7565b620000f560201b60201c565b62000a3a565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200016a5760006040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000161919062000977565b60405180910390fd5b6200017e600083836200018260201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603620001d8578060026000828254620001cb919062000994565b92505081905550620002ae565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101562000267578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016200025e93929190620009e0565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620002f9578060026000828254039250508190555062000346565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620003a5919062000a1d565b60405180910390a3505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043457607f821691505b6020821081036200044a5762000449620003ec565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620004b47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000475565b620004c0868362000475565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200050d620005076200050184620004d8565b620004e2565b620004d8565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b84845462000482565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000450565b620005b18462000465565b81016020851015620005c1578190505b620005d9620005d08562000465565b8301826200056a565b50505b505050565b600082821c905092915050565b60006200060160001984600802620005e1565b1980831691505092915050565b60006200061c8383620005ee565b9150826002028217905092915050565b6200063782620003b2565b67ffffffffffffffff811115620006535762000652620003bd565b5b6200065f82546200041b565b6200066c82828562000591565b600060209050601f831160018114620006a457600084156200068f578287015190505b6200069b85826200060e565b8655506200070b565b601f198416620006b48662000450565b60005b82811015620006de57848901518255600182019150602085019450602081019050620006b7565b86831015620006fe5784890151620006fa601f891682620005ee565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620007a15780860481111562000779576200077862000713565b5b6001851615620007895780820291505b8081029050620007998562000742565b945062000759565b94509492505050565b600082620007bc57600190506200088f565b81620007cc57600090506200088f565b8160018114620007e55760028114620007f05762000826565b60019150506200088f565b60ff84111562000805576200080462000713565b5b8360020a9150848211156200081f576200081e62000713565b5b506200088f565b5060208310610133831016604e8410600b8410161715620008605782820a9050838111156200085a576200085962000713565b5b6200088f565b6200086f84848460016200074f565b9250905081840481111562000889576200088862000713565b5b81810290505b9392505050565b6000620008a382620004d8565b9150620008b083620004d8565b9250620008df7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620007aa565b905092915050565b6000620008f482620004d8565b91506200090183620004d8565b92508282026200091181620004d8565b915082820484148315176200092b576200092a62000713565b5b5092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200095f8262000932565b9050919050565b620009718162000952565b82525050565b60006020820190506200098e600083018462000966565b92915050565b6000620009a182620004d8565b9150620009ae83620004d8565b9250828201905080821115620009c957620009c862000713565b5b92915050565b620009da81620004d8565b82525050565b6000606082019050620009f7600083018662000966565b62000a066020830185620009cf565b62000a156040830184620009cf565b949350505050565b600060208201905062000a346000830184620009cf565b92915050565b610e558062000a4a6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610aa9565b60405180910390f35b6100d060048036038101906100cb9190610b64565b610292565b6040516100dd9190610bbf565b60405180910390f35b6100ee6102b5565b6040516100fb9190610be9565b60405180910390f35b61011e60048036038101906101199190610c04565b6102bf565b60405161012b9190610bbf565b60405180910390f35b61013c6102ee565b6040516101499190610c73565b60405180910390f35b61016c60048036038101906101679190610c8e565b6102f7565b6040516101799190610be9565b60405180910390f35b61018a61033f565b6040516101979190610aa9565b60405180910390f35b6101ba60048036038101906101b59190610b64565b6103d1565b6040516101c79190610bbf565b60405180910390f35b6101ea60048036038101906101e59190610cbb565b6103f4565b6040516101f79190610be9565b60405180910390f35b60606003805461020f90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461023b90610d2a565b80156102885780601f1061025d57610100808354040283529160200191610288565b820191906000526020600020905b81548152906001019060200180831161026b57829003601f168201915b5050505050905090565b60008061029d61047b565b90506102aa818585610483565b600191505092915050565b6000600254905090565b6000806102ca61047b565b90506102d7858285610495565b6102e2858585610529565b60019150509392505050565b60006012905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461034e90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610d2a565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050505050905090565b6000806103dc61047b565b90506103e9818585610529565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b610490838383600161061d565b505050565b60006104a184846103f4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146105235781811015610513578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161050a93929190610d6a565b60405180910390fd5b6105228484848403600061061d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361059b5760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105929190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361060d5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016106049190610da1565b60405180910390fd5b6106188383836107f4565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361068f5760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016106869190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036107015760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016106f89190610da1565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080156107ee578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516107e59190610be9565b60405180910390a35b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084657806002600082825461083a9190610deb565b92505081905550610919565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156108d2578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016108c993929190610d6a565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361096257806002600082825403925050819055506109af565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a0c9190610be9565b60405180910390a3505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610a53578082015181840152602081019050610a38565b60008484015250505050565b6000601f19601f8301169050919050565b6000610a7b82610a19565b610a858185610a24565b9350610a95818560208601610a35565b610a9e81610a5f565b840191505092915050565b60006020820190508181036000830152610ac38184610a70565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610afb82610ad0565b9050919050565b610b0b81610af0565b8114610b1657600080fd5b50565b600081359050610b2881610b02565b92915050565b6000819050919050565b610b4181610b2e565b8114610b4c57600080fd5b50565b600081359050610b5e81610b38565b92915050565b60008060408385031215610b7b57610b7a610acb565b5b6000610b8985828601610b19565b9250506020610b9a85828601610b4f565b9150509250929050565b60008115159050919050565b610bb981610ba4565b82525050565b6000602082019050610bd46000830184610bb0565b92915050565b610be381610b2e565b82525050565b6000602082019050610bfe6000830184610bda565b92915050565b600080600060608486031215610c1d57610c1c610acb565b5b6000610c2b86828701610b19565b9350506020610c3c86828701610b19565b9250506040610c4d86828701610b4f565b9150509250925092565b600060ff82169050919050565b610c6d81610c57565b82525050565b6000602082019050610c886000830184610c64565b92915050565b600060208284031215610ca457610ca3610acb565b5b6000610cb284828501610b19565b91505092915050565b60008060408385031215610cd257610cd1610acb565b5b6000610ce085828601610b19565b9250506020610cf185828601610b19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610d4257607f821691505b602082108103610d5557610d54610cfb565b5b50919050565b610d6481610af0565b82525050565b6000606082019050610d7f6000830186610d5b565b610d8c6020830185610bda565b610d996040830184610bda565b949350505050565b6000602082019050610db66000830184610d5b565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df682610b2e565b9150610e0183610b2e565b9250828201905080821115610e1957610e18610dbc565b5b9291505056fea2646970667358221220912f5265edaea44910db734f0d00fccd257c78dba79c126931551eaad1a334f764736f6c63430008170033'; - -const eventExampleBytecode = - '0x608060405234801561001057600080fd5b5061019b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633fa4f2451461003b5780635524107714610059575b600080fd5b610043610075565b60405161005091906100ec565b60405180910390f35b610073600480360381019061006e9190610138565b61007b565b005b60005481565b806000819055503373ffffffffffffffffffffffffffffffffffffffff167ff3f57717dff9f5f10af315efdbfadc60c42152c11fc0c3c413bbfbdc661f143c826040516100c891906100ec565b60405180910390a250565b6000819050919050565b6100e6816100d3565b82525050565b600060208201905061010160008301846100dd565b92915050565b600080fd5b610115816100d3565b811461012057600080fd5b50565b6000813590506101328161010c565b92915050565b60006020828403121561014e5761014d610107565b5b600061015c84828501610123565b9150509291505056fea2646970667358221220d6092bd20e3b6594cb285317ce56a11fd752ee174eaac9ee555f0db6f4f3d4f764736f6c63430008180033'; - -const eventExampleAbi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: '_setter', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'ValueSet', - type: 'event' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_newValue', - type: 'uint256' - } - ], - name: 'setValue', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'value', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; - -// Defining the deployer account, which has VTHO for deployment costs -const deployerAccount: ProviderInternalWalletAccount = { - privateKey: HexUInt.of( - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff' - ).bytes, - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' -}; - -// Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount]) -); -const signer = (await provider.getSigner( - deployerAccount.address -)) as VeChainSigner; - -// Defining a function for deploying the ERC20 contract -const setupERC20Contract = async (): Promise> => { - const contractFactory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - // Deploying the contract - await contractFactory.startDeployment(); - - // Waiting for the contract to be deployed - return await contractFactory.waitForDeployment(); -}; - -const setupEventExampleContract = async (): Promise< - Contract -> => { - const contractFactory = thorSoloClient.contracts.createContractFactory( - eventExampleAbi, - eventExampleBytecode, - signer - ); - - // Deploying the contract - await contractFactory.startDeployment(); - - // Waiting for the contract to be deployed - return await contractFactory.waitForDeployment(); -}; - -// Setting up the ERC20 contract and getting its address -const contractErc20 = await setupERC20Contract(); - -// START_SNIPPET: ERC20FilterEventSnippet - -// Starting from a deployed contract instance, transfer some tokens to a specific address -const transferResult = await contractErc20.transact.transfer( - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - 10000n -); - -// Wait for the transfer transaction to complete and obtain its receipt -const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - -// Asserting that the transaction has not been reverted -expect(transactionReceiptTransfer.reverted).toEqual(false); - -// 1. passing an array of arguments -const transferEventsArrayArgs = await contractErc20.filters - .Transfer([undefined, '0x9e7911de289c3c856ce7f421034f66b6cde49c39']) - .get(); - -// 2. passing an object with the arguments as properties -const transferEventsObjectArgs = await contractErc20.filters - .Transfer({ - to: '0x9e7911de289c3c856ce7f421034f66b6cde49c39' - }) - .get(); - -// Asserting that the transfer event has been emitted -expect(transferEventsArrayArgs.length).toEqual(1); -expect(transferEventsObjectArgs.length).toEqual(1); - -// log the transfer events -console.log(transferEventsArrayArgs); - -// END_SNIPPET: ERC20FilterEventSnippet - -// START_SNIPPET: ERC20FilterMultipleEventCriteriaSnippet - -const contractEventExample = await setupEventExampleContract(); - -await (await contractEventExample.transact.setValue(3000n)).wait(); - -const transferCriteria = contractErc20.criteria.Transfer({ - to: '0x9e7911de289c3c856ce7f421034f66b6cde49c39' -}); - -const valueCriteria = contractEventExample.criteria.ValueSet(); - -const events = await thorSoloClient.logs.filterEventLogs({ - criteriaSet: [transferCriteria, valueCriteria] -}); - -console.log(events); - -// Asserting that I'm filtering a previous transfer event and the new value set event -expect(events.map((x) => x.decodedData)).toEqual([ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 10000n - ], - ['0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', 3000n] -]); - -// END_SNIPPET: ERC20FilterMultipleEventCriteriaSnippet - -// START_SNIPPET: ERC20FilterGroupedMultipleEventCriteriaSnippet - -const groupedEvents = await thorSoloClient.logs.filterGroupedEventLogs({ - criteriaSet: [transferCriteria, valueCriteria] -}); - -// Asserting that I'm filtering a previous transfer event and the new value set event -expect(groupedEvents[0].map((x) => x.decodedData)).toEqual([ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 10000n - ] -]); - -expect(groupedEvents[1].map((x) => x.decodedData)).toEqual([ - ['0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', 3000n] -]); - -// END_SNIPPET: ERC20FilterGroupedMultipleEventCriteriaSnippet diff --git a/docs/examples/contracts/contract-function-call.ts b/docs/examples/contracts/contract-function-call.ts deleted file mode 100644 index b1a18c291..000000000 --- a/docs/examples/contracts/contract-function-call.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { ABIContract, Address, Clause } from '@vechain/sdk-core'; -import { THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: ContractFunctionCallSnippet - -// 1 - Init a simple contract ABI -const contractABI = [ - { - constant: false, - inputs: [ - { - name: 'value', - type: 'uint256' - } - ], - name: 'setValue', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'getValue', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - } -] as const; - -// 2 - Create a clause to call setValue(123) -const clause = Clause.callFunction( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), // just a sample deployed contract address - ABIContract.ofAbi(contractABI).getFunction('setValue'), - [123] -); - -// END_SNIPPET: ContractFunctionCallSnippet - -// START_SNIPPET: ContractObjectFunctionCallSnippet - -// 1 - Build the thor client and load the contract - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -const contract = thorSoloClient.contracts.load( - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - contractABI -); - -// 2 - Create a clause to call setValue(123) -const setValueClause = contract.clause.setValue(123); - -// END_SNIPPET: ContractObjectFunctionCallSnippet - -// 3 - Check the parameters of the clause - -expect(clause.to).toBe('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'); -expect(clause.value).toBe('0x0'); -expect(clause.data).toBeDefined(); - -expect(setValueClause.clause.to).toBe( - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' -); -expect(setValueClause.clause.value).toBe('0x0'); -expect(setValueClause.clause.data).toBeDefined(); diff --git a/docs/examples/contracts/contract-transfer-ERC20-token.ts b/docs/examples/contracts/contract-transfer-ERC20-token.ts deleted file mode 100644 index 165c08660..000000000 --- a/docs/examples/contracts/contract-transfer-ERC20-token.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { ERC20_ABI, HexUInt, Units } from '@vechain/sdk-core'; -import { - type Contract, - ProviderInternalBaseWallet, - type ProviderInternalWalletAccount, - THOR_SOLO_URL, - ThorClient, - type TransactionReceipt, - VeChainProvider, - type VeChainSigner -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// ERC20 contract bytecode -const erc20ContractBytecode: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600b81526020017f53616d706c65546f6b656e0000000000000000000000000000000000000000008152506040518060400160405280600281526020017f535400000000000000000000000000000000000000000000000000000000000081525081600390816200008f91906200062c565b508060049081620000a191906200062c565b505050620000e633620000b9620000ec60201b60201c565b60ff16600a620000ca919062000896565b620f4240620000da9190620008e7565b620000f560201b60201c565b62000a3a565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200016a5760006040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000161919062000977565b60405180910390fd5b6200017e600083836200018260201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603620001d8578060026000828254620001cb919062000994565b92505081905550620002ae565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101562000267578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016200025e93929190620009e0565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620002f9578060026000828254039250508190555062000346565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620003a5919062000a1d565b60405180910390a3505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043457607f821691505b6020821081036200044a5762000449620003ec565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620004b47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000475565b620004c0868362000475565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200050d620005076200050184620004d8565b620004e2565b620004d8565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b84845462000482565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000450565b620005b18462000465565b81016020851015620005c1578190505b620005d9620005d08562000465565b8301826200056a565b50505b505050565b600082821c905092915050565b60006200060160001984600802620005e1565b1980831691505092915050565b60006200061c8383620005ee565b9150826002028217905092915050565b6200063782620003b2565b67ffffffffffffffff811115620006535762000652620003bd565b5b6200065f82546200041b565b6200066c82828562000591565b600060209050601f831160018114620006a457600084156200068f578287015190505b6200069b85826200060e565b8655506200070b565b601f198416620006b48662000450565b60005b82811015620006de57848901518255600182019150602085019450602081019050620006b7565b86831015620006fe5784890151620006fa601f891682620005ee565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620007a15780860481111562000779576200077862000713565b5b6001851615620007895780820291505b8081029050620007998562000742565b945062000759565b94509492505050565b600082620007bc57600190506200088f565b81620007cc57600090506200088f565b8160018114620007e55760028114620007f05762000826565b60019150506200088f565b60ff84111562000805576200080462000713565b5b8360020a9150848211156200081f576200081e62000713565b5b506200088f565b5060208310610133831016604e8410600b8410161715620008605782820a9050838111156200085a576200085962000713565b5b6200088f565b6200086f84848460016200074f565b9250905081840481111562000889576200088862000713565b5b81810290505b9392505050565b6000620008a382620004d8565b9150620008b083620004d8565b9250620008df7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620007aa565b905092915050565b6000620008f482620004d8565b91506200090183620004d8565b92508282026200091181620004d8565b915082820484148315176200092b576200092a62000713565b5b5092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200095f8262000932565b9050919050565b620009718162000952565b82525050565b60006020820190506200098e600083018462000966565b92915050565b6000620009a182620004d8565b9150620009ae83620004d8565b9250828201905080821115620009c957620009c862000713565b5b92915050565b620009da81620004d8565b82525050565b6000606082019050620009f7600083018662000966565b62000a066020830185620009cf565b62000a156040830184620009cf565b949350505050565b600060208201905062000a346000830184620009cf565b92915050565b610e558062000a4a6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610aa9565b60405180910390f35b6100d060048036038101906100cb9190610b64565b610292565b6040516100dd9190610bbf565b60405180910390f35b6100ee6102b5565b6040516100fb9190610be9565b60405180910390f35b61011e60048036038101906101199190610c04565b6102bf565b60405161012b9190610bbf565b60405180910390f35b61013c6102ee565b6040516101499190610c73565b60405180910390f35b61016c60048036038101906101679190610c8e565b6102f7565b6040516101799190610be9565b60405180910390f35b61018a61033f565b6040516101979190610aa9565b60405180910390f35b6101ba60048036038101906101b59190610b64565b6103d1565b6040516101c79190610bbf565b60405180910390f35b6101ea60048036038101906101e59190610cbb565b6103f4565b6040516101f79190610be9565b60405180910390f35b60606003805461020f90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461023b90610d2a565b80156102885780601f1061025d57610100808354040283529160200191610288565b820191906000526020600020905b81548152906001019060200180831161026b57829003601f168201915b5050505050905090565b60008061029d61047b565b90506102aa818585610483565b600191505092915050565b6000600254905090565b6000806102ca61047b565b90506102d7858285610495565b6102e2858585610529565b60019150509392505050565b60006012905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461034e90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610d2a565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050505050905090565b6000806103dc61047b565b90506103e9818585610529565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b610490838383600161061d565b505050565b60006104a184846103f4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146105235781811015610513578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161050a93929190610d6a565b60405180910390fd5b6105228484848403600061061d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361059b5760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105929190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361060d5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016106049190610da1565b60405180910390fd5b6106188383836107f4565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361068f5760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016106869190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036107015760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016106f89190610da1565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080156107ee578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516107e59190610be9565b60405180910390a35b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084657806002600082825461083a9190610deb565b92505081905550610919565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156108d2578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016108c993929190610d6a565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361096257806002600082825403925050819055506109af565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a0c9190610be9565b60405180910390a3505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610a53578082015181840152602081019050610a38565b60008484015250505050565b6000601f19601f8301169050919050565b6000610a7b82610a19565b610a858185610a24565b9350610a95818560208601610a35565b610a9e81610a5f565b840191505092915050565b60006020820190508181036000830152610ac38184610a70565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610afb82610ad0565b9050919050565b610b0b81610af0565b8114610b1657600080fd5b50565b600081359050610b2881610b02565b92915050565b6000819050919050565b610b4181610b2e565b8114610b4c57600080fd5b50565b600081359050610b5e81610b38565b92915050565b60008060408385031215610b7b57610b7a610acb565b5b6000610b8985828601610b19565b9250506020610b9a85828601610b4f565b9150509250929050565b60008115159050919050565b610bb981610ba4565b82525050565b6000602082019050610bd46000830184610bb0565b92915050565b610be381610b2e565b82525050565b6000602082019050610bfe6000830184610bda565b92915050565b600080600060608486031215610c1d57610c1c610acb565b5b6000610c2b86828701610b19565b9350506020610c3c86828701610b19565b9250506040610c4d86828701610b4f565b9150509250925092565b600060ff82169050919050565b610c6d81610c57565b82525050565b6000602082019050610c886000830184610c64565b92915050565b600060208284031215610ca457610ca3610acb565b5b6000610cb284828501610b19565b91505092915050565b60008060408385031215610cd257610cd1610acb565b5b6000610ce085828601610b19565b9250506020610cf185828601610b19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610d4257607f821691505b602082108103610d5557610d54610cfb565b5b50919050565b610d6481610af0565b82525050565b6000606082019050610d7f6000830186610d5b565b610d8c6020830185610bda565b610d996040830184610bda565b949350505050565b6000602082019050610db66000830184610d5b565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df682610b2e565b9150610e0183610b2e565b9250828201905080821115610e1957610e18610dbc565b5b9291505056fea2646970667358221220912f5265edaea44910db734f0d00fccd257c78dba79c126931551eaad1a334f764736f6c63430008170033'; - -// Defining the deployer account, which has VTHO for deployment costs -const deployerAccount: ProviderInternalWalletAccount = { - privateKey: HexUInt.of( - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff' - ).bytes, - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' -}; - -// Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount]) -); -const signer = (await provider.getSigner( - deployerAccount.address -)) as VeChainSigner; - -// Defining a function for deploying the ERC20 contract -const setupERC20Contract = async (): Promise> => { - const contractFactory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - // Deploying the contract - await contractFactory.startDeployment(); - - // Waiting for the contract to be deployed - return await contractFactory.waitForDeployment(); -}; - -// Setting up the ERC20 contract and getting its address -const contract = await setupERC20Contract(); - -// START_SNIPPET: ERC20FunctionCallSnippet - -const transferResult = await contract.transact.transfer( - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - 10000n -); - -// Wait for the transfer transaction to complete and obtain its receipt -const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - -// Asserting that the transaction has not been reverted -expect(transactionReceiptTransfer.reverted).toEqual(false); - -// END_SNIPPET: ERC20FunctionCallSnippet - -// START_SNIPPET: TransferCommentSnippet - -// Transfer tokens to another address with a comment - -await contract.transact.transfer( - { comment: 'Transferring 100 ERC20 tokens' }, - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - Units.parseEther('100').bi -); - -// END_SNIPPET: TransferCommentSnippet diff --git a/docs/examples/contracts/contract-usage.ts b/docs/examples/contracts/contract-usage.ts deleted file mode 100644 index f9062dc94..000000000 --- a/docs/examples/contracts/contract-usage.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { - ProviderInternalBaseWallet, - type ProviderInternalWalletAccount, - THOR_SOLO_URL, - ThorClient, - VeChainProvider -} from '@vechain/sdk-network'; -import { expect } from 'expect'; -import { HexUInt } from '@vechain/sdk-core'; - -// START_SNIPPET: ContractUsageSnippet - -// 1 - Create thor client for solo network - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2 - Prepare signer and provider - -// Defining the deployer account, which has VTHO for deployment costs -const deployerAccount: ProviderInternalWalletAccount = { - privateKey: HexUInt.of( - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff' - ).bytes, - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' -}; - -// Define the provider -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount]) -); - -// Define signer -const signer = await provider.getSigner(deployerAccount.address); - -// Provide contract bytecode and ABI -const contractBytecode: string = - '0x60806040526000805534801561001457600080fd5b50610267806100246000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635b34b966146100465780638ada066e146100505780638bb5d9c31461006e575b600080fd5b61004e61008a565b005b6100586100dc565b6040516100659190610141565b60405180910390f35b6100886004803603810190610083919061018d565b6100e5565b005b60008081548092919061009c906101e9565b91905055507f3cf8b50771c17d723f2cb711ca7dadde485b222e13c84ba0730a14093fad6d5c6000546040516100d29190610141565b60405180910390a1565b60008054905090565b806000819055507f3cf8b50771c17d723f2cb711ca7dadde485b222e13c84ba0730a14093fad6d5c60005460405161011d9190610141565b60405180910390a150565b6000819050919050565b61013b81610128565b82525050565b60006020820190506101566000830184610132565b92915050565b600080fd5b61016a81610128565b811461017557600080fd5b50565b60008135905061018781610161565b92915050565b6000602082840312156101a3576101a261015c565b5b60006101b184828501610178565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006101f482610128565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610226576102256101ba565b5b60018201905091905056fea26469706673582212203717543ef8d5efefe479edccd3cf790230d0362107b487d53629ecbf94b9078f64736f6c63430008180033'; - -const contractAbi = [ - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newValue', - type: 'uint256' - } - ], - name: 'CounterIncremented', - type: 'event' - }, - { - inputs: [], - name: 'getCounter', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'incrementCounter', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256' - } - ], - name: 'setCounter', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -// 3 - Deploy contract - -// Create the contract factory -let contractFactory = thorSoloClient.contracts.createContractFactory( - contractAbi, - contractBytecode, - signer -); - -// Start contract deployment -contractFactory = await contractFactory.startDeployment(); - -// Wait until contract is deployed -const contract = await contractFactory.waitForDeployment(); - -// 4 - Interact with contract - -// read initial value -const initialValue = await contract.read.getCounter(); -console.log(initialValue); - -// increment the counter -const incrementCounter = await contract.transact.incrementCounter(); - -// wait for the transaction receipt (until it is not null) -for (let i = 0; i < 20; i++) { - const result = await thorSoloClient.transactions.getTransactionReceipt( - incrementCounter.id - ); - - if (result !== null) { - break; - } - - await new Promise((resolve) => setTimeout(resolve, 1000)); -} - -// check if the value was set -const updatedValue = await contract.read.getCounter(); -console.log(updatedValue); - -// END_SNIPPET: ContractUsageSnippet - -expect(initialValue).toEqual([BigInt(0)]); -expect(updatedValue).toEqual([BigInt(1)]); diff --git a/docs/examples/cryptography/blake2b256.ts b/docs/examples/cryptography/blake2b256.ts deleted file mode 100644 index 8d648fad8..000000000 --- a/docs/examples/cryptography/blake2b256.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Blake2b256, Hex, Txt } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: Blake2b256Snippet - -// Input of hash function must be an expression representable as an array of bytes. -// The class Txt assures a consistent byte encoding for textual strings. -const toHash = Txt.of('hello world'); - -const hash = Blake2b256.of(toHash.bytes); - -// END_SNIPPET: Blake2b256Snippet - -expect( - hash.isEqual( - Hex.of( - '0x256c83b297114d201b30179f3f0ef0cace9783622da5974326b436178aeef610' - ) - ) -).toBeTruthy(); diff --git a/docs/examples/cryptography/keccak256.ts b/docs/examples/cryptography/keccak256.ts deleted file mode 100644 index e3f30bc6f..000000000 --- a/docs/examples/cryptography/keccak256.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Hex, Keccak256, Txt } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: Keccak256Snippet - -// Input of hash function must be an expression representable as an array of bytes. -// The class Txt assures a consistent byte encoding for textual strings. -const toHash = Txt.of('hello world'); - -// -const hash = Keccak256.of(toHash.bytes); - -// END_SNIPPET: Keccak256Snippet - -expect( - hash.isEqual( - Hex.of( - '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad' - ) - ) -).toBe(true); diff --git a/docs/examples/cryptography/secp256k1.ts b/docs/examples/cryptography/secp256k1.ts deleted file mode 100644 index bfca9d93b..000000000 --- a/docs/examples/cryptography/secp256k1.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Address, Hex, Keccak256, Txt, Secp256k1 } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: Secp256k1Snippet - -// 1 - Generate a private key. - -const privateKey = await Secp256k1.generatePrivateKey(); -console.log('Private key:', Hex.of(privateKey).toString()); -// Private key: ...SOME_PRIVATE_KEY... - -// 2 - Derive the public key and address from private key. -// By default, the key is returned in compressed form. - -const publicKey = Secp256k1.derivePublicKey(privateKey); -const userAddress = Address.ofPublicKey(publicKey).toString(); -console.log('User address:', userAddress); -// User address: 0x...SOME_ADDRESS... - -// 3 - Sign message - -const messageToSign = Txt.of('hello world'); -const hash = Keccak256.of(messageToSign.bytes); -console.log(`Hash: ${hash.toString()}`); - -const signature = Secp256k1.sign(hash.bytes, privateKey); -console.log('Signature:', Hex.of(signature).toString()); -// Signature: ...SOME_SIGNATURE... - -// END_SNIPPET: Secp256k1Snippet - -// 4 - Test recovery of public key. -// By default, the recovered key is returned in compressed form. -// The methods `Secp256k1.inflatePublicKey` and `Secp256k1.compressPublicKey` -// convert public keys among compressed and uncompressed form. - -const recoveredPublicKey = Secp256k1.recover(hash.bytes, signature); -expect(publicKey).toStrictEqual( - Secp256k1.compressPublicKey(recoveredPublicKey) -); -expect(Secp256k1.inflatePublicKey(publicKey)).toStrictEqual(recoveredPublicKey); -// Recovered public key is correct: true diff --git a/docs/examples/debug/debug-retrieve-storage-range.ts b/docs/examples/debug/debug-retrieve-storage-range.ts deleted file mode 100644 index 46e954b86..000000000 --- a/docs/examples/debug/debug-retrieve-storage-range.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { Address, BlockId } from '@vechain/sdk-core'; - -// START_SNIPPET: DebugRetrieveStorageRangeSnippet - -// 1 - Create thor client for testnet -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Retrieve the storage range. -const result = await thorClient.debug.retrieveStorageRange({ - target: { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 0, - clauseIndex: 0 - }, - options: { - address: Address.of('0x0000000000000000000000000000456E65726779'), - keyStart: BlockId.of( - '0x0000000000000000000000000000000000000000000000000000000000000000' - ), - maxResult: 10 - } -}); - -// 3 - Print the result. -console.log(result); - -// END_SNIPPET: DebugRetrieveStorageRangeSnippet diff --git a/docs/examples/debug/debug-trace-contract-call.ts b/docs/examples/debug/debug-trace-contract-call.ts deleted file mode 100644 index d9c4cff5d..000000000 --- a/docs/examples/debug/debug-trace-contract-call.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { Address, HexUInt, VET } from '@vechain/sdk-core'; - -// START_SNIPPET: DebugTraceContractCallSnippet - -// 1 - Create thor client for testnet -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Trace the contract call. -const result = await thorClient.debug.traceContractCall( - { - target: { - to: Address.of('0x0000000000000000000000000000456E65726779'), - data: HexUInt.of( - '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000' - ), - value: VET.of(0) - }, - options: { - caller: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - gasPayer: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - expiration: 18, - blockRef: '0x0101d05409d55cce' - }, - config: {} - }, - // Note that in the testnet only the 'call' option is available. - 'call' -); - -// 3 - Print the result. -console.log(result); - -// END_SNIPPET: DebugTraceContractCallSnippet diff --git a/docs/examples/debug/debug-trace-transaction-clause.ts b/docs/examples/debug/debug-trace-transaction-clause.ts deleted file mode 100644 index d40b655e0..000000000 --- a/docs/examples/debug/debug-trace-transaction-clause.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { TESTNET_URL, ThorClient, type TracerName } from '@vechain/sdk-network'; -import { BlockId } from '@vechain/sdk-core'; - -// START_SNIPPET: DebugTraceTransactionClauseSnippet - -// 1 - Create thor client for testnet -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Trace the clause. -const result = await thorClient.debug.traceTransactionClause( - { - target: { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: BlockId.of( - '0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f' - ), - clauseIndex: 0 - }, - config: {} - }, - 'call' as TracerName -); - -// 3 - Print the result. -console.log(result); - -// END_SNIPPET: DebugTraceTransactionClauseSnippet diff --git a/docs/examples/encoding/abi.ts b/docs/examples/encoding/abi.ts deleted file mode 100644 index 4a7425809..000000000 --- a/docs/examples/encoding/abi.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ABIFunction } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: AbiSnippet - -// 1 - Create a simple function to encode into ABI - -const simpleAbiFunction = new ABIFunction({ - constant: false, - inputs: [ - { - name: 'a1', - type: 'uint256' - }, - { - name: 'a2', - type: 'string' - } - ], - name: 'f1', - outputs: [ - { - name: 'r1', - type: 'address' - }, - { - name: 'r2', - type: 'bytes' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' -}); - -// 2 - Encode function - -const encodedFunction = simpleAbiFunction.encodeData([1, 'foo']).toString(); - -// END_SNIPPET: AbiSnippet - -// 3 - Check encoding - -const expected = - '0x27fcbb2f0000000000000000000000000000000000000000000000000000\ -00000000000100000000000000000000000000000000000000000000000000\ -00000000000040000000000000000000000000000000000000000000000000\ -0000000000000003666f6f0000000000000000000000000000000000000000\ -000000000000000000'; -expect(encodedFunction).toBe(expected); diff --git a/docs/examples/encoding/contract.ts b/docs/examples/encoding/contract.ts deleted file mode 100644 index 1d8989de1..000000000 --- a/docs/examples/encoding/contract.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { ABIContract } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: ContractSnippet - -// 1 - Create a new function - -const contractABI = [ - { - constant: false, - inputs: [ - { - name: 'value', - type: 'uint256' - } - ], - name: 'setValue', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'getValue', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - } -] as const; - -// 2 - Encode the function input, ready to be used to send a tx -const encodedData = ABIContract.ofAbi(contractABI).encodeFunctionInput( - 'setValue', - [123] -); - -// 3 - Decode the function input data -const decodedData = String( - ABIContract.ofAbi(contractABI).decodeFunctionInput('setValue', encodedData) - .args[0] -); // decode the function input data - -// END_SNIPPET: ContractSnippet - -// Check the decoded data -expect(decodedData).toEqual('123'); diff --git a/docs/examples/encoding/rlp.ts b/docs/examples/encoding/rlp.ts deleted file mode 100644 index 48c02457b..000000000 --- a/docs/examples/encoding/rlp.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - Hex, - HexBlobKind, - NumericKind, - OptionalFixedHexBlobKind, - RLPProfiler -} from '@vechain/sdk-core'; -import { stringifyData } from '@vechain/sdk-errors'; -import { expect } from 'expect'; - -// START_SNIPPET: RlpSnippet - -// 1 - Define the profile for tx clause structure - -const profile = { - name: 'clause', - kind: [ - { name: 'to', kind: new OptionalFixedHexBlobKind(20) }, - { name: 'value', kind: new NumericKind(32) }, - { name: 'data', kind: new HexBlobKind() } - ] -}; - -// 2 - Create clauses - -const clause = { - to: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - value: 10, - data: '0x' -}; - -// 3 - RLPProfiler Instance to encode and decode - -// Encoding and Decoding -const data = RLPProfiler.ofObject(clause, profile).encoded; -const obj = RLPProfiler.ofObjectEncoded(data, profile).object; - -// END_SNIPPET: RlpSnippet - -expect(Hex.of(data).toString()).toBe( - '0xd7947567d83b7b8d80addcb281a71d54fc7b3364ffed0a80' -); -expect(stringifyData(obj)).toBe(stringifyData(clause)); diff --git a/docs/examples/evm-extension/evm-extension.ts b/docs/examples/evm-extension/evm-extension.ts deleted file mode 100644 index f1e4f43b8..000000000 --- a/docs/examples/evm-extension/evm-extension.ts +++ /dev/null @@ -1,800 +0,0 @@ -import { ABIContract } from '@vechain/sdk-core'; -import { THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// ABI of the `TestingContract` smart contract -const TESTING_CONTRACT_ABI = [ - { - inputs: [ - { - internalType: 'string', - name: 'message', - type: 'string' - } - ], - name: 'CustomError', - type: 'error' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'newValue', - type: 'uint256' - }, - { - indexed: true, - internalType: 'uint256', - name: 'oldValue', - type: 'uint256' - }, - { - indexed: true, - internalType: 'address', - name: 'sender', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'timestamp', - type: 'uint256' - } - ], - name: 'StateChanged', - type: 'event' - }, - { - inputs: [ - { - internalType: 'address', - name: '_addressData', - type: 'address' - } - ], - name: 'addressData', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - name: 'balances', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bool', - name: '_boolData', - type: 'bool' - } - ], - name: 'boolData', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: '_byteData', - type: 'bytes32' - } - ], - name: 'bytes32Data', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes', - name: '_data', - type: 'bytes' - } - ], - name: 'calculateBlake2b256', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_amount', - type: 'uint256' - } - ], - name: 'deposit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256[]', - name: '_dynamicArrayData', - type: 'uint256[]' - } - ], - name: 'dynamicArrayData', - outputs: [ - { - internalType: 'uint256[]', - name: '', - type: 'uint256[]' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'enum TestingContract.ExampleEnum', - name: '_enumData', - type: 'uint8' - } - ], - name: 'enumData', - outputs: [ - { - internalType: 'enum TestingContract.ExampleEnum', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256[3]', - name: '_fixedArrayData', - type: 'uint256[3]' - } - ], - name: 'fixedArrayData', - outputs: [ - { - internalType: 'uint256[3]', - name: '', - type: 'uint256[3]' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - } - ], - name: 'getBalance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockID', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockSigner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockTime', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockTotalScore', - outputs: [ - { - internalType: 'uint64', - name: '', - type: 'uint64' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTotalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxBlockRef', - outputs: [ - { - internalType: 'bytes8', - name: '', - type: 'bytes8' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxExpiration', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxID', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxProvedWork', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'int256', - name: '_intData', - type: 'int256' - } - ], - name: 'intData', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_uintData', - type: 'uint256' - }, - { - internalType: 'address', - name: '_addressData', - type: 'address' - }, - { - internalType: 'bytes32', - name: '_byteData', - type: 'bytes32' - }, - { - internalType: 'string', - name: '_stringData', - type: 'string' - }, - { - internalType: 'uint256[3]', - name: '_fixedArrayData', - type: 'uint256[3]' - }, - { - internalType: 'uint256[]', - name: '_dynamicArrayData', - type: 'uint256[]' - }, - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '_structData', - type: 'tuple' - }, - { - internalType: 'enum TestingContract.ExampleEnum', - name: '_enumData', - type: 'uint8' - } - ], - name: 'multipleData', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - }, - { - internalType: 'address', - name: '', - type: 'address' - }, - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - }, - { - internalType: 'string', - name: '', - type: 'string' - }, - { - internalType: 'uint256[3]', - name: '', - type: 'uint256[3]' - }, - { - internalType: 'uint256[]', - name: '', - type: 'uint256[]' - }, - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '', - type: 'tuple' - }, - { - internalType: 'enum TestingContract.ExampleEnum', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint8', - name: '_uint8Data', - type: 'uint8' - }, - { - internalType: 'uint16', - name: '_uint16Data', - type: 'uint16' - }, - { - internalType: 'uint32', - name: '_uint32Data', - type: 'uint32' - }, - { - internalType: 'uint64', - name: '_uint64Data', - type: 'uint64' - }, - { - internalType: 'uint160', - name: '_uint160Data', - type: 'uint160' - }, - { - internalType: 'uint256', - name: '_uint256Data', - type: 'uint256' - } - ], - name: 'multipleIntData', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8' - }, - { - internalType: 'uint16', - name: '', - type: 'uint16' - }, - { - internalType: 'uint32', - name: '', - type: 'uint32' - }, - { - internalType: 'uint64', - name: '', - type: 'uint64' - }, - { - internalType: 'uint160', - name: '', - type: 'uint160' - }, - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_newValue', - type: 'uint256' - } - ], - name: 'setStateVariable', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'stateVariable', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'string', - name: '_stringData', - type: 'string' - } - ], - name: 'stringData', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '_structData', - type: 'tuple' - } - ], - name: 'structData', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '', - type: 'tuple' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testAssertError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testCustomError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [], - name: 'testInvalidOpcodeError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint8', - name: '_value', - type: 'uint8' - } - ], - name: 'testOverflowError', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testRequireError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testRevertError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_uintData', - type: 'uint256' - } - ], - name: 'uintData', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_amount', - type: 'uint256' - } - ], - name: 'withdraw', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -// Address of the `TestingContract` smart contract -const TESTING_CONTRACT_ADDRESS: string = - '0xb2c20a6de401003a671659b10629eb82ff254fb8'; - -// START_SNIPPET: EVMExtensionSnippet - -// Create an instance of the ThorClient class -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// Call the getTotalSupply function of the `TestingContract` smart contract -const totalSupply = await thorSoloClient.contracts.executeCall( - TESTING_CONTRACT_ADDRESS, - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction('getTotalSupply'), - [] -); - -// END_SNIPPET: EVMExtensionSnippet - -// Check the result -expect(totalSupply).toStrictEqual({ - result: { - array: [10000000000000000000000000000n], - plain: 10000000000000000000000000000n - }, - success: true -}); diff --git a/docs/examples/polls/event-poll-dapp.ts b/docs/examples/polls/event-poll-dapp.ts deleted file mode 100644 index 9adbeb477..000000000 --- a/docs/examples/polls/event-poll-dapp.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Poll, TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; -import { Address } from '@vechain/sdk-core'; - -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Init accounts - -const accounts = [ - '0x2669514f9fe96bc7301177ba774d3da8a06cace4', - '0x9e7911de289c3c856ce7f421034f66b6cde49c39' -]; - -// 3 - Monitor status for each account - -for (const account of accounts) { - const monitoringPoll = Poll.createEventPoll( - async () => await thorClient.accounts.getAccount(Address.of(account)), - 1000 - ) - // Add listeners for start event - .onStart((eventPoll) => { - console.log(`Start monitoring account ${account}`, eventPoll); - }) - - // Add listeners for stop event - .onStop((eventPoll) => { - console.log(`Stop monitoring account ${account}`, eventPoll); - }) - - // Add listeners for data event. It intercepts the account details every 1 second - .onData((accountDetails, eventPoll) => { - console.log(`Account details of ${account}:`, accountDetails); - - // Stop after 3 iterations - EXIT CONDITION - if (eventPoll.getCurrentIteration === 3) eventPoll.stopListen(); - }) - - // Add listeners for error event - .onError((error) => { - console.log('Error:', error); - }); - - monitoringPoll.startListen(); - - // It seems to be strange, BUT onData is called only after 1 second of the eventPoll.startListen() call. - expect(monitoringPoll.getCurrentIteration).toBe(0); -} diff --git a/docs/examples/polls/sync-poll-wait-balance-update.ts b/docs/examples/polls/sync-poll-wait-balance-update.ts deleted file mode 100644 index 7689d996d..000000000 --- a/docs/examples/polls/sync-poll-wait-balance-update.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { Poll, THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { Address, HexUInt, Transaction } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// 1 - Create thor client for solo network - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2- Init transaction - -// 2.1 - Get latest block -const latestBlock = await thorSoloClient.blocks.getBestBlockCompressed(); - -// 2.2 - Transaction sender and receiver -const sender = { - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4', - privateKey: HexUInt.of( - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - ).bytes -}; - -const receiver = { - address: '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - privateKey: HexUInt.of( - '1758771c54938e977518e4ff1c297aca882f6598891df503030734532efa790e' - ).bytes -}; - -// 2.2 - Create transaction clauses -const clauses = [ - { - to: receiver.address, - value: 1000000, - data: '0x' - } -]; - -// 2.3 - Calculate gas -const gasResult = await thorSoloClient.gas.estimateGas(clauses, sender.address); - -// 2.4 - Create transactions -const transactionBody = { - // Solo network chain tag - chainTag: 0xf6, - // Solo network block ref - blockRef: latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678 -}; - -// 2.5 - Sign and get raw transaction -const encoded = Transaction.of(transactionBody).sign(sender.privateKey).encoded; -const raw = HexUInt.of(encoded).toString(); - -// 3 - Get the sender and receiver balance before the transaction - -const senderBalanceBefore = ( - await thorSoloClient.accounts.getAccount(Address.of(sender.address)) -).balance; - -const receiverBalanceBefore = ( - await thorSoloClient.accounts.getAccount(Address.of(receiver.address)) -).balance; - -console.log('Sender balance before:', senderBalanceBefore); -console.log('Receiver balance before:', receiverBalanceBefore); - -// 4 - Send transaction - -const sentTransaction = - await thorSoloClient.transactions.sendRawTransaction(raw); - -// 4.1 - Check if the transaction is sent successfully (check if the transaction id is a valid hex string) -expect(sentTransaction).toBeDefined(); -expect(sentTransaction).toHaveProperty('id'); -expect(HexUInt.isValid0x(sentTransaction.id)).toBe(true); - -// 4 -Wait until balance is updated - -// New balance of sender (wait until the balance is updated) -const newBalanceSender = await Poll.SyncPoll( - async () => - (await thorSoloClient.accounts.getAccount(Address.of(sender.address))) - .balance -).waitUntil((newBalance) => { - return newBalance !== senderBalanceBefore; -}); - -// New balance of receiver (wait until the balance is updated) -const newBalanceReceiver = await Poll.SyncPoll( - async () => - (await thorSoloClient.accounts.getAccount(Address.of(receiver.address))) - .balance -).waitUntil((newBalance) => { - return newBalance !== receiverBalanceBefore; -}); - -expect(newBalanceSender).toBeDefined(); -expect(newBalanceReceiver).toBeDefined(); - -expect(newBalanceSender).not.toBe(senderBalanceBefore); -expect(newBalanceReceiver).not.toBe(receiverBalanceBefore); - -console.log('New balance of sender:', newBalanceSender); -console.log('New balance of receiver:', newBalanceReceiver); diff --git a/docs/examples/polls/sync-poll-wait-new-block.ts b/docs/examples/polls/sync-poll-wait-new-block.ts deleted file mode 100644 index f0e202391..000000000 --- a/docs/examples/polls/sync-poll-wait-new-block.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Poll, TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Get current block - -const currentBlock = await thorClient.blocks.getBestBlockCompressed(); - -console.log('Current block:', currentBlock); - -// 3 - Wait until a new block is created - -// Wait until a new block is created with polling interval of 3 seconds -const newBlock = await Poll.SyncPoll( - // Get the latest block as polling target function - async () => await thorClient.blocks.getBlockCompressed('best'), - // Polling interval is 3 seconds - { requestIntervalInMilliseconds: 3000 } -).waitUntil((newBlockData) => { - // Stop polling when the new block number is greater than the current block number - return (newBlockData?.number as number) > (currentBlock?.number as number); -}); - -expect(newBlock).toBeDefined(); -expect(newBlock?.number).toBeGreaterThan(currentBlock?.number as number); - -console.log('New block:', newBlock); diff --git a/docs/examples/provider/vechain-hardhat-provider.ts b/docs/examples/provider/vechain-hardhat-provider.ts deleted file mode 100644 index cde5e1a81..000000000 --- a/docs/examples/provider/vechain-hardhat-provider.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { - HardhatVeChainProvider, - ProviderInternalBaseWallet, - TESTNET_URL -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: VechainHardhatProviderSnippet - -// 1 - Init provider -const provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - TESTNET_URL, - (message: string, parent?: Error) => new Error(message, parent) -); - -// 2 - Call RPC function -const rpcCallChainId = await provider.request({ - method: 'eth_chainId' -}); - -// END_SNIPPET: VechainHardhatProviderSnippet - -expect(rpcCallChainId).toBe('0x186aa'); diff --git a/docs/examples/provider/vechain-provider.ts b/docs/examples/provider/vechain-provider.ts deleted file mode 100644 index 68652f17f..000000000 --- a/docs/examples/provider/vechain-provider.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { TESTNET_URL, ThorClient, VeChainProvider } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: VeChainProviderSnippet - -// 1 - Create thor client for testnet -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Init provider -const provider = new VeChainProvider(thorClient); - -// 3 - Call RPC function -const rpcCallChainId = await provider.request({ - method: 'eth_chainId' -}); - -// END_SNIPPET: VeChainProviderSnippet - -expect(rpcCallChainId).toBe('0x186aa'); diff --git a/docs/examples/subscriptions/block-subscriptions.ts b/docs/examples/subscriptions/block-subscriptions.ts deleted file mode 100644 index 3047ab032..000000000 --- a/docs/examples/subscriptions/block-subscriptions.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { subscriptions, TESTNET_URL } from '@vechain/sdk-network'; -import WebSocket from 'isomorphic-ws'; - -// The URL for subscribing to the block -const wsURL = subscriptions.getBlockSubscriptionUrl(TESTNET_URL); - -// Any websocket library can be used to connect to the websocket -const ws = new WebSocket(wsURL); - -// Simple websocket event handlers - -// Error handling -ws.on('error', console.error); - -// Connection opened -ws.on('open', () => { - console.log('connected'); -}); - -// Connection closed -ws.on('close', () => { - console.log('disconnected'); -}); - -// Message received -ws.on('message', (data: unknown) => { - console.log('received: %s', data); -}); - -// Close the connection to the websocket -ws.close(); diff --git a/docs/examples/subscriptions/event-subscriptions.ts b/docs/examples/subscriptions/event-subscriptions.ts deleted file mode 100644 index bc2420922..000000000 --- a/docs/examples/subscriptions/event-subscriptions.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { subscriptions, TESTNET_URL } from '@vechain/sdk-network'; -import WebSocket from 'isomorphic-ws'; - -/** - * The event to subscribe to. - * The event can be defined as an object or as a string. - * - * @see [Event format type examples](https://github.com/vechain/vechain-sdk/blob/9720551d165b706662c13fac657f55e5a506ea4d/packages/core/tests/abi/fixture.ts#L126) - */ -const swapEvent = - 'event Swap(address indexed sender,uint amount0In,uint amount1In,uint amount0Out,uint amount1Out,address indexed to)'; - -// The address of the sender to filter events by -const senderSampleAddress = '0x9e7911de289c3c856ce7f421034f66b6cde49c39'; - -// The address of the recipient to filter events by -const toSampleAddress = '0xfe7911df289c3c856ce7f421034f66b6cd249c39'; - -const wsURL = subscriptions.getEventSubscriptionUrl( - TESTNET_URL, - swapEvent, - /** - * The values of the indexed parameters to construct the topic filters. - * - * @note The order of the values must match the order of the indexed parameters in the event. - * @note You can omit the first indexed parameter with `null` and only specify the second indexed parameter if you only want to filter by the second indexed parameter. - */ - [senderSampleAddress, toSampleAddress], - { - address: '0x6c0A6e1d922E0e63901301573370b932AE20DAdB' // Vexchange contract address - } -); - -// Any websocket library can be used to connect to the websocket -const ws = new WebSocket(wsURL); - -// Simple websocket event handlers - -// Error handling -ws.on('error', console.error); - -// Connection opened -ws.on('open', () => { - console.log('connected'); -}); - -// Connection closed -ws.on('close', () => { - console.log('disconnected'); -}); - -// Message received -ws.on('message', (data: unknown) => { - console.log('received: %s', data); -}); - -// Close the connection to the websocket -ws.close(); diff --git a/docs/examples/thor-client/accounts.ts b/docs/examples/thor-client/accounts.ts deleted file mode 100644 index df6f9d7a0..000000000 --- a/docs/examples/thor-client/accounts.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; -import { Address, ThorId } from '@vechain/sdk-core'; - -// START_SNIPPET: AccountsSnippet - -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Get account details - -const accountAddress = Address.of('0x5034aa590125b64023a0262112b98d72e3c8e40e'); - -// Account details -const accountDetails = await thorClient.accounts.getAccount(accountAddress); - -// Account code -const accountCode = await thorClient.accounts.getBytecode(accountAddress); - -// Get account storage -const position = ThorId.of(1); -const accountStorage = await thorClient.accounts.getStorageAt( - accountAddress, - position -); - -// END_SNIPPET: AccountsSnippet - -expect(accountDetails).toBeDefined(); -expect(`${accountCode}`).toEqual('0x'); -expect(`${accountStorage}`).toEqual( - '0x0000000000000000000000000000000000000000000000000000000000000000' -); diff --git a/docs/examples/thor-client/blocks.ts b/docs/examples/thor-client/blocks.ts deleted file mode 100644 index 5a246def9..000000000 --- a/docs/examples/thor-client/blocks.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: BlocksSnippet - -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Get block details - -// Details of block -const blockDetails = await thorClient.blocks.getBlockCompressed(1); - -// 3 - Get best block details - -const bestBlockDetails = await thorClient.blocks.getBestBlockExpanded(); -expect(bestBlockDetails).toBeDefined(); - -// 4 - Get finalizes block details - -const finalBlockDetails = await thorClient.blocks.getFinalBlockExpanded(); - -// END_SNIPPET: BlocksSnippet - -expect(blockDetails).toEqual({ - number: 1, - id: '0x000000019015bbd98fc1c9088d793ba9add53896a29cd9aa3a4dcabd1f561c38', - size: 236, - parentID: - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - timestamp: 1530014410, - gasLimit: 10000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 1, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x25ae0ef84da4a76d5a1dfe80d3789c2c46fee30a', - isTrunk: true, - isFinalized: true, - transactions: [] -}); -expect(bestBlockDetails).toBeDefined(); -expect(finalBlockDetails).toBeDefined(); diff --git a/docs/examples/thor-client/contract.ts b/docs/examples/thor-client/contract.ts deleted file mode 100644 index 0a641c82a..000000000 --- a/docs/examples/thor-client/contract.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { - ProviderInternalBaseWallet, - type ProviderInternalWalletAccount, - THOR_SOLO_URL, - ThorClient, - VeChainProvider, - type VeChainSigner -} from '@vechain/sdk-network'; -import { expect } from 'expect'; -import { HexUInt, type DeployParams } from '@vechain/sdk-core'; - -// START_SNIPPET: ContractSnippet - -// 1 - Create thor client for solo network - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2 - Deploy contract - -// Defining the deployer account, which has VTHO for deployment costs -const deployerAccount: ProviderInternalWalletAccount = { - privateKey: HexUInt.of( - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff' - ).bytes, - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' -}; - -// Define the provider and the signer -const provider = new VeChainProvider( - thorSoloClient, - new ProviderInternalBaseWallet([deployerAccount]) -); -const signer = (await provider.getSigner( - deployerAccount.address -)) as VeChainSigner; - -const contractBytecode: string = - '0x608060405234801561001057600080fd5b506040516102063803806102068339818101604052810190610032919061007a565b80600081905550506100a7565b600080fd5b6000819050919050565b61005781610044565b811461006257600080fd5b50565b6000815190506100748161004e565b92915050565b6000602082840312156100905761008f61003f565b5b600061009e84828501610065565b91505092915050565b610150806100b66000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806360fe47b11461003b5780636d4ce63c14610057575b600080fd5b610055600480360381019061005091906100c3565b610075565b005b61005f61007f565b60405161006c91906100ff565b60405180910390f35b8060008190555050565b60008054905090565b600080fd5b6000819050919050565b6100a08161008d565b81146100ab57600080fd5b50565b6000813590506100bd81610097565b92915050565b6000602082840312156100d9576100d8610088565b5b60006100e7848285016100ae565b91505092915050565b6100f98161008d565b82525050565b600060208201905061011460008301846100f0565b9291505056fea2646970667358221220785262acbf50fa50a7b4dc8d8087ca8904c7e6b847a13674503fdcbac903b67e64736f6c63430008170033'; - -const deployedContractAbi = [ - { - inputs: [], - name: 'get', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [{ internalType: 'uint256', name: 'x', type: 'uint256' }], - name: 'set', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -// Creating the contract factory -let contractFactory = thorSoloClient.contracts.createContractFactory( - deployedContractAbi, - contractBytecode, - signer -); - -// Deploy parameters to be used for the contract creation -const deployParams: DeployParams = { types: 'uint', values: ['100'] }; - -// Deploying the contract -contractFactory = await contractFactory.startDeployment(deployParams); - -// Awaiting the contract deployment -const contract = await contractFactory.waitForDeployment(); - -// Awaiting the transaction receipt to confirm successful contract deployment -const receipt = contract.deployTransactionReceipt; - -// END_SNIPPET: ContractSnippet - -expect(receipt.reverted).toEqual(false); -expect(receipt.outputs[0].contractAddress).toBeDefined(); diff --git a/docs/examples/thor-client/delegated-transactions.ts b/docs/examples/thor-client/delegated-transactions.ts deleted file mode 100644 index 1ac335975..000000000 --- a/docs/examples/thor-client/delegated-transactions.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - Address, - Clause, - HexUInt, - Transaction, - type TransactionClause, - VET -} from '@vechain/sdk-core'; -import { THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: DelegatedTransactionsSnippet - -// Sender account with private key -const senderAccount = { - privateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5', - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4' -}; - -/** Delegate account with private key - * @NOTE The delegate account must have enough VET and VTHO to pay for the gas - */ -const delegateAccount = { - privateKey: - '432f38bcf338c374523e83fdb2ebe1030aba63c7f1e81f7d76c5f53f4d42e766', - address: '0x88b2551c3ed42ca663796c10ce68c88a65f73fe2' -}; - -// 1 - Create thor client for solo network - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2 - Get latest block - -const latestBlock = await thorSoloClient.blocks.getBestBlockCompressed(); - -// 3 - Create transaction clauses - -const clauses = [ - Clause.transferVET( - Address.of('0x9e7911de289c3c856ce7f421034f66b6cde49c39'), - VET.of('10000') - ) as TransactionClause -]; - -// Get gas estimate -const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - senderAccount.address -); - -// 4 - Create delegated transaction - -const delegatedTransactionBody = { - chainTag: 0xf6, - blockRef: latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678, - reserved: { - features: 1 - } -}; - -// 5 - Normal signature and delegation signature - -const rawDelegatedSigned = Transaction.of( - delegatedTransactionBody -).signAsSenderAndGasPayer( - HexUInt.of(senderAccount.privateKey).bytes, - HexUInt.of(delegateAccount.privateKey).bytes -).encoded; - -// 6 - Send transaction - -const send = await thorSoloClient.transactions.sendRawTransaction( - HexUInt.of(rawDelegatedSigned).toString() -); -expect(send).toBeDefined(); -expect(send).toHaveProperty('id'); -expect(HexUInt.isValid0x(send.id)).toBe(true); - -// 7 - Get transaction details and receipt - -// Details of transaction -const transactionDetails = await thorSoloClient.transactions.getTransaction( - send.id -); - -// Receipt of transaction -const transactionReceipt = - await thorSoloClient.transactions.getTransactionReceipt(send.id); - -// END_SNIPPET: DelegatedTransactionsSnippet - -expect(send).toBeDefined(); -expect(send).toHaveProperty('id'); -expect(HexUInt.isValid0x(send.id)).toBe(true); -expect(transactionDetails).toBeDefined(); -expect(transactionReceipt).toBeDefined(); diff --git a/docs/examples/thor-client/gas.ts b/docs/examples/thor-client/gas.ts deleted file mode 100644 index 244ef80ea..000000000 --- a/docs/examples/thor-client/gas.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { HexUInt, networkInfo, Transaction } from '@vechain/sdk-core'; -import { THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: GasSnippet - -// 1 - Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2- Init transaction - -// 2.1 - Get latest block -const latestBlock = await thorSoloClient.blocks.getBestBlockCompressed(); - -// 2.2 - Transaction sender and receiver -const senderAccount = { - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4', - privateKey: HexUInt.of( - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - ).bytes -}; - -const receiverAccount = { - address: '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - privateKey: HexUInt.of( - '1758771c54938e977518e4ff1c297aca882f6598891df503030734532efa790e' - ).bytes -}; - -// 2 - Create transaction clauses and compute gas -const clauses = [ - { - to: receiverAccount.address, - value: 1000000, - data: '0x' - } -]; - -// Options to use gasPadding -const options = { - gasPadding: 0.2 // 20% -}; - -// Estimate gas -const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - senderAccount.address, - options -); - -// 4 - Create transaction - -const transactionBody = { - chainTag: networkInfo.solo.chainTag, - blockRef: latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678 -}; - -// 5 - Sign transaction -const rawNormalSigned = Transaction.of(transactionBody).sign( - senderAccount.privateKey -).encoded; - -// 6 - Send transaction - -const send = await thorSoloClient.transactions.sendRawTransaction( - HexUInt.of(rawNormalSigned).toString() -); - -// 7 - Get transaction details and receipt - -const transactionDetails = await thorSoloClient.transactions.getTransaction( - send.id -); -const transactionReceipt = - await thorSoloClient.transactions.getTransactionReceipt(send.id); - -// END_SNIPPET: GasSnippet - -expect(transactionDetails).toBeDefined(); -expect(transactionReceipt).toBeDefined(); diff --git a/docs/examples/thor-client/initialize.ts b/docs/examples/thor-client/initialize.ts deleted file mode 100644 index 2b71c4eda..000000000 --- a/docs/examples/thor-client/initialize.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { - SimpleHttpClient, - TESTNET_URL, - ThorClient -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: InitializingThorClientSnippet - -// First way to initialize thor client -const httpClient = new SimpleHttpClient(TESTNET_URL); -const thorClient = new ThorClient(httpClient); - -// Second way to initialize thor client -const thorClient2 = ThorClient.at(TESTNET_URL); - -// END_SNIPPET: InitializingThorClientSnippet - -expect(thorClient).toBeDefined(); -expect(thorClient2).toBeDefined(); diff --git a/docs/examples/thor-client/logs.ts b/docs/examples/thor-client/logs.ts deleted file mode 100644 index 8c03c5143..000000000 --- a/docs/examples/thor-client/logs.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: LogsSnippet - -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Filter event logs based on the provided criteria. (EXAMPLE 1) - -const eventLogs = await thorClient.logs.filterRawEventLogs({ - // Specify the range of blocks to search for events - range: { - unit: 'block', - from: 0, - to: 100000 - }, - // Additional options for the query, such as offset and limit - options: { - offset: 0, - limit: 3 - }, - // Define criteria for filtering events - criteriaSet: [ - { - // Contract address to filter events - address: '0x0000000000000000000000000000456E65726779', - // Topics to further narrow down the search - topic0: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - topic1: '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - } - ], - // Specify the order in which logs should be retrieved (ascending in this case) - order: 'asc' -}); - -// 3 - Filter again event logs based on the provided criteria. (EXAMPLE 2) - -const transferLogs = await thorClient.logs.filterTransferLogs({ - // Specify the range of blocks to search for transfer events - range: { - unit: 'block', - from: 0, - to: 100000 - }, - // Additional options for the query, such as offset and limit - options: { - offset: 0, - limit: 3 - }, - // Define criteria for filtering transfer events - criteriaSet: [ - { - // Transaction origin, sender, and recipient addresses to filter transfer events - txOrigin: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d', - sender: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d', - recipient: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' - } - ], - // Specify the order in which transfer logs should be retrieved (ascending in this case) - order: 'asc' -}); - -// END_SNIPPET: LogsSnippet - -expect(eventLogs).toEqual([ - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e55fff280', - meta: { - blockID: - '0x000060716a6decc7127d221e8a53cd7b33992db6236490f79d47585f9ae7ca14', - blockNumber: 24689, - blockTimestamp: 1530261290, - txID: '0x0ee8df3a9de6787ec0848ea8951ed8899bb053b6b4af167228dd7c0c012f5346', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - meta: { - blockID: - '0x00006135c993e6cd1ed99aac34679caac80759764ecb01431c9bea0199f3bf4c', - blockNumber: 24885, - blockTimestamp: 1530263250, - txID: '0x86b3364c0faf2df6365b975cf1bd8046264b1eeaa2f266fe15b2df27d7954f65', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x000000000000000000000000f881a94423f22ee9a0e3e1442f515f43c966b7ed' - ], - data: '0x00000000000000000000000000000000000000000000021e19e0c9bab2400000', - meta: { - blockID: - '0x000069fa97729ea3aaddd0756bb2bf2044fc16cb7d2b391b7982059deb43a86c', - blockNumber: 27130, - blockTimestamp: 1530285700, - txID: '0x9edf26009aa903e2c5e7afbb39a547c9cf324a7f3eedafc33691ce2c9e5c9541', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - } -]); -expect(transferLogs).toEqual([ - { - sender: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d', - recipient: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - amount: '0x152d02c7e14af6800000', - meta: { - blockID: - '0x00003abbf8435573e0c50fed42647160eabbe140a87efbe0ffab8ef895b7686e', - blockNumber: 15035, - blockTimestamp: 1530164750, - txID: '0x9daa5b584a98976dfca3d70348b44ba5332f966e187ba84510efb810a0f9f851', - txOrigin: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d', - clauseIndex: 0 - } - } -]); diff --git a/docs/examples/thor-client/nodes.ts b/docs/examples/thor-client/nodes.ts deleted file mode 100644 index 55cae1412..000000000 --- a/docs/examples/thor-client/nodes.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: NodesSnippet - -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Retrieves connected peers of a node - -const peerNodes = await thorClient.nodes.getNodes(); - -// END_SNIPPET: NodesSnippet - -expect(peerNodes).toBeDefined(); diff --git a/docs/examples/thor-client/transactions.ts b/docs/examples/thor-client/transactions.ts deleted file mode 100644 index 0571e1bd2..000000000 --- a/docs/examples/thor-client/transactions.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Address, Clause, HexUInt, Transaction, VET } from '@vechain/sdk-core'; -import { THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: TransactionsSnippet - -// Sender account with private key -const senderAccount = { - privateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5', - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4' -}; - -// 1 - Create thor client for solo network - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2 - Get latest block - -const latestBlock = await thorSoloClient.blocks.getBestBlockCompressed(); - -// 3 - Create clauses - -const clauses = [ - Clause.transferVET( - Address.of('0x9e7911de289c3c856ce7f421034f66b6cde49c39'), - VET.of(10000) - ) -]; - -// Get gas estimate -const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - senderAccount.address -); - -// 4 - Create transaction - -const transactionBody = { - chainTag: 0xf6, - blockRef: latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678 -}; - -// 5 - Normal signature (NO delegation) - -const rawNormalSigned = Transaction.of(transactionBody).sign( - HexUInt.of(senderAccount.privateKey).bytes -).encoded; - -// 6 - Send transaction - -const send = await thorSoloClient.transactions.sendRawTransaction( - HexUInt.of(rawNormalSigned).toString() -); -expect(send).toBeDefined(); -expect(send).toHaveProperty('id'); -expect(HexUInt.isValid0x(send.id)).toBe(true); - -// 7 - Get transaction details and receipt - -const transactionDetails = await thorSoloClient.transactions.getTransaction( - send.id -); -const transactionReceipt = - await thorSoloClient.transactions.getTransactionReceipt(send.id); - -// END_SNIPPET: TransactionsSnippet - -expect(send).toBeDefined(); -expect(send).toHaveProperty('id'); -expect(HexUInt.isValid0x(send.id)).toBe(true); -expect(transactionDetails).toBeDefined(); -expect(transactionReceipt).toBeDefined(); diff --git a/docs/examples/transactions/blockref-expiration.ts b/docs/examples/transactions/blockref-expiration.ts deleted file mode 100644 index 482b096c7..000000000 --- a/docs/examples/transactions/blockref-expiration.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { - Address, - Clause, - networkInfo, - Secp256k1, - Transaction, - VET, - type TransactionClause, - type TransactionBody, - HexUInt -} from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: BlockrefExpirationSnippet - -// 1 - Define clauses - -const clauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(1000) - ) as TransactionClause -]; - -// 2 - Define transaction body - -const body: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x00ffecb8ac3142c4', // first 8 bytes of block id from block #16772280 - expiration: 32, // tx will expire after block #16772280 + 32 - clauses, - gasPriceCoef: 0, - gas: HexUInt.of(Transaction.intrinsicGas(clauses).wei).toString(), // use thor.gas.estimateGas() for better estimation - dependsOn: null, - nonce: 1 -}; - -// 3 - Create private key - -const privateKey = await Secp256k1.generatePrivateKey(); - -// 4 - Sign transaction - -const signedTransaction = Transaction.of(body).sign(privateKey); - -// 5 - Encode transaction - -const encodedRaw = signedTransaction.encoded; - -// 6 - Decode transaction and check - -const decodedTx = Transaction.decode(encodedRaw, true); - -// END_SNIPPET: BlockrefExpirationSnippet - -expect(decodedTx.body.blockRef).toBe(body.blockRef); -expect(decodedTx.body.expiration).toBe(body.expiration); diff --git a/docs/examples/transactions/fee-delegation.ts b/docs/examples/transactions/fee-delegation.ts deleted file mode 100644 index 913eaa923..000000000 --- a/docs/examples/transactions/fee-delegation.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { - Address, - Clause, - HDKey, - HexUInt, - Mnemonic, - Transaction, - VET, - networkInfo, - type TransactionBody, - type TransactionClause -} from '@vechain/sdk-core'; -import { THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: FeeDelegationSnippet - -// Sender account with private key -const senderAccount = { - privateKey: - 'f9fc826b63a35413541d92d2bfb6661128cd5075fcdca583446d20c59994ba26', - address: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' -}; - -// 1 - Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL, { - isPollingEnabled: false -}); - -// 2 - Define clause and estimate gas - -const clauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(10000) - ) as TransactionClause -]; - -// Get gas estimate -const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - senderAccount.address -); - -// 3 - Define transaction body - -const body: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses, - gasPriceCoef: 0, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 1, - reserved: { - features: 1 // set the transaction to be delegated - } -}; - -// 4 - Create private keys of sender and delegate - -const nodeDelegate = HDKey.fromMnemonic(Mnemonic.of()); -const delegatorPrivateKey = nodeDelegate.privateKey; - -// 5 - Get address of delegate - -const delegatorAddress = Address.ofPublicKey(nodeDelegate.publicKey).toString(); - -// 6 - Sign transaction as sender and delegate - -const signedTransaction = Transaction.of(body).signAsSenderAndGasPayer( - HexUInt.of(senderAccount.privateKey).bytes, - HexUInt.of(delegatorPrivateKey).bytes -); - -// 7 - Encode transaction - -const encodedRaw = signedTransaction.encoded; - -// 8 - Decode transaction and check - -const decodedTx = Transaction.decode(encodedRaw, true); - -// END_SNIPPET: FeeDelegationSnippet - -expect(decodedTx.isDelegated).toBeTruthy(); -expect(decodedTx.gasPayer.toString()).toBe(delegatorAddress); diff --git a/docs/examples/transactions/full-flow-delegator-private-key.ts b/docs/examples/transactions/full-flow-delegator-private-key.ts deleted file mode 100644 index 99b7c978a..000000000 --- a/docs/examples/transactions/full-flow-delegator-private-key.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { - Address, - Clause, - HexUInt, - Transaction, - type TransactionClause, - VET -} from '@vechain/sdk-core'; -import { - ProviderInternalBaseWallet, - signerUtils, - THOR_SOLO_URL, - ThorClient, - VeChainProvider -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: FullFlowDelegatorPrivateKeySnippet - -// 1 - Create the thor client -const thorSoloClient = ThorClient.at(THOR_SOLO_URL, { - isPollingEnabled: false -}); - -// Sender account with private key -const senderAccount: { privateKey: string; address: string } = { - privateKey: - 'f9fc826b63a35413541d92d2bfb6661128cd5075fcdca583446d20c59994ba26', - address: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' -}; - -// Delegator account with private key -const delegatorAccount: { privateKey: string; address: string } = { - privateKey: - '521b7793c6eb27d137b617627c6b85d57c0aa303380e9ca4e30a30302fbc6676', - address: '0x062F167A905C1484DE7e75B88EDC7439f82117DE' -}; - -// Create the provider (used in this case to sign the transaction with getSigner() method) -const providerWithDelegationEnabled = new VeChainProvider( - // Thor client used by the provider - thorSoloClient, - - // Internal wallet used by the provider (needed to call the getSigner() method) - new ProviderInternalBaseWallet( - [ - { - privateKey: HexUInt.of(senderAccount.privateKey).bytes, - address: senderAccount.address - } - ], - { - delegator: { - delegatorPrivateKey: delegatorAccount.privateKey - } - } - ), - - // Enable fee delegation - true -); - -// 2 - Create the transaction clauses -const transaction = { - clauses: [ - Clause.transferVET( - Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a'), - VET.of(1) - ) as TransactionClause - ], - simulateTransactionOptions: { - caller: senderAccount.address - } -}; - -// 3 - Estimate gas -const gasResult = await thorSoloClient.gas.estimateGas( - transaction.clauses, - transaction.simulateTransactionOptions.caller -); - -// 4 - Build transaction body -const txBody = await thorSoloClient.transactions.buildTransactionBody( - transaction.clauses, - gasResult.totalGas, - { - isDelegated: true - } -); - -// 4 - Sign the transaction -const signer = await providerWithDelegationEnabled.getSigner( - senderAccount.address -); - -const rawDelegateSigned = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - senderAccount.address - ) -); - -const delegatedSigned = Transaction.decode( - HexUInt.of(rawDelegateSigned.slice(2)).bytes, - true -); - -// 5 - Send the transaction -const sendTransactionResult = - await thorSoloClient.transactions.sendTransaction(delegatedSigned); - -// 6 - Wait for transaction receipt -const txReceipt = await thorSoloClient.transactions.waitForTransaction( - sendTransactionResult.id -); - -// END_SNIPPET: FullFlowDelegatorPrivateKeySnippet - -// Check the signed transaction -expect(delegatedSigned.isSigned).toEqual(true); -expect(delegatedSigned.isDelegated).toEqual(true); -expect(delegatedSigned.gasPayer.toString()).toEqual(delegatorAccount.address); - -// Check the transaction receipt -expect(txReceipt).toBeDefined(); -expect(txReceipt?.gasUsed).toBe(gasResult.totalGas); -expect(sendTransactionResult.id).toBe(txReceipt?.meta.txID); diff --git a/docs/examples/transactions/full-flow-delegator-url.ts b/docs/examples/transactions/full-flow-delegator-url.ts deleted file mode 100644 index 7889ed3fa..000000000 --- a/docs/examples/transactions/full-flow-delegator-url.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { - Address, - Clause, - HexUInt, - Transaction, - type TransactionClause, - VET -} from '@vechain/sdk-core'; -import { - ProviderInternalBaseWallet, - signerUtils, - TESTNET_URL, - ThorClient, - VeChainProvider -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: FullFlowDelegatorUrlSnippet - -// 1 - Create the thor client -const thorClient = ThorClient.at(TESTNET_URL, { - isPollingEnabled: false -}); - -// Sender account with private key -const senderAccount: { - mnemonic: string; - privateKey: string; - address: string; -} = { - mnemonic: - 'fat draw position use tenant force south job notice soul time fruit', - privateKey: - '2153c1e49c14d92e8b558750e4ec3dc9b5a6ac4c13d24a71e0fa4f90f4a384b5', - address: '0x571E3E1fBE342891778151f037967E107fb89bd0' -}; - -// Delegator account with private key -const delegatorAccount = { - URL: 'https://sponsor-testnet.vechain.energy/by/269' -}; - -// Create the provider (used in this case to sign the transaction with getSigner() method) -const providerWithDelegationEnabled = new VeChainProvider( - // Thor client used by the provider - thorClient, - - // Internal wallet used by the provider (needed to call the getSigner() method) - new ProviderInternalBaseWallet( - [ - { - privateKey: HexUInt.of(senderAccount.privateKey).bytes, - address: senderAccount.address - } - ], - { - delegator: { - delegatorUrl: delegatorAccount.URL - } - } - ), - - // Enable fee delegation - true -); - -// 2 - Create the transaction clauses -const transaction = { - clauses: [ - Clause.transferVET( - Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a'), - VET.of(1) - ) as TransactionClause - ], - simulateTransactionOptions: { - caller: senderAccount.address - } -}; - -// 3 - Estimate gas -const gasResult = await thorClient.gas.estimateGas( - transaction.clauses, - senderAccount.address -); - -// 4 - Build transaction body -const txBody = await thorClient.transactions.buildTransactionBody( - transaction.clauses, - gasResult.totalGas, - { - isDelegated: true - } -); - -// 4 - Sign the transaction -const signer = await providerWithDelegationEnabled.getSigner( - senderAccount.address -); - -const rawDelegateSigned = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - senderAccount.address - ) -); - -const delegatedSigned = Transaction.decode( - HexUInt.of(rawDelegateSigned.slice(2)).bytes, - true -); - -// 5 - Send the transaction -const sendTransactionResult = - await thorClient.transactions.sendTransaction(delegatedSigned); - -// 6 - Wait for transaction receipt -const txReceipt = await thorClient.transactions.waitForTransaction( - sendTransactionResult.id -); - -// END_SNIPPET: FullFlowDelegatorUrlSnippet - -// Check the signed transaction -expect(delegatedSigned.isSigned).toEqual(true); -expect(delegatedSigned.isDelegated).toEqual(true); -// expect(signedTx.delegator).toEqual(delegatorAccount.address); --- - -// Check the transaction receipt -expect(txReceipt).toBeDefined(); -expect(txReceipt?.gasUsed).toBe(gasResult.totalGas); -expect(sendTransactionResult.id).toBe(txReceipt?.meta.txID); -console.log(txReceipt); diff --git a/docs/examples/transactions/full-flow-no-delegator.ts b/docs/examples/transactions/full-flow-no-delegator.ts deleted file mode 100644 index a1f58b25d..000000000 --- a/docs/examples/transactions/full-flow-no-delegator.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { - Address, - Clause, - HexUInt, - Transaction, - VET, - type TransactionClause -} from '@vechain/sdk-core'; -import { - ProviderInternalBaseWallet, - signerUtils, - THOR_SOLO_URL, - ThorClient, - VeChainProvider -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// START_SNIPPET: FullFlowNoDelegatorSnippet - -// 1 - Create the thor client -const thorSoloClient = ThorClient.at(THOR_SOLO_URL, { - isPollingEnabled: false -}); - -// Sender account with private key -const senderAccount: { privateKey: string; address: string } = { - privateKey: - 'f9fc826b63a35413541d92d2bfb6661128cd5075fcdca583446d20c59994ba26', - address: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' -}; - -// Create the provider (used in this case to sign the transaction with getSigner() method) -const provider = new VeChainProvider( - // Thor client used by the provider - thorSoloClient, - - // Internal wallet used by the provider (needed to call the getSigner() method) - new ProviderInternalBaseWallet([ - { - privateKey: HexUInt.of(senderAccount.privateKey).bytes, - address: senderAccount.address - } - ]), - - // Disable fee delegation (BY DEFAULT IT IS DISABLED) - false -); - -// 2 - Create the transaction clauses -const transaction = { - clauses: [ - Clause.transferVET( - Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a'), - VET.of(1) - ) as TransactionClause - ], - simulateTransactionOptions: { - caller: senderAccount.address - } -}; - -// 3 - Estimate gas -const gasResult = await thorSoloClient.gas.estimateGas( - transaction.clauses, - transaction.simulateTransactionOptions.caller -); - -// 4 - Build transaction body -const txBody = await thorSoloClient.transactions.buildTransactionBody( - transaction.clauses, - gasResult.totalGas -); - -// 4 - Sign the transaction -const signer = await provider.getSigner(senderAccount.address); - -const rawSignedTransaction = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - senderAccount.address - ) -); - -const signedTransaction = Transaction.decode( - HexUInt.of(rawSignedTransaction.slice(2)).bytes, - true -); - -// 5 - Send the transaction -const sendTransactionResult = - await thorSoloClient.transactions.sendTransaction(signedTransaction); - -// 6 - Wait for transaction receipt -const txReceipt = await thorSoloClient.transactions.waitForTransaction( - sendTransactionResult.id -); - -// END_SNIPPET: FullFlowNoDelegatorSnippet - -// Check the transaction receipt -expect(txReceipt).toBeDefined(); -expect(txReceipt?.gasUsed).toBe(gasResult.totalGas); -expect(sendTransactionResult.id).toBe(txReceipt?.meta.txID); diff --git a/docs/examples/transactions/multiple-clauses.ts b/docs/examples/transactions/multiple-clauses.ts deleted file mode 100644 index 38db1fd8f..000000000 --- a/docs/examples/transactions/multiple-clauses.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - Address, - Clause, - networkInfo, - Secp256k1, - Transaction, - VET, - VTHO, - VTHO_ADDRESS, - type TransactionBody, - type TransactionClause -} from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: MultipleClausesSnippet - -// 1 - Define multiple clauses - -const clauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(10000) - ) as TransactionClause, - Clause.transferToken( - Address.of(VTHO_ADDRESS), - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VTHO.of(10000) - ) as TransactionClause -]; - -// 2 - Calculate intrinsic gas of both clauses - -const gas = Number(Transaction.intrinsicGas(clauses).wei); - -// 3 - Body of transaction - -const body: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 32, - clauses, - gasPriceCoef: 0, - gas, - dependsOn: null, - nonce: 12345678 -}; - -// Create private key -const privateKey = await Secp256k1.generatePrivateKey(); - -// 4 - Sign transaction - -const signedTransaction = Transaction.of(body).sign(privateKey); - -// 5 - Encode transaction - -const encodedRaw = signedTransaction.encoded; - -// 6 - Decode transaction - -const decodedTx = Transaction.decode(encodedRaw, true); - -// END_SNIPPET: MultipleClausesSnippet - -expect(decodedTx.body.clauses.length).toBe(clauses.length); diff --git a/docs/examples/transactions/revert-reason-with-simulation.ts b/docs/examples/transactions/revert-reason-with-simulation.ts deleted file mode 100644 index ae39f851c..000000000 --- a/docs/examples/transactions/revert-reason-with-simulation.ts +++ /dev/null @@ -1,297 +0,0 @@ -import { ABIContract, Units } from '@vechain/sdk-core'; -import { - THOR_SOLO_URL, - ThorClient, - type TransactionSimulationResult -} from '@vechain/sdk-network'; -import { expect } from 'expect'; - -/** - * ABI of the Energy built-in contract. (VTHO) - * - * @link see [energy.sol](https://docs.vechain.org/developer-resources/built-in-contracts#energy-sol) - */ -const energyABI = [ - { - constant: true, - inputs: [], - name: 'name', - outputs: [ - { - name: '', - type: 'string' - } - ], - payable: false, - stateMutability: 'pure', - type: 'function' - }, - { - constant: false, - inputs: [ - { - name: '_spender', - type: 'address' - }, - { - name: '_value', - type: 'uint256' - } - ], - name: 'approve', - outputs: [ - { - name: 'success', - type: 'bool' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'totalSupply', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address' - }, - { - name: '_to', - type: 'address' - }, - { - name: '_amount', - type: 'uint256' - } - ], - name: 'transferFrom', - outputs: [ - { - name: 'success', - type: 'bool' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'decimals', - outputs: [ - { - name: '', - type: 'uint8' - } - ], - payable: false, - stateMutability: 'pure', - type: 'function' - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address' - } - ], - name: 'balanceOf', - outputs: [ - { - name: 'balance', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'symbol', - outputs: [ - { - name: '', - type: 'string' - } - ], - payable: false, - stateMutability: 'pure', - type: 'function' - }, - { - constant: false, - inputs: [ - { - name: '_to', - type: 'address' - }, - { - name: '_amount', - type: 'uint256' - } - ], - name: 'transfer', - outputs: [ - { - name: 'success', - type: 'bool' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address' - }, - { - name: '_to', - type: 'address' - }, - { - name: '_amount', - type: 'uint256' - } - ], - name: 'move', - outputs: [ - { - name: 'success', - type: 'bool' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'totalBurned', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address' - }, - { - name: '_spender', - type: 'address' - } - ], - name: 'allowance', - outputs: [ - { - name: 'remaining', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_from', - type: 'address' - }, - { - indexed: true, - name: '_to', - type: 'address' - }, - { - indexed: false, - name: '_value', - type: 'uint256' - } - ], - name: 'Transfer', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_owner', - type: 'address' - }, - { - indexed: true, - name: '_spender', - type: 'address' - }, - { - indexed: false, - name: '_value', - type: 'uint256' - } - ], - name: 'Approval', - type: 'event' - } -] as const; - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// START_SNIPPET: RevertReasonSimulationSnippet - -const simulatedTx: TransactionSimulationResult[] = - await thorSoloClient.transactions.simulateTransaction([ - { - to: '0x0000000000000000000000000000456e65726779', - value: '0', - data: ABIContract.ofAbi(energyABI) - .encodeFunctionInput('transfer', [ - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - Units.parseEther('1000000000').bi - ]) - .toString() - } - ]); - -const revertReason = thorSoloClient.transactions.decodeRevertReason( - simulatedTx[0].data -); - -// END_SNIPPET: RevertReasonSimulationSnippet - -expect(revertReason).toBe('builtin: insufficient balance'); diff --git a/docs/examples/transactions/revert-reason.ts b/docs/examples/transactions/revert-reason.ts deleted file mode 100644 index 33d48172a..000000000 --- a/docs/examples/transactions/revert-reason.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 1 - Create the thor client -import { TESTNET_URL, ThorClient } from '@vechain/sdk-network'; - -const thorClient = ThorClient.at(TESTNET_URL, { - isPollingEnabled: false -}); - -// START_SNIPPET: RevertReasonSnippet - -// Define transaction id's -const transactionHash = - '0x0a5177fb83346bb6ff7ca8408889f0c99f44b2b1b5c8bf6f0eb53c4b2e81d98d'; - -// Get the revert reason -const revertReason = - await thorClient.transactions.getRevertReason(transactionHash); -console.log(revertReason); - -// END_SNIPPET: RevertReasonSnippet diff --git a/docs/examples/transactions/sign-decode.ts b/docs/examples/transactions/sign-decode.ts deleted file mode 100644 index 2ca476a2c..000000000 --- a/docs/examples/transactions/sign-decode.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { - Address, - Clause, - Secp256k1, - Transaction, - VET, - networkInfo, - type TransactionBody, - type TransactionClause, - HexUInt -} from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: SignDecodeSnippet - -// 1 - Define clauses - -const clauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(10000) - ) as TransactionClause -]; - -// 2 - Calculate intrinsic gas of clauses - -const gas = HexUInt.of(Transaction.intrinsicGas(clauses).wei).toString(); - -// 3 - Body of transaction - -const body: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses, - gasPriceCoef: 128, - gas, - dependsOn: null, - nonce: 12345678 -}; - -// Create private key -const privateKey = await Secp256k1.generatePrivateKey(); - -// 4 - Sign transaction - -const signedTransaction = Transaction.of(body).sign(privateKey); - -// 5 - Encode transaction - -const encodedRaw = signedTransaction.encoded; - -// 6 - Decode transaction - -const decodedTx = Transaction.decode(encodedRaw, true); - -// END_SNIPPET: SignDecodeSnippet - -expect(decodedTx.body.chainTag).toBe(body.chainTag); -expect(decodedTx.body.nonce).toBe(body.nonce); diff --git a/docs/examples/transactions/simulation.ts b/docs/examples/transactions/simulation.ts deleted file mode 100644 index bd4922631..000000000 --- a/docs/examples/transactions/simulation.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { expect } from 'expect'; -import { THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { - Address, - Clause, - type TransactionClause, - VET -} from '@vechain/sdk-core'; -import { stringifyData } from '@vechain/sdk-errors'; - -// START_SNIPPET: SimulationSnippet - -// In this example we simulate a transaction of sending 1 VET to another account -// And we demonstrate (1) how we can check the expected gas cost and (2) whether the transaction is successful - -// 1 - Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2(a) - create the transaction for a VET transfer -const transaction1 = { - clauses: [ - Clause.transferVET( - Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a'), - VET.of(1) - ) as TransactionClause - ], - // Please note - this field one of the optional fields that may be passed (see SimulateTransactionOptions), - // and is only required if you want to simulate a transaction - simulateTransactionOptions: { - caller: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' - } -}; - -// 3 - Simulate the transaction -const simulatedTx1 = await thorSoloClient.transactions.simulateTransaction( - transaction1.clauses, - { - ...transaction1.simulateTransactionOptions - } -); - -// In this next example we simulate a Simulate smart contract deployment -// And we demonstrate how we can check the expected gas cost and whether the transaction would succeed - -// 1(a) - create the transaction to simulate a smart deployment -const transaction2 = { - clauses: [ - { - to: null, - value: '0', - /** - * Sample contract bytecode (Without constructor arguments) - * - * @remarks - When deploying a contract that requires constructor arguments, the encoded constructor must be appended to the bytecode - * Otherwise the contract might revert if the constructor arguments are required. - */ - data: '0x60806040526040518060400160405280600681526020017f48656c6c6f210000000000000000000000000000000000000000000000000000815250600090816200004a9190620002d9565b503480156200005857600080fd5b50620003c0565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620000e157607f821691505b602082108103620000f757620000f662000099565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001617fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000122565b6200016d868362000122565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620001ba620001b4620001ae8462000185565b6200018f565b62000185565b9050919050565b6000819050919050565b620001d68362000199565b620001ee620001e582620001c1565b8484546200012f565b825550505050565b600090565b62000205620001f6565b62000212818484620001cb565b505050565b5b818110156200023a576200022e600082620001fb565b60018101905062000218565b5050565b601f82111562000289576200025381620000fd565b6200025e8462000112565b810160208510156200026e578190505b620002866200027d8562000112565b83018262000217565b50505b505050565b600082821c905092915050565b6000620002ae600019846008026200028e565b1980831691505092915050565b6000620002c983836200029b565b9150826002028217905092915050565b620002e4826200005f565b67ffffffffffffffff8111156200030057620002ff6200006a565b5b6200030c8254620000c8565b620003198282856200023e565b600060209050601f8311600181146200035157600084156200033c578287015190505b620003488582620002bb565b865550620003b8565b601f1984166200036186620000fd565b60005b828110156200038b5784890151825560018201915060208501945060208101905062000364565b86831015620003ab5784890151620003a7601f8916826200029b565b8355505b6001600288020188555050505b505050505050565b61081480620003d06000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631718ad881461004657806319ff1d211461007657806349da5de414610094575b600080fd5b610060600480360381019061005b91906102c1565b6100b0565b60405161006d919061037e565b60405180910390f35b61007e6101b5565b60405161008b919061037e565b60405180910390f35b6100ae60048036038101906100a99190610405565b610243565b005b606081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610122576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101199061049e565b60405180910390fd5b6000805461012f906104ed565b80601f016020809104026020016040519081016040528092919081815260200182805461015b906104ed565b80156101a85780601f1061017d576101008083540402835291602001916101a8565b820191906000526020600020905b81548152906001019060200180831161018b57829003601f168201915b5050505050915050919050565b600080546101c2906104ed565b80601f01602080910402602001604051908101604052809291908181526020018280546101ee906104ed565b801561023b5780601f106102105761010080835404028352916020019161023b565b820191906000526020600020905b81548152906001019060200180831161021e57829003601f168201915b505050505081565b81816000918261025492919061070e565b505050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061028e82610263565b9050919050565b61029e81610283565b81146102a957600080fd5b50565b6000813590506102bb81610295565b92915050565b6000602082840312156102d7576102d6610259565b5b60006102e5848285016102ac565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561032857808201518184015260208101905061030d565b60008484015250505050565b6000601f19601f8301169050919050565b6000610350826102ee565b61035a81856102f9565b935061036a81856020860161030a565b61037381610334565b840191505092915050565b600060208201905081810360008301526103988184610345565b905092915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126103c5576103c46103a0565b5b8235905067ffffffffffffffff8111156103e2576103e16103a5565b5b6020830191508360018202830111156103fe576103fd6103aa565b5b9250929050565b6000806020838503121561041c5761041b610259565b5b600083013567ffffffffffffffff81111561043a5761043961025e565b5b610446858286016103af565b92509250509250929050565b7f496e76616c696420616464726573730000000000000000000000000000000000600082015250565b6000610488600f836102f9565b915061049382610452565b602082019050919050565b600060208201905081810360008301526104b78161047b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061050557607f821691505b602082108103610518576105176104be565b5b50919050565b600082905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026105ba7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261057d565b6105c4868361057d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061060b610606610601846105dc565b6105e6565b6105dc565b9050919050565b6000819050919050565b610625836105f0565b61063961063182610612565b84845461058a565b825550505050565b600090565b61064e610641565b61065981848461061c565b505050565b5b8181101561067d57610672600082610646565b60018101905061065f565b5050565b601f8211156106c25761069381610558565b61069c8461056d565b810160208510156106ab578190505b6106bf6106b78561056d565b83018261065e565b50505b505050565b600082821c905092915050565b60006106e5600019846008026106c7565b1980831691505092915050565b60006106fe83836106d4565b9150826002028217905092915050565b610718838361051e565b67ffffffffffffffff81111561073157610730610529565b5b61073b82546104ed565b610746828285610681565b6000601f8311600181146107755760008415610763578287013590505b61076d85826106f2565b8655506107d5565b601f19841661078386610558565b60005b828110156107ab57848901358255600182019150602085019450602081019050610786565b868310156107c857848901356107c4601f8916826106d4565b8355505b6001600288020188555050505b5050505050505056fea2646970667358221220131b1aac58b5047d715ef4f6d1b050c9a836905c50de69cf41edc485446e5f5f64736f6c63430008110033' - } - ] -}; - -// 2 - Simulate the transaction -const simulatedTx2 = await thorSoloClient.transactions.simulateTransaction( - transaction2.clauses -); - -// END_SNIPPET: SimulationSnippet - -// 2(b) - define the expected result -const expected1 = [ - { - data: '0x', - events: [], - transfers: [ - { - sender: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6', - recipient: '0xb717b660cd51109334bd10b2c168986055f58c1a', - amount: '0xde0b6b3a7640000' // hex representation of 1000000000000000000 wei (1 VET) - } - ], - gasUsed: 0, - reverted: false, - vmError: '' - } -]; - -// 4 - Check the result - i.e. the gas used is returned and the transfer values are correct -// Note: VET transfers do not consume gas (no EVM computation) -expect(simulatedTx1[0].gasUsed).toEqual(expected1[0].gasUsed); -expect(simulatedTx1[0].transfers).toEqual(expected1[0].transfers); - -// 1(b) - define the expected result -const expected2 = [ - { - // compiled bytecode of the smart contract - data: '0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631718ad881461004657806319ff1d211461007657806349da5de414610094575b600080fd5b610060600480360381019061005b91906102c1565b6100b0565b60405161006d919061037e565b60405180910390f35b61007e6101b5565b60405161008b919061037e565b60405180910390f35b6100ae60048036038101906100a99190610405565b610243565b005b606081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610122576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101199061049e565b60405180910390fd5b6000805461012f906104ed565b80601f016020809104026020016040519081016040528092919081815260200182805461015b906104ed565b80156101a85780601f1061017d576101008083540402835291602001916101a8565b820191906000526020600020905b81548152906001019060200180831161018b57829003601f168201915b5050505050915050919050565b600080546101c2906104ed565b80601f01602080910402602001604051908101604052809291908181526020018280546101ee906104ed565b801561023b5780601f106102105761010080835404028352916020019161023b565b820191906000526020600020905b81548152906001019060200180831161021e57829003601f168201915b505050505081565b81816000918261025492919061070e565b505050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061028e82610263565b9050919050565b61029e81610283565b81146102a957600080fd5b50565b6000813590506102bb81610295565b92915050565b6000602082840312156102d7576102d6610259565b5b60006102e5848285016102ac565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561032857808201518184015260208101905061030d565b60008484015250505050565b6000601f19601f8301169050919050565b6000610350826102ee565b61035a81856102f9565b935061036a81856020860161030a565b61037381610334565b840191505092915050565b600060208201905081810360008301526103988184610345565b905092915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126103c5576103c46103a0565b5b8235905067ffffffffffffffff8111156103e2576103e16103a5565b5b6020830191508360018202830111156103fe576103fd6103aa565b5b9250929050565b6000806020838503121561041c5761041b610259565b5b600083013567ffffffffffffffff81111561043a5761043961025e565b5b610446858286016103af565b92509250509250929050565b7f496e76616c696420616464726573730000000000000000000000000000000000600082015250565b6000610488600f836102f9565b915061049382610452565b602082019050919050565b600060208201905081810360008301526104b78161047b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061050557607f821691505b602082108103610518576105176104be565b5b50919050565b600082905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026105ba7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261057d565b6105c4868361057d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061060b610606610601846105dc565b6105e6565b6105dc565b9050919050565b6000819050919050565b610625836105f0565b61063961063182610612565b84845461058a565b825550505050565b600090565b61064e610641565b61065981848461061c565b505050565b5b8181101561067d57610672600082610646565b60018101905061065f565b5050565b601f8211156106c25761069381610558565b61069c8461056d565b810160208510156106ab578190505b6106bf6106b78561056d565b83018261065e565b50505b505050565b600082821c905092915050565b60006106e5600019846008026106c7565b1980831691505092915050565b60006106fe83836106d4565b9150826002028217905092915050565b610718838361051e565b67ffffffffffffffff81111561073157610730610529565b5b61073b82546104ed565b610746828285610681565b6000601f8311600181146107755760008415610763578287013590505b61076d85826106f2565b8655506107d5565b601f19841661078386610558565b60005b828110156107ab57848901358255600182019150602085019450602081019050610786565b868310156107c857848901356107c4601f8916826106d4565b8355505b6001600288020188555050505b5050505050505056fea2646970667358221220131b1aac58b5047d715ef4f6d1b050c9a836905c50de69cf41edc485446e5f5f64736f6c63430008110033', - events: [ - // Standard event emitted when simulating a deployment of a smart contract for VeChainThor - { - address: '0x841a6556c524d47030762eb14dc4af897e605d9b', - topics: [ - '0xb35bf4274d4295009f1ec66ed3f579db287889444366c03d3a695539372e8951' - ], - data: '0x0000000000000000000000000000000000000000000000000000000000000000' - } - ], - transfers: [], - gasUsed: 434928, // The required gas to deploy the contract - reverted: false, - vmError: '' - } -]; - -// 3 - Check the result -expect(stringifyData(simulatedTx2)).toStrictEqual(stringifyData(expected2)); diff --git a/docs/examples/transactions/tx-dependency.ts b/docs/examples/transactions/tx-dependency.ts deleted file mode 100644 index 727c0a2eb..000000000 --- a/docs/examples/transactions/tx-dependency.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { - Address, - Clause, - HexUInt, - Secp256k1, - VET, - Transaction, - networkInfo, - type TransactionClause, - type TransactionBody -} from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// START_SNIPPET: TxDependencySnippet - -// 1 - Define transaction clauses - -const txAClauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(1000) - ) as TransactionClause -]; -const txBClauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7ccadeea14dd6727845b58f8aa7aad0f41a002a2'), - VET.of(1) - ) -]; - -// 2 - Define transaction A with no dependencies - -// @NOTE: This transaction has nonce = 1 -const txABody: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses: txAClauses, - gasPriceCoef: 0, - gas: HexUInt.of(Transaction.intrinsicGas(txAClauses).wei).toString(), // use thor.gas.estimateGas() for better estimation - dependsOn: null, - nonce: 1 -}; - -// 3 - Define transaction B with nonce = 2 - -// @NOTE: at the moment dependsOn is null -const txBBody: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses: txBClauses, - gasPriceCoef: 0, - gas: HexUInt.of(Transaction.intrinsicGas(txBClauses).wei).toString(), // use thor.gas.estimateGas() for better estimation - dependsOn: null, - nonce: 2 -}; - -// Define the senders private key -const senderPrivateKey = await Secp256k1.generatePrivateKey(); - -// To define transaction B as dependent on transaction -// it's necessary to sign transaction A, and then get its Id -// and set that Id into transaction B's dependsOn field - -// 4 - Get Tx A id - -const txASigned = Transaction.of(txABody).sign(senderPrivateKey); - -// 5 - Set it inside tx B - -txBBody.dependsOn = txASigned.id.toString(); - -// 6 - Sign Tx B - -const txBSigned = Transaction.of(txBBody).sign(senderPrivateKey); - -// 7 - encode Tx B - -const rawTxB = txBSigned.encoded; - -// Check (we can decode Tx B) -const decodedTx = Transaction.decode(rawTxB, true); - -// END_SNIPPET: TxDependencySnippet - -expect(decodedTx.body.dependsOn).toBe(txASigned.id.toString()); diff --git a/docs/javascript.md b/docs/javascript.md deleted file mode 100644 index ed237f96a..000000000 --- a/docs/javascript.md +++ /dev/null @@ -1,59 +0,0 @@ -# How to Use the VeChain SDK with JavaScript - -The [VeChain SDK](https://github.com/vechain/vechain-sdk-js) can be used with both TypeScript and JavaScript. Although TypeScript is recommended for its type safety and enhanced development experience, you can also use the SDK with JavaScript. - -## Installation - -To install the core package of the VeChain SDK, run: -``` bash -npm install @vechain/sdk-core -``` - -## Usage - -Here’s an example of how to use the SDK in your JavaScript code: - -``` javascript -const { Hex, _blake2b256 } = require('@vechain/sdk-core'); - -// Input of the hash function (it can be a string or a Uint8Array) -const toHash = 'hello world'; - -const hash = _blake2b256(toHash); - -console.log(Hex.of(hash)); // Outputs: 256c83b297114d201b30179f3f0ef0cace9783622da5974326b436178aeef610 -``` - -## Differences Between TypeScript and JavaScript - -When using the SDK in TypeScript vs. JavaScript, there are a few key differences: - - Imports: - - In TypeScript, you use import statements: - ``` typescript - import { Hex, _blake2b256 } from '@vechain/sdk-core'; - ``` - - In JavaScript, you use require statements: - ``` javascript - const { Hex, _blake2b256 } = require('@vechain/sdk-core'); - ``` - - Type Annotations: - - TypeScript uses types to provide compile-time checks and better code completion. - ``` typescript - import { Hex, _blake2b256, type HashInput } from '@vechain/sdk-core'; - import { expect } from 'expect'; - - const toHash: HashInput = 'hello world'; - const hash = _blake2b256(toHash); - - console.log(Hex.of(hash)); - ``` - - JavaScript does not use types. If you see TypeScript examples, you can remove all type annotations to convert them to JavaScript. - ``` javascript - const { Hex, _blake2b256 } = require('@vechain/sdk-core'); - - const toHash = 'hello world'; - const hash = _blake2b256(toHash); - - console.log(Hex.of(hash)); - ``` - diff --git a/docs/package.json b/docs/package.json deleted file mode 100644 index c966ff64e..000000000 --- a/docs/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "docs", - "version": "2.0.0-beta.1", - "private": true, - "description": "Official documentation for the VeChain TypeScript SDK with examples", - "author": "VeChain Foundation", - "license": "MIT", - "keywords": [ - "VeChain", - "documentation", - "example" - ], - "type": "module", - "scripts": { - "build": "find . -name \"*.md\" -type f -maxdepth 1 ! -name \"README.md\" -delete && tsup ./build-scripts && node dist/builddocs.cjs", - "test:examples": "ts-node-test examples/", - "test:examples:solo": "(yarn start-thor-solo && yarn test:examples && yarn stop-thor-solo) || yarn stop-thor-solo" - }, - "dependencies": { - "@vechain/sdk-core": "2.0.0-beta.1", - "@vechain/sdk-network": "2.0.0-beta.1" - }, - "devDependencies": { - "expect": "^29.7.0", - "ts-node-test": "^0.4.4", - "typescript": "^5.6.3" - } -} \ No newline at end of file diff --git a/docs/polls.md b/docs/polls.md deleted file mode 100644 index 8eed6dc2c..000000000 --- a/docs/polls.md +++ /dev/null @@ -1,223 +0,0 @@ -# Polling Mechanisms - -## Synchronous Polling - -Synchronous polling mechanisms are implemented to await the fulfillment of specific conditions. Upon the satisfaction of these conditions, the polling process yields the result of the given condition. - -### Monitoring for a New Block Production -This section illustrates the methodology for monitoring the production of a new block. Utilizing synchronous polling, the waitUntil function is employed to efficiently wait for the production of a new block. - -```typescript { name=sync-poll-wait-new-block, category=example } -import { Poll, TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; - -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Get current block - -const currentBlock = await thorClient.blocks.getBestBlockCompressed(); - -console.log('Current block:', currentBlock); - -// 3 - Wait until a new block is created - -// Wait until a new block is created with polling interval of 3 seconds -const newBlock = await Poll.SyncPoll( - // Get the latest block as polling target function - async () => await thorClient.blocks.getBlockCompressed('best'), - // Polling interval is 3 seconds - { requestIntervalInMilliseconds: 3000 } -).waitUntil((newBlockData) => { - // Stop polling when the new block number is greater than the current block number - return (newBlockData?.number as number) > (currentBlock?.number as number); -}); - -expect(newBlock).toBeDefined(); -expect(newBlock?.number).toBeGreaterThan(currentBlock?.number as number); - -console.log('New block:', newBlock); - -``` - -### Observing Balance Changes Post-Transfer -Here, we explore the approach to monitor balance changes after a transfer. Synchronous polling leverages the waitUntil function to detect balance changes following a transfer. - -```typescript { name=sync-poll-wait-balance-update, category=example } -import { Poll, THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import { Address, HexUInt, Transaction } from '@vechain/sdk-core'; -import { expect } from 'expect'; - -// 1 - Create thor client for solo network - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2- Init transaction - -// 2.1 - Get latest block -const latestBlock = await thorSoloClient.blocks.getBestBlockCompressed(); - -// 2.2 - Transaction sender and receiver -const sender = { - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4', - privateKey: HexUInt.of( - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - ).bytes -}; - -const receiver = { - address: '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - privateKey: HexUInt.of( - '1758771c54938e977518e4ff1c297aca882f6598891df503030734532efa790e' - ).bytes -}; - -// 2.2 - Create transaction clauses -const clauses = [ - { - to: receiver.address, - value: 1000000, - data: '0x' - } -]; - -// 2.3 - Calculate gas -const gasResult = await thorSoloClient.gas.estimateGas(clauses, sender.address); - -// 2.4 - Create transactions -const transactionBody = { - // Solo network chain tag - chainTag: 0xf6, - // Solo network block ref - blockRef: latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678 -}; - -// 2.5 - Sign and get raw transaction -const encoded = Transaction.of(transactionBody).sign(sender.privateKey).encoded; -const raw = HexUInt.of(encoded).toString(); - -// 3 - Get the sender and receiver balance before the transaction - -const senderBalanceBefore = ( - await thorSoloClient.accounts.getAccount(Address.of(sender.address)) -).balance; - -const receiverBalanceBefore = ( - await thorSoloClient.accounts.getAccount(Address.of(receiver.address)) -).balance; - -console.log('Sender balance before:', senderBalanceBefore); -console.log('Receiver balance before:', receiverBalanceBefore); - -// 4 - Send transaction - -const sentTransaction = - await thorSoloClient.transactions.sendRawTransaction(raw); - -// 4.1 - Check if the transaction is sent successfully (check if the transaction id is a valid hex string) -expect(sentTransaction).toBeDefined(); -expect(sentTransaction).toHaveProperty('id'); -expect(HexUInt.isValid0x(sentTransaction.id)).toBe(true); - -// 4 -Wait until balance is updated - -// New balance of sender (wait until the balance is updated) -const newBalanceSender = await Poll.SyncPoll( - async () => - (await thorSoloClient.accounts.getAccount(Address.of(sender.address))) - .balance -).waitUntil((newBalance) => { - return newBalance !== senderBalanceBefore; -}); - -// New balance of receiver (wait until the balance is updated) -const newBalanceReceiver = await Poll.SyncPoll( - async () => - (await thorSoloClient.accounts.getAccount(Address.of(receiver.address))) - .balance -).waitUntil((newBalance) => { - return newBalance !== receiverBalanceBefore; -}); - -expect(newBalanceSender).toBeDefined(); -expect(newBalanceReceiver).toBeDefined(); - -expect(newBalanceSender).not.toBe(senderBalanceBefore); -expect(newBalanceReceiver).not.toBe(receiverBalanceBefore); - -console.log('New balance of sender:', newBalanceSender); -console.log('New balance of receiver:', newBalanceReceiver); - -``` - -## Asynchronous Polling - -Asynchronous polling is utilized for waiting in a non-blocking manner until a specific condition is met or to capture certain events. This type of polling makes use of the Event Emitter pattern, providing notifications when the specified condition or event has been met or emitted. - -### Implementing a Simple Async Poll in a DAPP -This example demonstrates the application of an asynchronous poll for tracking transaction events, allowing for the execution of additional operations concurrently. - -```typescript { name=event-poll-dapp, category=example } -import { Poll, TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import { expect } from 'expect'; -import { Address } from '@vechain/sdk-core'; - -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Init accounts - -const accounts = [ - '0x2669514f9fe96bc7301177ba774d3da8a06cace4', - '0x9e7911de289c3c856ce7f421034f66b6cde49c39' -]; - -// 3 - Monitor status for each account - -for (const account of accounts) { - const monitoringPoll = Poll.createEventPoll( - async () => await thorClient.accounts.getAccount(Address.of(account)), - 1000 - ) - // Add listeners for start event - .onStart((eventPoll) => { - console.log(`Start monitoring account ${account}`, eventPoll); - }) - - // Add listeners for stop event - .onStop((eventPoll) => { - console.log(`Stop monitoring account ${account}`, eventPoll); - }) - - // Add listeners for data event. It intercepts the account details every 1 second - .onData((accountDetails, eventPoll) => { - console.log(`Account details of ${account}:`, accountDetails); - - // Stop after 3 iterations - EXIT CONDITION - if (eventPoll.getCurrentIteration === 3) eventPoll.stopListen(); - }) - - // Add listeners for error event - .onError((error) => { - console.log('Error:', error); - }); - - monitoringPoll.startListen(); - - // It seems to be strange, BUT onData is called only after 1 second of the eventPoll.startListen() call. - expect(monitoringPoll.getCurrentIteration).toBe(0); -} - -``` - - - - diff --git a/docs/provider.md b/docs/provider.md deleted file mode 100644 index fc07f2e6b..000000000 --- a/docs/provider.md +++ /dev/null @@ -1,84 +0,0 @@ -# Provider - -## Overview - -The VeChain Provider is a powerful tool designed to interact with the VeChain blockchain seamlessly. This documentation outlines the features, usage, and configuration of the VeChain Provider and its companion, the Hardhat Provider. - -## VeChain Provider - -The VeChain Provider is our core provider, offering direct interaction with the VeChain blockchain. It extends EventEmitter and implements EIP1193ProviderMessage for efficient event handling and message passing. - -### Features - - - Seamless interaction with the VeChain blockchain. - - Event handling capabilities using EventEmitter. - - Implementation of EIP1193ProviderMessage for standardized message communication. - -### Usage - -To use the VeChain Provider in your project, follow these steps: - - Import the provider in your code: - ``` bash - import { VeChainProvider } from '@vechain/sdk-network'; - ``` - - Initialize the provider: - ``` bash - const provider = new VeChainProvider(thorClient, wallet); - ``` - - Start interacting with the VeChain blockchain using the available methods provided by the VeChainProvider. - -Example: -```typescript { name=vechain-provider, category=example } -// 1 - Create thor client for testnet -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Init provider -const provider = new VeChainProvider(thorClient); - -// 3 - Call RPC function -const rpcCallChainId = await provider.request({ - method: 'eth_chainId' -}); -``` - -## HardHat Provider - -The Hardhat Provider is a wrapper around the core VeChain Provider specifically designed for Hardhat integration. It simplifies the process of using the VeChain Provider within a Hardhat environment. - -### Features - - - Wrapper around the core VeChain Provider. - - Simplified integration with Hardhat projects. - -### Usage - -To use the Hardhat Provider in your project, follow these steps: - - Import the provider in your code: - ``` bash - import { HardhatVeChainProvider } from '@vechain/sdk-network'; - ``` - - Initialize the provider: - ``` bash - const provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - testnetUrl, - (message: string, parent?: Error) => new Error(message, parent) - ); - ``` - - Start interacting with the VeChain blockchain using the available methods provided by the HardhatVeChainProvider. - -Example: - -```typescript { name=vechain-hardhat-provider, category=example } -// 1 - Init provider -const provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - TESTNET_URL, - (message: string, parent?: Error) => new Error(message, parent) -); - -// 2 - Call RPC function -const rpcCallChainId = await provider.request({ - method: 'eth_chainId' -}); -``` diff --git a/docs/subscriptions.md b/docs/subscriptions.md deleted file mode 100644 index 8973eae4d..000000000 --- a/docs/subscriptions.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -description: Subscriptions URLs ---- - -# Subscriptions - -## Getting Started with Subscriptions - -The subscriptions module of the VeChain sdk provides various endpoints for subscribing to different types of blockchain data, including blocks, events, and transfers. These subscriptions are useful for real-time monitoring of blockchain activities. -To use the subscription endpoints, import the `subscriptions`` object from the VeChain sdk. You can then call various methods on this object to create WebSocket URLs for different types of subscriptions. - -### Smart contract event subscription - -Subscribe to specific contract events through the `subscriptions.getEventSubscriptionUrl`. You can filter events based on contract address and topics. - -```typescript { name=event-subscriptions, category=example } -import { subscriptions, TESTNET_URL } from '@vechain/sdk-network'; -import WebSocket from 'isomorphic-ws'; - -/** - * The event to subscribe to. - * The event can be defined as an object or as a string. - * - * @see [Event format type examples](https://github.com/vechain/vechain-sdk/blob/9720551d165b706662c13fac657f55e5a506ea4d/packages/core/tests/abi/fixture.ts#L126) - */ -const swapEvent = - 'event Swap(address indexed sender,uint amount0In,uint amount1In,uint amount0Out,uint amount1Out,address indexed to)'; - -// The address of the sender to filter events by -const senderSampleAddress = '0x9e7911de289c3c856ce7f421034f66b6cde49c39'; - -// The address of the recipient to filter events by -const toSampleAddress = '0xfe7911df289c3c856ce7f421034f66b6cd249c39'; - -const wsURL = subscriptions.getEventSubscriptionUrl( - TESTNET_URL, - swapEvent, - /** - * The values of the indexed parameters to construct the topic filters. - * - * @note The order of the values must match the order of the indexed parameters in the event. - * @note You can omit the first indexed parameter with `null` and only specify the second indexed parameter if you only want to filter by the second indexed parameter. - */ - [senderSampleAddress, toSampleAddress], - { - address: '0x6c0A6e1d922E0e63901301573370b932AE20DAdB' // Vexchange contract address - } -); - -// Any websocket library can be used to connect to the websocket -const ws = new WebSocket(wsURL); - -// Simple websocket event handlers - -// Error handling -ws.on('error', console.error); - -// Connection opened -ws.on('open', () => { - console.log('connected'); -}); - -// Connection closed -ws.on('close', () => { - console.log('disconnected'); -}); - -// Message received -ws.on('message', (data: unknown) => { - console.log('received: %s', data); -}); - -// Close the connection to the websocket -ws.close(); - -``` - -This example demonstrates how to create a WebSocket URL for subscribing to swap events of a specific contract. - -The VeChain sdk also provides other subscription endpoints for subscribing to different types of blockchain data. These include: - -### Block subscription - -Subscribe to new blocks as they are added to the blockchain through the `subscriptions.getBlockSubscriptionUrl` method. - -```typescript { name=block-subscriptions, category=example } -import { subscriptions, TESTNET_URL } from '@vechain/sdk-network'; -import WebSocket from 'isomorphic-ws'; - -// The URL for subscribing to the block -const wsURL = subscriptions.getBlockSubscriptionUrl(TESTNET_URL); - -// Any websocket library can be used to connect to the websocket -const ws = new WebSocket(wsURL); - -// Simple websocket event handlers - -// Error handling -ws.on('error', console.error); - -// Connection opened -ws.on('open', () => { - console.log('connected'); -}); - -// Connection closed -ws.on('close', () => { - console.log('disconnected'); -}); - -// Message received -ws.on('message', (data: unknown) => { - console.log('received: %s', data); -}); - -// Close the connection to the websocket -ws.close(); - -``` - -### Other subscriptions - -The VeChain sdk also provides other subscription endpoints for subscribing to different types of blockchain data. These include: -- `subscriptions.getVETtransfersSubscriptionUrl` for subscribing to VET transfers -- `subscriptions.getNewTransactionsSubscriptionUrl` for subscribing to new transactions -- `subscriptions.getBeatSubscriptionUrl` for subscribing to new blockchain beats (A beat is a notification that a new block has been added to the blockchain with a bloom filter which can be used to check if the block contains any relevant account.) -- `subscriptions.getLegacyBeatSubscriptionUrl` for subscribing to the legacy beats. - diff --git a/docs/templates/accounts.md b/docs/templates/accounts.md deleted file mode 100644 index 77c50d408..000000000 --- a/docs/templates/accounts.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -description: Handling of mnemonics and keystore. ---- - -# Accounts - -Vechain SDK employs two primary classes, mnemonics and keystore, to facilitate account handling. - -## Mnemonics - -Mnemonics represent a standard human-readable approach to generate private keys. They consist of a set of words that are human-friendly and can be converted into entropy for generating private keys using derivation paths and various cryptography concepts. Notably, this process adheres to standards such as BIP-32, BIP-39, and BIP-44. These standards provide specifications and guidelines for mnemonic phrase generation, hierarchical deterministic wallets, and key derivation. - -### BIP-39 - -BIP-39, or Bitcoin Improvement Proposal 39, outlines a standard for creating mnemonic phrases to represent private keys. -These mnemonic phrases are typically generated as a sequence of words chosen from a predefined list, which makes them easier for humans to remember and transcribe accurately. -BIP-39 provides several benefits: - - **Human Readability**: Mnemonic phrases are constructed from a fixed set of words, typically 12 or 24, chosen from a predefined list. This makes them easier for users to write down and remember compared to raw private keys. - - **Error Detection**: BIP-39 includes a checksum in the mnemonic phrase, which allows for simple error detection. If a word is mistyped or omitted, the checksum will fail to validate, alerting the user to the error. - - **Compatibility**: BIP-39 mnemonics are widely supported across different wallets and applications within the cryptocurrency ecosystem. This ensures interoperability and ease of use for users who wish to access their funds from different platforms. - - **Security**: By generating private keys from a mnemonic phrase, users can securely back up and restore their wallets. As long as the mnemonic phrase is kept secure, users can recover their funds even if their original device is lost or damaged. - -[Bip39Snippet](examples/accounts/bip39.ts) - -### BIP-32 - -BIP-32, or Bitcoin Improvement Proposal 32, defines a standard for hierarchical deterministic wallets (HD wallets). -HD wallets allow for the generation of a tree-like structure of keys derived from a single master seed. -This hierarchy provides several advantages, including: - - **Deterministic Key Generation**: All keys in an HD wallet are derived from a single master seed. This means that a user only needs to back up their master seed to recover all of their derived keys, rather than backing up each key individually. - - **Hierarchical Structure**: HD wallets use a tree-like structure to organize keys. This allows for the creation of multiple accounts or sub wallets within a single wallet, each with its own unique set of keys derived from the master seed. - - **Security**: By using a master seed to derive keys, HD wallets simplify the backup and recovery process while maintaining security. As long as the master seed is kept secure, all derived keys are also secure. - - **Privacy**: HD wallets provide improved privacy by generating a new public key for each transaction. This prevents observers from linking multiple transactions to a single wallet address. - -[Bip32Snippet](examples/accounts/bip32.ts) - -### Extended Public Key (xpub) - -An extended public key (xpub) is derived from an HD wallet's master public key (often referred to as an extended private key, xprv). It represents a point in the HD wallet's key derivation path from which child public keys can be derived, but not private keys. This allows for the creation of a "watch-only" wallet, where the ability to generate transactions is restricted, enhancing security. - -### HDKey Instance - -In the context of hierarchical deterministic wallets, an HDKey instance represents a node in the hierarchical tree structure of keys. -This key can be derived from a parent key using specific derivation paths. -HDKey instances encapsulate information such as the private key, public key, chain code, and index, allowing for secure and efficient key derivation. - -### From Public Key - -Generating an HDKey instance from an extended public key (xpub) allows developers to derive child public keys for purposes such as address generation, transaction monitoring, or building hierarchical structures within the wallet. This functionality is particularly useful in scenarios where the private keys are stored securely offline, and only public keys are exposed to the network for enhanced security. - -[PubKeySnippet](examples/accounts/pubkey.ts) - -## Keystore - -On the other hand, Keystore is employed for encrypting private keys in accordance with the Ethereum standard. By using Keystore, the private keys can be securely encrypted to prevent unauthorized access or exposure. - -Through the use of mnemonics and keystore, VeChainSDK ensures secure and user-friendly account handling. Mnemonics allow for easy generation of private keys, while keystore provides an additional layer of protection by encrypting the private keys in a standardized manner as per Ethereum's security practices. These functionalities collectively contribute to a robust and secure approach to managing accounts within the Thor ecosystem. - -[KeystoreSnippet](examples/accounts/keystore.ts) diff --git a/docs/templates/address.md b/docs/templates/address.md deleted file mode 100644 index 20aed918e..000000000 --- a/docs/templates/address.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -description: Overview of vechain-sdk-core Address class. ---- - -# Address class - -This class handles all address related operations: - -* Address derivation (from the private and public key) -* Address checking -* Address ERC55 Checksum - -# Diagram - -```mermaid -graph TD -; - A[vechain-sdk-core] --> B[Address class]; - B -->|Derivation| C[From Private Key]; - C --- D[From Public Key]; - B -->|Checksum| E[ERC55]; - B -->|Validation| F[Is valid address]; -``` - -# Example - -## Address Derivation - -Here we have a simple example of address derivation: -[AddressDerivationSnippet](examples/address/address-derivation.ts) - -## Address Validation - -Here we have a simple example of address validation: -[AddressValidationSnippet](examples/address/address-validation.ts) - -## Address Checksum - -Here we have a simple example of address ERC55 checksum: -[AddressERC55ChecksumSnippet](examples/address/address-erc55-checksum.ts) diff --git a/docs/templates/architecture.md b/docs/templates/architecture.md deleted file mode 100644 index 2fb572806..000000000 --- a/docs/templates/architecture.md +++ /dev/null @@ -1,41 +0,0 @@ -# Architecture - -The chapter is designed to provide a high-level understanding of the VeChain SDK architecture and structure. -Comprehensive diagrams, following the C4 model, are available for reference in the project's [GitHub repository](https://github.com/vechain/vechain-sdk-js/tree/main/docs/diagrams/architecture). - -## Introduction - -Basically the `vechain-sdk` is a monorepo divided into different packages: - -- **Core Package** -- **Error Package** -- **Network Package** -- **Hardhat Plugin Package** -- **Logging Package** -- **RPC Proxy Package** - - -Each of these packages has its own responsibility and is described in the following chapters. - -### Core Package -The core package is the core functionality responsible package of the vechain-sdk. -It is responsible for all core functionality of the vechain-sdk. - -### Error Package -The error package is the error handling responsible package of the vechain-sdk. -It is responsible for all error handling of the vechain-sdk. - -### Network Package -The network package is the network interaction responsible package of the vechain-sdk. -It is responsible for all interactions with the blockchain. - -### Hardhat Plugin Package -Seamlessly integrate the VeChain SDK with Hardhat, the Ethereum development environment. -This plugin provides a bridge between the VeChain SDK and the Ethereum ecosystem, enabling you to leverage the best of both worlds. - -### Logging Package -The logging package provides a simple and easy-to-use logging system for the VeChain SDK. -This module is dedicated to managing and customizing logs within the SDK, ensuring your development experience remains transparent and insightful. - -### RPC Proxy Package -This package is designed to bridge the gap between Thor's RESTful API and Ethereum's JSON-RPC. \ No newline at end of file diff --git a/docs/templates/bloom-filter.md b/docs/templates/bloom-filter.md deleted file mode 100644 index c032dbf2d..000000000 --- a/docs/templates/bloom-filter.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -description: Handling of the bloom filter data structure. ---- - -# Bloom Filter - -## What is the bloom filter data structure? - -This data structure was first introduced by Burton H. Bloom in 1970 and has since found extensive utilisation in various domains due to its ability to drastically reduce the need for expensive storage and computational resources. The bloom filter achieves this by representing the set membership information in a compact manner, thereby significantly reducing the memory footprint required to store the set elements. - -The bloom filter remains a valuable and widely employed data structure for optimising set membership queries in scenarios where approximate answers are acceptable, and the preservation of storage and computational resources is of paramount importance. Its versatility and effectiveness makes it an indispensable tool in modern computer science and information technology applications. - -## How is the bloom filter used in VeChainThor? - -The VeChainThor blockchain implements the bloom filters as an integral part of its architecture to enhance the management and processing of addresses and block numbers within the ledger. By incorporating bloom filters, VeChainThor optimises the efficiency of address and block lookup operations, thereby streamlining data retrieval processes and enhancing overall system performance. - -The primary purpose of the bloom filter is to efficiently determine the presence or absence of a specific address or block number within the blockchain ledger. If a query is made to ascertain the existence of an address or block number, the bloom filter promptly provides a response, indicating whether the queried element is not present in the ledger. This response is guaranteed to be accurate in such cases. - -However, when the bloom filter indicates that the queried element is potentially present in the ledger, a higher level of assurance is required due to the probabilistic nature of the data structure. In these scenarios, a subsequent search operation is performed or other relevant operations are executed to further verify the presence or absence of the element with a significantly high degree of confidence. - -It is important to emphasise that the bloom filter's design is intentionally engineered to prioritise query efficiency and conserve computational resources. Consequently, the potential for false positives exists, implying that in certain instances, the filter may indicate the presence of an element that is, in reality, absent from the ledger. However, these occurrences are carefully managed by selecting appropriate parameters and monitoring the trade-off between accuracy and resource optimisation. - -## The impact of bloom filter - -By employing bloom filters in this manner, the VeChainThor blockchain significantly reduces the computational burden associated with address and block lookup operations, resulting in improved responsiveness and heightened scalability. This, in turn, positively impacts the overall user experience and facilitates seamless integration with various applications and services built on the blockchain platform. - -[BloomSnippet](examples/bloom/bloom.ts) \ No newline at end of file diff --git a/docs/templates/certificates.md b/docs/templates/certificates.md deleted file mode 100644 index b24211917..000000000 --- a/docs/templates/certificates.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -description: Certificate related functions. ---- - -# Certificates - -In the VeChainThor blockchain, a certificate is a data structure used for client-side self-signed certificates. -It plays a crucial role in providing a mechanism for secure identification and validation of data. -For example, when signing in to a Dapp, users typically need to sign a certificate as part of the authentication process. -This certificate serves as cryptographic proof of their identity and authorization. -Users use their private keys to sign the certificate, demonstrating their ownership and enabling secure access to the Dapp's services. - -## Purpose of Certificates - -Certificates are primarily used for purposes like attestation, validation, and verification of data authenticity. -They are used as proofs of authenticity and origin for data exchanged within the VeChain ecosystem. - -## Structure of a Certificate - -A Certificate in the VeChainThor blockchain typically consists of the following components: - -1. **Purpose**: The purpose field indicates the intended use or context of the certificate. - For example, it could be used for identification, verification, or attestation. -2. **Payload**: The payload field holds the actual content of the certificate. - This content can be of various types, such as text, images, or other data. -3. **Domain**: The domain field represents the specific context or domain for which the certificate is valid. - It helps ensure that the certificate is only applicable within the intended context. -4. **Timestamp**: The timestamp field records the time at which the certificate was created or issued. - This provides a temporal reference for the certificate's validity. -5. **Signer**: The signer field indicates the address of the entity that signs the certificate. - It is the public key address of the entity that issues the certificate. -6. **Signature**: The signature field contains the cryptographic signature generated by the issuer's private key. - This signature ensures the integrity and authenticity of the certificate's content. - -## Usage of Certificates - -Certificates are used in various scenarios within the VeChainThor blockchain, including: - -* **Proof of Authenticity**: Certificates can be used to prove the authenticity and origin of data, ensuring that the data has not been tampered with or altered. -* **Identification**: Certificates can be employed to establish the identity of a specific entity or participant within the blockchain ecosystem. -* **Verification**: Certificates can be used to verify the validity of data or transactions, providing a mechanism for trust and validation. - -## Self-Signed Certificates - -It's important to note that certificates in the VeChainThor blockchain are self-signed, which means that they are issued and signed by the same entity or user. The signature from the issuer's private key serves as proof of the certificate's authenticity. - -[SignVerifySnippet](examples/certificates/sign_verify.ts) diff --git a/docs/templates/contracts-deposit.md b/docs/templates/contracts-deposit.md deleted file mode 100644 index af7664343..000000000 --- a/docs/templates/contracts-deposit.md +++ /dev/null @@ -1,25 +0,0 @@ -# Deposit Contract - -This example illustrates the deployment of a deposit contract, executing a deposit transaction, and querying the balance associated with a specific address. - -## Contract Deployment and Interaction - -The main deployment steps are as follows: - -1. **Contract Factory Creation**: A contract factory is instantiated using the `ThorClient`, the contract's ABI, its bytecode, and the deployer's private key. -2. **Contract Deployment**: The contract is deployed to the VeChain blockchain. The deployment process is asynchronous and awaits confirmation. -3. **Deposit Transaction**: A deposit transaction is initiated by calling the `deposit` function of the deployed contract with a specified value (1000 Wei in this case). The value is the amount of VET sent with the transaction. This transaction is also asynchronous and awaits confirmation. -4. **Balance Query**: The balance of the deployer address is queried using the `getBalance` function of the contract. - - -## Example - -[DepositContractSnippet](examples/contracts/contract-deposit.ts) - - - -## Conclusion - -This snippet serves as a practical guide for developers looking to understand the deployment and interaction with smart contracts on the VeChain blockchain, specifically focusing on deposit transactions and balance queries. - - diff --git a/docs/templates/contracts-erc20.md b/docs/templates/contracts-erc20.md deleted file mode 100644 index fcee01080..000000000 --- a/docs/templates/contracts-erc20.md +++ /dev/null @@ -1,57 +0,0 @@ -# Create a sample ERC20 token - -### Overview -The ERC20 token standard is widely used for creating and issuing smart contracts on Ethereum blockchain. Vechain, being compatible with Ethereum's EVM, allows for the implementation of ERC20 tokens on its platform. This provides the benefits of VeChain's features, such as improved scalability and lower transaction costs, while maintaining the familiar ERC20 interface. - -### Example - -The VeChain SDK allows to create a sample ERC20 token with a few lines of code. The example below shows how to create a sample ERC20 token with the name "SampleToken" and symbol "ST" with a total supply of 1000000000000000000000000. - -#### Compile the contract - -The first step is to compile the contract using a solidity compiler. In this example we will compile an ERC20 token contract based on the OpenZeppelin ERC20 implementation. The contract is the following one: - -The bytecode and the ABI have been obtained by compiling the following contract: - -```solidity -pragma solidity ^0.8.20; - -import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; - -contract SampleToken is ERC20 { - constructor() ERC20("SampleToken", "ST") { - _mint(msg.sender, 1000000 * (10 ** uint256(decimals()))); - } -} -``` - -#### Deploy the contract - -Once the contract is compiled, we can deploy it using the VeChain SDK. The following code shows how to deploy the contract: - - -[CreateERC20TokenSnippet](examples/contracts/contract-create-ERC20-token.ts) - - -#### Transfer tokens to another address - -Once the contract is deployed, we can transfer tokens to another address using the VeChain SDK. The following code shows how to transfer 10000 token smallest unit to another address: - -[ERC20FunctionCallSnippet](examples/contracts/contract-transfer-ERC20-token.ts) - - -#### Filter the Transfer event - -In blockchain and smart contract contexts, events are significant occurrences or state changes within a contract that are emitted (or logged) for external systems and interfaces to detect and act upon. These events provide a way to signal to external entities that something of note has occurred within the contract, without requiring constant monitoring of the contract's state. They are especially useful in decentralized applications (dApps) for triggering updates in the UI in response to contract state changes. - -The Transfer event is a common event found in token contracts, especially those following standards like ERC-20 or ERC-721. It signifies the transfer of tokens from one address to another and typically includes information such as the sender's address, the recipient's address, and the amount transferred. - -Filtering events allows applications to listen for specific occurrences within a contract rather than polling the contract's state continually. This is both efficient and effective for staying updated with relevant contract interactions. - - - -For instance, once an ERC20 token contract is deployed, we can filter the Transfer events using the x1x\ SDK. The following code shows the filtering of a transfer event for a specific receiver address - -[ERC20FilterEventSnippet](examples/contracts/contract-event-filter.ts) - -We are transferring tokens from the deployer address to another address. We can filter the Transfer event to get the transfer details by passing the receiver address (to restrict the event logs to a specific receiver). The filter parameters depend on the event signature and the indexed parameters of the event. In this example, the Transfer event has two indexed parameters, `from` and `to`. We are filtering the event logs by passing the `to` address. \ No newline at end of file diff --git a/docs/templates/contracts.md b/docs/templates/contracts.md deleted file mode 100644 index 76b5a70f5..000000000 --- a/docs/templates/contracts.md +++ /dev/null @@ -1,75 +0,0 @@ -# VeChain Contracts Interaction - -The following sections provide detailed information on interacting with VeChain smart contracts using the VeChain SDK. - -## Building clauses - - -VeChain uses clauses to interact with smart contracts. A clause is a single operation that can be executed on the blockchain. The VeChain SDK provides a `ClauseBuilder` class to create clauses for various operations. - - - -> ⚠️ **Warning:** -> To execute the clauses, you need to build a transaction and sign it with a wallet. The signed transaction can then be sent to the blockchain. This process is covered ahead in the documentation. - -### Transfer VET and VTHO clauses - -The following example shows you how to build clauses to transfer the two main token of VeChain, the token VET and the energy token VTHO (the one used to pay for transaction fees) - -[example](examples/contracts/contract-clauses.ts) - -### Deploying a Smart Contract Clause - -#### Steps: - -1. **Clause Construction**: Use `clauseBuilder.deployContract` from `@vechain/sdk-core` to construct a deployment clause. -2. **Smart Contract Bytecode**: Pass the compiled contract's bytecode to deploy it. -3. **Clause Building**: create the deployment clause - -[ContractDeploySnippet](examples/contracts/contract-deploy.ts) - -### Calling a Contract Function Clause - -### Steps: - -1. **Understand the ABI**: The ABI (JSON format) defines contract functions and parameters. -2. **Clause Creation**: Use `clauseBuilder.functionInteraction` to create a clause for function calls. -3. **Clause Building**: Build the clause, e.g., calling `setValue(123)` to modify the contract state. - -[ContractFunctionCallSnippet](examples/contracts/contract-function-call.ts) - - -or you can load the contract using the thor client and then you can build the clause using the contract object. - -[ContractObjectFunctionCallSnippet](examples/contracts/contract-function-call.ts) - - -## Multi-Clause Contract Interaction - -Now that we have seen how to build clauses, let's see how to send it to the blockchain. VeChain allows multiple clauses in a single transaction, enabling interactions with multiple contracts or operations. - -### Multiple Clauses in a Single Transaction - -In the following example we will see how to execute multiple read operations to get information regarding a deployed ERC20 token contract. - -[ERC20MultiClausesReadSnippet](examples/contracts/contract-create-ERC20-token.ts) - -> ⚠️ **Warning:** -> The example above shows a multi clause read call. It's also possible to execute multi clause transactions with the method executeMultipleClausesTransaction, but you need to build a signer first. Please refer to the signer section for more information - - -## Commenting Contract Invocations - -Add comments to operations when using wallets, helping users understand transaction details during signing. - -[TransferCommentSnippet](examples/contracts/contract-transfer-ERC20-token.ts) - -## Specifying Revisions in Read Functions - -You can specify revisions (`best` or `finalized`) for read functions, similar to adding comments. - -## Delegating a Contract Call - -VeChain supports delegated contract calls where fees are paid by the delegator. - -[ERC20FunctionCallDelegatedSnippet](examples/contracts/contract-delegation-ERC20.ts) diff --git a/docs/templates/cryptography.md b/docs/templates/cryptography.md deleted file mode 100644 index 7ea6f1806..000000000 --- a/docs/templates/cryptography.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: Main cryptography related functions. ---- - -# Cryptography - -## Hash functions - -Hash functions are algorithms that take input data of differing size as an input, and it produces a fixed-size output. -The output of a hash function is typically represented as a sequence of numbers and letters. Hash functions are commonly used in computer science for various purposes, such as ensuring data integrity, securing storing passwords, and creating unique identifiers for data. - -vechain sdk supports _blake2b256 and _keccak256 hash functions. - -### Blake2b256 - -Blake2b256 is a specific type of hash function known for its speed and security. It takes any input data and generates a 256-bit (32-byte) hash value. The _blake2b256 part refers to the specific design of the algorithm, and the 256 indicates the length of the resulting hash code. Blake2b256 is widely used in cryptographic applications, blockchain technologies, and secure data storage. - -[Blake2b256Snippet](examples/cryptography/blake2b256.ts) - -### Keccak256 - -Keccak256 is another type of hash function, and it's particularly well-known for its use in the blockchain world, specifically in cryptocurrencies like Ethereum. Similar to Blake2b256, Keccak256 also takes input data and generates a 256-bit (32-byte) hash value. The Keccak part refers to the family of algorithms, and again, 256 denotes the length of the output hash code. - -[Keccak256Snippet](examples/cryptography/keccak256.ts) - -## Public key cryptography - -vechain sdk uses Secp256k1 to handle public key cryptography. - -Secp256k1 is a specific elliptic curve used in public key cryptography. It is defined by the standard organization "Standards for Efficient Cryptography Group" (SECG) and is particularly well-known for its use in cryptocurrencies, most notably Bitcoin. - -Secp256k1 is mainly used for generating public and private key pairs in cryptographic systems. It is a critical component in securing blockchain networks and other applications where digital signatures and secure transactions are required. The security of Secp256k1 is based on the difficulty of solving certain mathematical problems related to elliptic curves, making it highly resistant to attacks. - -* **Key Generation**: In Secp256k1, the public and private keys are mathematically related. The private key is a randomly generated 256-bit (32-byte) integer, while the public key is derived from the private key using the elliptic curve multiplication operation defined by the Secp256k1 curve. This process ensures that the public key can be calculated from the private key, but it is computationally infeasible to deduce the private key from the public key. -* **Digital Signatures**: An essential feature of Secp256k1 is generating and verifying digital signatures, public key cryptography. To sign a message, the private key holder performs a mathematical operation involving the message and the private key to produce a signature. The signature, along with the original message, can be publicly verified using the corresponding public key. This process ensures the authenticity and integrity of the message without revealing the private key. -* **Security Considerations**: The security of Secp256k1 relies on the difficulty of the elliptic curve discrete logarithm problem. Breaking this problem requires an impractical amount of computational power, making Secp256k1 a secure choice for cryptographic applications, including blockchain networks. - -[Secp256k1Snippet](examples/cryptography/secp256k1.ts) diff --git a/docs/templates/debug.md b/docs/templates/debug.md deleted file mode 100644 index 938face96..000000000 --- a/docs/templates/debug.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -description: Thor debug functionalities. ---- - -# Debug - -The [DebugModule](../packages/network/src/thor-client/debug/debug-module.ts) -class encapsulates functionality to debug the VeChainThor blockchain. - -The module provides methods to interact with the debug end points provided by - -* [**Retrieve Storage Range**](#retrieve-storage-range) - https://testnet.vechain.org/doc/swagger-ui/#/Debug/post_debug_storage_range -* [**Trace Contract Call**](#trace-contract-call) - https://testnet.vechain.org/doc/swagger-ui/#/Debug/post_debug_tracers_call -* [**Trace Transaction Clause**](#trace-transaction-clause) - https://testnet.vechain.org/doc/swagger-ui/#/Debug/post_debug_tracers - -## Retrieve Storage Range - -The `retrieveStorageRange` method provides information about the storage range of an account, -including the nextKey which is a string that can be null, and storage which is an object. - -In this example the `thorClient` connects to the *testnet* to retrieve the storage range for the coordinates passed -as `input` parameter. - -[DebugRetrieveStorageRangeSnippet](examples/debug/debug-retrieve-storage-range.ts) - -
-The result will show the storage. - -```json -{ - storage: { - '0x004f6609cc5d569ecfdbd606d943edc5d83a893186f2942aef5e133e356ed17c': { - key: '0x9a92ca715ec8529b3ee4dbefd75e142176b92c3d93701808be4e36296718a5f3', - value: '0x000000000000000000000000000000000000046ff5af2138c51ba45a80000000' - }, - '0x0065bf3c383c7f05733ee6567e3a1201970bb5f4288d1bdb6d894167f8fc68dd': { - key: '0xf3dfa1b3c541595cd415aef361e508553fc80af15b3e2e0d9a4e2408f2111ed8', - value: '0xfffffffffffffffffffffffffffffffffffffffffffffe280bc404dc5470db3e' - }, - '0x01783f86c9e29f37f3277ed5abb62353ef8baf304337e511f1b5edefc9756b23': { - key: '0x01cfb1f8b52bdbeb1178ba8fc499479815330143d1acddb9c9d5686cd596ec24', - value: '0x0000000000000000000000000000000000000010000000000000000000000000' - }, - '0x0195180093382541d5396e797bd49250b1664fe8db68ff5c1d53ca95046f4549': { - key: '0x3f4626c77582db20d0d690ce3ad9bfde8f9dd508c0212a187684678bd9dc397a', - value: '0x000000000000000000000000000000000000000082eed4d8eb7286de6e540000' - }, - '0x02631b1c9d1e3f1360c4c6ee00ea48161dc85a0e153a0a484429bbcef16e581e': { - key: '0xc5e3f1ff368ddfee94124549ec19d8a50547b5cb0cc55ba72188b7159fb3ab3f', - value: '0x00000000000000000000000000000000000000000052b7d2dcc80cd2e4000000' - }, - '0x038658243306b2d07b512b04e6ddd4d70c49fd93969d71d51b0af7cf779d1c8f': { - key: '0x87b232cdb2002f97b61df380acf088f13e5006543d63780567aa2b886c6a1a90', - value: '0x00000000000000000000000000000000000000000052b7cd7100aea580f00000' - }, - '0x03969104d4e5233e212c939a85ef26b8156e2fbb0485d6d751c677e854e9ba55': { - key: '0xa887493a2b531915738a065a24263abae3722b9a8928a96c14c1f52a05964f23', - value: '0x00000000000000000000000000000000000000000000003635c9adc5dea00000' - }, - '0x04379cd040e82a999f53dba26500b68e4dd783b2039d723fe9e06edecfc8c9f1': { - key: '0x831ade39167b84e87f89fd4cd0bcec5783d2281fe44d2bc6cb93daaff46d569e', - value: '0x000000000000000000000000000000000000000000002a1b4ae1206dd9bd0000' - }, - '0x0465f4b6f9fccdb2ad6f4eac8aa7731bfe4c78f6cf22f397b5ef10398d4d5771': { - key: '0x5d56afd38de44f293bdce388b7d98120f55971a0f3a608797f1ddaced0f2b047', - value: '0x00000000000000000000000000000000000000000052b7c8053950781de00000' - }, - '0x04af8500fb85efaaa5f171ef60708fc306c474011fabb6fbafcb626f09661a01': { - key: '0x136aee904ebcade77dc8d3c6e48a2365b1d9dff83f78eb90d2f6e5ef4a6466c6', - value: '0x000000000000000000000000008ca1a3b5cbedeb0f1a0900000080845b322ac0' - } - }, - nextKey: '0x04e9569439bd218fce594dbd705b41f2afe6b6d8abcb9c5aaa5b1a52b7ab7cea' -} -``` -
- -## Trace Contract Call - -The `traceContractCall` traces the contract call execution. - -In this example the `thorClient` connects to the *testnet* to trace the contract at the coordinates specified in -the `input` parameter. - -[DebugTraceContractCallSnippet](examples/debug/debug-trace-contract-call.ts) - -
-The result shows the trace, here only the first element is shown. - -```json -{ - gas: 0, - failed: false, - returnValue: '0000000000000000000000000000000000000000000000000000000000000001', - structLogs: [ - { - pc: 0, - op: 'PUSH1', - gas: 50000000, - gasCost: 3, - depth: 1, - stack: [] - } - ] -} -``` -
- -## Trace Transaction Clause - -The `traceTransactionClause` method trace the transactions specified in the clause at the -coordinates expressed in the `input` parameter. - -In this example the `thorClient` connects to the *testnet* to trace the clause at the coordinates specified in -the `input` parameter. - -[DebugTraceTransactionClauseSnippet](examples/debug/debug-trace-transaction-clause.ts) - -
-The result shows the following. - -```json -{ - from: '0x105199a26b10e55300cb71b46c5b5e867b7df427', - gas: '0x8b92', - gasUsed: '0x50fa', - to: '0xaa854565401724f7061e0c366ca132c87c1e5f60', - input: '0xf14fcbc800d770b9faa11ba944366f3e7a14c166f780ece542e557e0b7fe4870fcbe8dbe', - value: '0x0', - type: 'CALL' -} -``` -
\ No newline at end of file diff --git a/docs/templates/encoding.md b/docs/templates/encoding.md deleted file mode 100644 index 3a5c7d65d..000000000 --- a/docs/templates/encoding.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -description: Transaction and contract encoding ---- - -# Encoding - -Vechain SDK extends its support to handle both Application Binary Interface (ABI) and Recursive Length Prefix (RLP) encoding. - -## ABI - -Vechain SDK provides functionality to interact with smart contracts on the VeChainThor blockchain using ABI's. An ABI is a standardised interface format that defines the method signatures, input parameters, and output types of smart contract functions. With VeChain SDK, developers can conveniently encode and decode data for interacting with smart contracts, making it easier to call contract functions and process their results. - -[AbiSnippet](examples/encoding/abi.ts) - -## Contract - -The contract interface is used to provide a higher level of abstraction to allow direct interaction with a smart contract. To create a contract interface is necessary to have a compatible smart contract ABI.VeChain SDK provides a full implementation of the Contract interface as well as some methods to encode directly a specific ABI item of the smart contract (until now only function and event ABIs are supported). Encoding and decoding are based on the ABI one. - -[ContractSnippet](examples/encoding/contract.ts) - -## RLP Encoding - -RLP is a serialisation technique used on the VeChainThor blockchain. It is used to efficiently encode and decode data structures for storage and transmission on the blockchain.VeChain SDK includes dedicated methods for RLP encoding and decoding, enabling developers to handle data serialization and deserialization with ease. - -By supporting ABI and RLP encoding handling, VeChainSDK equips developers with the necessary tools to interact with smart contracts and handle data efficiently on the VeChainThor blockchain. This further enhances the library's capabilities and contributes to the seamless development of decentralised applications on the platform. - -[RlpSnippet](examples/encoding/rlp.ts) diff --git a/docs/templates/events.md b/docs/templates/events.md deleted file mode 100644 index 229b9be86..000000000 --- a/docs/templates/events.md +++ /dev/null @@ -1,25 +0,0 @@ -# Events - -The VeChain SDK allows querying the blockchain for events emitted by smart contracts. - -## Filtering a single Transfer Event - -With the VeChain SDK the contract object could be used also for filtering events emitted from the contract. It is also possible to specify some filtering options (range, result limit, etc) - -Following an example on how to listen to a Transfer Event: - -[ERC20FilterEventSnippet](examples/contracts/contract-event-filter.ts) - - -## Multi-Clause Event Filtering - -Filter events from different contracts in a single call using contract addresses and event signatures. - -[ERC20FilterMultipleEventCriteriaSnippet](examples/contracts/contract-event-filter.ts) - -### Grouping Events by Topic Hash - -Use `filterGroupedEventLogs` to group events by topic hash, useful for categorizing events. The result is an array of arrays, one for each criterion. - -[ERC20FilterGroupedMultipleEventCriteriaSnippet](examples/contracts/contract-event-filter.ts) - diff --git a/docs/templates/evm-extension.md b/docs/templates/evm-extension.md deleted file mode 100644 index be8450ace..000000000 --- a/docs/templates/evm-extension.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -description: EVM Extension ---- - -The VeChainThor Extension Contracts are a collection of Solidity smart contracts tailored for utilization on the VeChainThor blockchain platform. VeChainThor, a blockchain ecosystem emphasizing enterprise solutions and decentralized applications (dApps), benefits from these contracts to extend the Ethereum Virtual Machine (EVM) global functions, thereby enhancing blockchain interaction capabilities. - -## Purpose - -The primary objective of these contracts is to provide developers with streamlined access to critical blockchain functionalities specific to the VeChainThor network. They serve as a bridge between smart contracts deployed on VeChainThor and the underlying blockchain infrastructure. By encapsulating native operations within accessible Solidity functions, these contracts simplify the development process for decentralized applications and smart contracts on the platform. - -## Features - -The Extension Contracts offer a comprehensive set of functions covering essential blockchain operations: - - - Retrieval of block-specific details, including block ID, total score, time, and signer address. - - Access to transaction information, such as transaction ID, block reference, and expiration time. - - Querying the total supply of tokens and proven work for transactions. - -## Example - -[EVMExtensionSnippet](examples/evm-extension/evm-extension.ts) \ No newline at end of file diff --git a/docs/templates/javascript.md b/docs/templates/javascript.md deleted file mode 100644 index de1a81307..000000000 --- a/docs/templates/javascript.md +++ /dev/null @@ -1,58 +0,0 @@ -# How to Use the VeChain SDK with JavaScript - -The [VeChain SDK](https://github.com/vechain/vechain-sdk-js) can be used with both TypeScript and JavaScript. Although TypeScript is recommended for its type safety and enhanced development experience, you can also use the SDK with JavaScript. - -## Installation - -To install the core package of the VeChain SDK, run: -``` bash -npm install @vechain/sdk-core -``` - -## Usage - -Here’s an example of how to use the SDK in your JavaScript code: - -``` javascript -const { Hex, _blake2b256 } = require('@vechain/sdk-core'); - -// Input of the hash function (it can be a string or a Uint8Array) -const toHash = 'hello world'; - -const hash = _blake2b256(toHash); - -console.log(Hex.of(hash)); // Outputs: 256c83b297114d201b30179f3f0ef0cace9783622da5974326b436178aeef610 -``` - -## Differences Between TypeScript and JavaScript - -When using the SDK in TypeScript vs. JavaScript, there are a few key differences: - - Imports: - - In TypeScript, you use import statements: - ``` typescript - import { Hex, _blake2b256 } from '@vechain/sdk-core'; - ``` - - In JavaScript, you use require statements: - ``` javascript - const { Hex, _blake2b256 } = require('@vechain/sdk-core'); - ``` - - Type Annotations: - - TypeScript uses types to provide compile-time checks and better code completion. - ``` typescript - import { Hex, _blake2b256, type HashInput } from '@vechain/sdk-core'; - import { expect } from 'expect'; - - const toHash: HashInput = 'hello world'; - const hash = _blake2b256(toHash); - - console.log(Hex.of(hash)); - ``` - - JavaScript does not use types. If you see TypeScript examples, you can remove all type annotations to convert them to JavaScript. - ``` javascript - const { Hex, _blake2b256 } = require('@vechain/sdk-core'); - - const toHash = 'hello world'; - const hash = _blake2b256(toHash); - - console.log(Hex.of(hash)); - ``` diff --git a/docs/templates/polls.md b/docs/templates/polls.md deleted file mode 100644 index 0b71d9952..000000000 --- a/docs/templates/polls.md +++ /dev/null @@ -1,27 +0,0 @@ -# Polling Mechanisms - -## Synchronous Polling - -Synchronous polling mechanisms are implemented to await the fulfillment of specific conditions. Upon the satisfaction of these conditions, the polling process yields the result of the given condition. - -### Monitoring for a New Block Production -This section illustrates the methodology for monitoring the production of a new block. Utilizing synchronous polling, the waitUntil function is employed to efficiently wait for the production of a new block. - -[example](examples/polls/sync-poll-wait-new-block.ts) - -### Observing Balance Changes Post-Transfer -Here, we explore the approach to monitor balance changes after a transfer. Synchronous polling leverages the waitUntil function to detect balance changes following a transfer. - -[example](examples/polls/sync-poll-wait-balance-update.ts) - -## Asynchronous Polling - -Asynchronous polling is utilized for waiting in a non-blocking manner until a specific condition is met or to capture certain events. This type of polling makes use of the Event Emitter pattern, providing notifications when the specified condition or event has been met or emitted. - -### Implementing a Simple Async Poll in a DAPP -This example demonstrates the application of an asynchronous poll for tracking transaction events, allowing for the execution of additional operations concurrently. - -[example](examples/polls/event-poll-dapp.ts) - - - diff --git a/docs/templates/provider.md b/docs/templates/provider.md deleted file mode 100644 index 49e72a3db..000000000 --- a/docs/templates/provider.md +++ /dev/null @@ -1,61 +0,0 @@ -# Provider - -## Overview - -The VeChain Provider is a powerful tool designed to interact with the VeChain blockchain seamlessly. This documentation outlines the features, usage, and configuration of the VeChain Provider and its companion, the Hardhat Provider. - -## VeChain Provider - -The VeChain Provider is our core provider, offering direct interaction with the VeChain blockchain. It extends EventEmitter and implements EIP1193ProviderMessage for efficient event handling and message passing. - -### Features - - - Seamless interaction with the VeChain blockchain. - - Event handling capabilities using EventEmitter. - - Implementation of EIP1193ProviderMessage for standardized message communication. - -### Usage - -To use the VeChain Provider in your project, follow these steps: - - Import the provider in your code: - ``` bash - import { VeChainProvider } from '@vechain/sdk-network'; - ``` - - Initialize the provider: - ``` bash - const provider = new VeChainProvider(thorClient, wallet); - ``` - - Start interacting with the VeChain blockchain using the available methods provided by the VeChainProvider. - -Example: -[VeChainProviderSnippet](examples/provider/vechain-provider.ts) - -## HardHat Provider - -The Hardhat Provider is a wrapper around the core VeChain Provider specifically designed for Hardhat integration. It simplifies the process of using the VeChain Provider within a Hardhat environment. - -### Features - - - Wrapper around the core VeChain Provider. - - Simplified integration with Hardhat projects. - -### Usage - -To use the Hardhat Provider in your project, follow these steps: - - Import the provider in your code: - ``` bash - import { HardhatVeChainProvider } from '@vechain/sdk-network'; - ``` - - Initialize the provider: - ``` bash - const provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - testnetUrl, - (message: string, parent?: Error) => new Error(message, parent) - ); - ``` - - Start interacting with the VeChain blockchain using the available methods provided by the HardhatVeChainProvider. - -Example: - -[VechainHardhatProviderSnippet](examples/provider/vechain-hardhat-provider.ts) \ No newline at end of file diff --git a/docs/templates/subscriptions.md b/docs/templates/subscriptions.md deleted file mode 100644 index 79c8a3222..000000000 --- a/docs/templates/subscriptions.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: Subscriptions URLs ---- - -# Subscriptions - -## Getting Started with Subscriptions - -The subscriptions module of the VeChain sdk provides various endpoints for subscribing to different types of blockchain data, including blocks, events, and transfers. These subscriptions are useful for real-time monitoring of blockchain activities. -To use the subscription endpoints, import the `subscriptions`` object from the VeChain sdk. You can then call various methods on this object to create WebSocket URLs for different types of subscriptions. - -### Smart contract event subscription - -Subscribe to specific contract events through the `subscriptions.getEventSubscriptionUrl`. You can filter events based on contract address and topics. - -[example](examples/subscriptions/event-subscriptions.ts) - -This example demonstrates how to create a WebSocket URL for subscribing to swap events of a specific contract. - -The VeChain sdk also provides other subscription endpoints for subscribing to different types of blockchain data. These include: - -### Block subscription - -Subscribe to new blocks as they are added to the blockchain through the `subscriptions.getBlockSubscriptionUrl` method. - -[example](examples/subscriptions/block-subscriptions.ts) - -### Other subscriptions - -The VeChain sdk also provides other subscription endpoints for subscribing to different types of blockchain data. These include: -- `subscriptions.getVETtransfersSubscriptionUrl` for subscribing to VET transfers -- `subscriptions.getNewTransactionsSubscriptionUrl` for subscribing to new transactions -- `subscriptions.getBeatSubscriptionUrl` for subscribing to new blockchain beats (A beat is a notification that a new block has been added to the blockchain with a bloom filter which can be used to check if the block contains any relevant account.) -- `subscriptions.getLegacyBeatSubscriptionUrl` for subscribing to the legacy beats. diff --git a/docs/templates/thor-client.md b/docs/templates/thor-client.md deleted file mode 100644 index d25d09bca..000000000 --- a/docs/templates/thor-client.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -description: Thor-client ---- - -# Thor-client - -The Thor-client serves as an interface to interact with the VeChainThor blockchain. This client streamlines the interaction with the blockchain by providing a set of methods specifically tailored to retrieve information from various endpoints. By encapsulating the intricacies of the underlying communication with the VeChainThor network, developers can easily integrate this client into their applications. Whether fetching details about specific blocks, querying transaction information, or accessing other blockchain-related data, the thor-client simplifies the process, enabling efficient and straightforward integration with the VeChainThor network through RESTful API calls. - -## Initialization - -To initialize a Thor client, there are two straightforward methods. The first involves creating an HTTP client with the desired network URL, then passing it to ThorClient. Alternatively, the ThorClient can be directly initialized from the network URL. The choice between them depends on whether you prefer a two-step setup with explicit HTTP client configuration or a more concise, one-step initialization. - -[InitializingThorClientSnippet](examples/thor-client/initialize.ts) - -## Accounts - -The Thor-client extends its functionality to provide seamless access to account-related information on the VeChainThor network. The following code exemplifies how developers can utilize the Thor-client to interact with accounts: - -[AccountsSnippet](examples/thor-client/accounts.ts) - -In this example, the code initializes a Thor client for the VeChainThor testnet network and demonstrates three crucial methods for interacting with accounts: - - - `getAccount(address: string, options?: AccountInputOptions): Promise` - -Retrieves details of a specific account based on its address. The provided code fetches details for the account with the address '0x5034aa590125b64023a0262112b98d72e3c8e40e'. - - - `getBytecode(address: string, options?: AccountInputOptions): Promise` - -Fetches the bytecode of the smart contract associated with the given account address. - - - `getStorageAt(address: string, position: string, options?: AccountInputOptions): Promise` - -Retrieves the value stored at a specific key in the storage of the smart contract associated with the given account address. - -These methods showcase how Thor-client simplifies the process of obtaining account-related information, providing developers with efficient means to integrate VeChainThor blockchain data into their applications. - -## Blocks - -The Thor-client facilitates easy interaction with blocks on the VeChainThor network, as demonstrated in the following code snippet: - -[BlocksSnippet](examples/thor-client/blocks.ts) - -In this example, the code initializes a Thor client for the VeChainThor testnet network and showcases three essential methods for interacting with blocks: - - - `getBlockCompressed(revision: string | number): Promise` - -Retrieves details of a specific block based on its height. In the provided code, it fetches details for the block at height 1. - - - `getBestBlockExpanded(): Promise` - -Fetches details of the latest block on the VeChainThor network, representing the best-known block. - - - `getFinalBlockExpanded(): Promise` - -Retrieves details of the finalized block, which is the latest block confirmed by the network consensus. - -These methods demonstrate how the Thor-client simplifies the process of fetching block-related information, providing developers with straightforward ways to integrate VeChainThor blockchain data into their applications. - -## Logs - -The Thor-client extends its capabilities to efficiently filter and retrieve event logs and transfer logs on the VeChainThor network. The following code exemplifies how developers can use the Thor-client to filter event logs and transfer logs: - -[LogsSnippet](examples/thor-client/logs.ts) - -In this example, the code initializes a Thor client for the VeChainThor testnet network and demonstrates two essential methods for interacting with logs: - - - `filterGroupedEventLogs( - filterOptions: FilterEventLogsOptions - ): Promise` - -The `filterGroupedEventLogs` method simplifies the process of retrieving event logs from the VeChainThor network. Developers can set criteria for the block range, apply pagination options, and define filters based on specific addresses and topics. The result is an array of event logs that match the specified criteria. - - - `filterTransferLogs( - filterOptions: FilterTransferLogsOptions - ): Promise` - -The `filterTransferLogs` method provides a streamlined way to retrieve transfer logs from the VeChainThor network. Developers can define criteria, including the block range, pagination options, and filters for transaction origin, sender, and recipient. The method returns an array of transfer logs that meet the specified criteria. - -## Nodes - -The Thor-client allows developers to interact with nodes on the VeChainThor network, providing information about connected peers. The following code demonstrates how to use the Thor-client to retrieve connected peers of a node: - -[NodesSnippet](examples/thor-client/nodes.ts) - -In this example, the code initializes a Thor client for the VeChainThor testnet network and utilizes the `getNodes` method to retrieve information about connected peers. - - - `getNodes(): Promise` - -The `getNodes` method simplifies the process of obtaining details about connected peers of a node in the VeChainThor network. The method returns information about the connected peers, allowing developers to monitor and analyze the network's node connectivity. - -## Transactions - -Thor-client provides methods for developers to interact with transactions on the VeChainThor network, allowing retrieval of transaction details and transaction receipts. The following code illustrates how to use the Thor-client to fetch information about a specific transaction: - -[TransactionsSnippet](examples/thor-client/transactions.ts) - -In this example, the code initializes a Thor client for the VeChainThor testnet network and showcases three essential methods for interacting with transactions: - - - `sendTransaction(signedTx: Transaction): Promise` - -The `sendTransaction` method enables developers to broadcast a raw transaction to the VeChainThor network. This method is crucial for initiating new transactions and executing smart contract functions. - - - `getTransaction( - id: string, - options?: GetTransactionInputOptions - ): Promise` - -The `getTransaction` method facilitates the retrieval of detailed information about a specific transaction on the VeChainThor network. Developers can use this method to access data such as the sender, recipient, amount, and other transaction details. - - - `getTransactionReceipt( - id: string, - options?: GetTransactionReceiptInputOptions - ): Promise` - -The `getTransactionReceipt` method allows developers to retrieve the receipt of a specific transaction on the VeChainThor network. This includes information such as the transaction status, block number, and gas used. - -### Fee Delegation - -Fee delegation is a feature on the VeChainThor blockchain which enables the transaction sender to request another entity, a sponsor, to pay for the transaction fee on the sender's behalf. Fee delegation greatly improves the user experience, especially in the case of onboarding new users by removing the necessity of the user having to first acquire cryptocurrency assets before being able to interact on-chain. - -The following code demonstrates how to use Thor-client with the fee delegation feature: - -[DelegatedTransactionsSnippet](examples/thor-client/delegated-transactions.ts) - -## Gas - -The `GasModule` in Thor-client is designed to handle gas-related operations on the VeChainThor blockchain. Gas is a crucial aspect of executing transactions on the blockchain, representing the computational and storage resources consumed during transaction processing. This module provides convenient methods for estimating the gas cost of a transaction, allowing developers to optimize their interactions with the VeChainThor network. - -### gasPadding - -The `gasPadding` option adds a safety margin to estimated gas costs. It allows developers to specify a percentage increase in gas estimation to account for potential variations or complexities in transaction execution. This helps ensure transaction success by providing extra resources while managing costs effectively. - -[GasSnippet](examples/thor-client/gas.ts) \ No newline at end of file diff --git a/docs/templates/transactions.md b/docs/templates/transactions.md deleted file mode 100644 index 44873a724..000000000 --- a/docs/templates/transactions.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -description: Transactions related functions. ---- - -# Transactions - -The VeChain SDK provides comprehensive support for handling transactions. Developers can initialize a transaction by assembling the transaction body, adding clauses, and finally signing and sending the transaction. - -> ⚠️ **Warning:** -> All the examples listed below refer to low level transaction building. The VeChain SDK provides built-in methods to sign and send transactions. Please refer to the contracts section for more information. - - -To break it down: - -1. **Initializing a Transaction**: Developers can create a transaction by specifying the necessary details in the transaction body. This includes setting the chain tag, block reference, expiration, gas price coefficient, gas limit, and other relevant transaction parameters. -2. **Adding Clauses**: Clauses are the individual actions that the transaction will perform on the VeChainThor blockchain. Each clause contains information such as the recipient's address, the amount of VET to be transferred, and additional data, if required. -3. **Signing the Transaction**: After assembling the transaction body with the appropriate clauses, developers can sign the transaction using their private key. Signing the transaction ensures its authenticity and prevents tampering during transmission. - -## Example: Signing and Decoding -In this example a simple transaction with a single clause is created, signed, encoded and then decoded - -[SignDecodeSnippet](examples/transactions/sign-decode.ts) - -## Example: Multiple Clauses -On the VeChainThor blockchain a transaction can be composed of multiple clauses. \ -Clauses are a feature of the VeChainThor blockchain that increase the scalability of the blockchain by enabling the sending of multiple payloads to different recipients within a single transaction. - -[MultipleClausesSnippet](examples/transactions/multiple-clauses.ts) - -## Example: Fee Delegation -Fee delegation is a feature on the VeChainThor blockchain which enables the transaction sender to request another entity, a sponsor, to pay for the transaction fee on the sender's behalf. - -[FeeDelegationSnippet](examples/transactions/fee-delegation.ts) - -## Example: BlockRef and Expiration -Using the _BlockRef_ and _Expiration_ fields a transaction can be set to be processed or expired by a particular block. _BlockRef_ should match the first eight bytes of the ID of the block. The sum of _BlockRef_ and _Expiration_ defines the height of the last block that the transaction can be included. - -[BlockrefExpirationSnippet](examples/transactions/blockref-expiration.ts) - -## Example: Transaction Dependency -A transaction can be set to only be processed after another transaction, therefore defining an execution order for transactions. The _DependsOn_ field is the Id of the transaction on which the current transaction depends on. If the transaction does not depend on others _DependsOn_ can be set to _null_ - -[TxDependencySnippet](examples/transactions/tx-dependency.ts) - -## Example: Transaction Simulation -Simulation can be used to check if a transaction will fail before sending it. It can also be used to determine the gas cost of the transaction. -Additional fields are needed in the transaction object for the simulation and these conform to the _SimulateTransactionOptions_ interface. -Note - the result of a transaction might be different depending on the state(block) you are executing against. - -[SimulationSnippet](examples/transactions/simulation.ts) - -## Complete examples -In the following complete examples, we will explore the entire lifecycle of a VeChainThor transaction, from building clauses to verifying the transaction on-chain. - -1. **No Delegation (Signing Only with an Origin Private Key)**: In this scenario, we'll demonstrate the basic process of creating a transaction, signing it with the origin private key, and sending it to the VeChainThor blockchain without involving fee delegation. - -[FullFlowNoDelegatorSnippet](examples/transactions/full-flow-no-delegator.ts) - -2. **Delegation with Private Key**: Here, we'll extend the previous example by incorporating fee delegation. The transaction sender will delegate the transaction fee payment to another entity (delegator), and we'll guide you through the steps of building, signing, and sending such a transaction. - -[FullFlowDelegatorPrivateKeySnippet](examples/transactions/full-flow-delegator-private-key.ts) - -3. **Delegation with URL**: This example will showcase the use of a delegation URL for fee delegation. The sender will specify a delegation URL in the `signTransaction` options, allowing a designated sponsor to pay the transaction fee. We'll cover the full process, from building clauses to verifying the transaction on-chain. - -[FullFlowDelegatorUrlSnippet](examples/transactions/full-flow-delegator-url.ts) - -By examining these complete examples, developers can gain a comprehensive understanding of transaction handling in the VeChain SDK. Each example demonstrates the steps involved in initiating, signing, and sending transactions, as well as the nuances associated with fee delegation. - -# Errors handling on transactions -You can find the transaction revert reason by using `getRevertReason` method with the transaction hash. - -[RevertReasonSnippet](examples/transactions/revert-reason.ts) - -This method will return the revert reason of the transaction if it failed, otherwise it will return `null`. - -### Decoding revert reason when simulating a transaction -Even when using the `simulateTransaction` method you can find the revert reason. - -[RevertReasonSimulationSnippet](examples/transactions/revert-reason-with-simulation.ts) - -In this case there is only a `TransactionSimulationResult`, so no need to loop. \ No newline at end of file diff --git a/docs/thor-client.md b/docs/thor-client.md deleted file mode 100644 index dfafe49f1..000000000 --- a/docs/thor-client.md +++ /dev/null @@ -1,472 +0,0 @@ ---- -description: Thor-client ---- - -# Thor-client - -The Thor-client serves as an interface to interact with the VeChainThor blockchain. This client streamlines the interaction with the blockchain by providing a set of methods specifically tailored to retrieve information from various endpoints. By encapsulating the intricacies of the underlying communication with the VeChainThor network, developers can easily integrate this client into their applications. Whether fetching details about specific blocks, querying transaction information, or accessing other blockchain-related data, the thor-client simplifies the process, enabling efficient and straightforward integration with the VeChainThor network through RESTful API calls. - -## Initialization - -To initialize a Thor client, there are two straightforward methods. The first involves creating an HTTP client with the desired network URL, then passing it to ThorClient. Alternatively, the ThorClient can be directly initialized from the network URL. The choice between them depends on whether you prefer a two-step setup with explicit HTTP client configuration or a more concise, one-step initialization. - -```typescript { name=initialize, category=example } -// First way to initialize thor client -const httpClient = new SimpleHttpClient(TESTNET_URL); -const thorClient = new ThorClient(httpClient); - -// Second way to initialize thor client -const thorClient2 = ThorClient.at(TESTNET_URL); -``` - -## Accounts - -The Thor-client extends its functionality to provide seamless access to account-related information on the VeChainThor network. The following code exemplifies how developers can utilize the Thor-client to interact with accounts: - -```typescript { name=accounts, category=example } -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Get account details - -const accountAddress = Address.of('0x5034aa590125b64023a0262112b98d72e3c8e40e'); - -// Account details -const accountDetails = await thorClient.accounts.getAccount(accountAddress); - -// Account code -const accountCode = await thorClient.accounts.getBytecode(accountAddress); - -// Get account storage -const position = ThorId.of(1); -const accountStorage = await thorClient.accounts.getStorageAt( - accountAddress, - position -); -``` - -In this example, the code initializes a Thor client for the VeChainThor testnet network and demonstrates three crucial methods for interacting with accounts: - - - `getAccount(address: string, options?: AccountInputOptions): Promise` - -Retrieves details of a specific account based on its address. The provided code fetches details for the account with the address '0x5034aa590125b64023a0262112b98d72e3c8e40e'. - - - `getBytecode(address: string, options?: AccountInputOptions): Promise` - -Fetches the bytecode of the smart contract associated with the given account address. - - - `getStorageAt(address: string, position: string, options?: AccountInputOptions): Promise` - -Retrieves the value stored at a specific key in the storage of the smart contract associated with the given account address. - -These methods showcase how Thor-client simplifies the process of obtaining account-related information, providing developers with efficient means to integrate VeChainThor blockchain data into their applications. - -## Blocks - -The Thor-client facilitates easy interaction with blocks on the VeChainThor network, as demonstrated in the following code snippet: - -```typescript { name=blocks, category=example } -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Get block details - -// Details of block -const blockDetails = await thorClient.blocks.getBlockCompressed(1); - -// 3 - Get best block details - -const bestBlockDetails = await thorClient.blocks.getBestBlockExpanded(); -expect(bestBlockDetails).toBeDefined(); - -// 4 - Get finalizes block details - -const finalBlockDetails = await thorClient.blocks.getFinalBlockExpanded(); -``` - -In this example, the code initializes a Thor client for the VeChainThor testnet network and showcases three essential methods for interacting with blocks: - - - `getBlockCompressed(revision: string | number): Promise` - -Retrieves details of a specific block based on its height. In the provided code, it fetches details for the block at height 1. - - - `getBestBlockExpanded(): Promise` - -Fetches details of the latest block on the VeChainThor network, representing the best-known block. - - - `getFinalBlockExpanded(): Promise` - -Retrieves details of the finalized block, which is the latest block confirmed by the network consensus. - -These methods demonstrate how the Thor-client simplifies the process of fetching block-related information, providing developers with straightforward ways to integrate VeChainThor blockchain data into their applications. - -## Logs - -The Thor-client extends its capabilities to efficiently filter and retrieve event logs and transfer logs on the VeChainThor network. The following code exemplifies how developers can use the Thor-client to filter event logs and transfer logs: - -```typescript { name=logs, category=example } -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Filter event logs based on the provided criteria. (EXAMPLE 1) - -const eventLogs = await thorClient.logs.filterRawEventLogs({ - // Specify the range of blocks to search for events - range: { - unit: 'block', - from: 0, - to: 100000 - }, - // Additional options for the query, such as offset and limit - options: { - offset: 0, - limit: 3 - }, - // Define criteria for filtering events - criteriaSet: [ - { - // Contract address to filter events - address: '0x0000000000000000000000000000456E65726779', - // Topics to further narrow down the search - topic0: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - topic1: '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - } - ], - // Specify the order in which logs should be retrieved (ascending in this case) - order: 'asc' -}); - -// 3 - Filter again event logs based on the provided criteria. (EXAMPLE 2) - -const transferLogs = await thorClient.logs.filterTransferLogs({ - // Specify the range of blocks to search for transfer events - range: { - unit: 'block', - from: 0, - to: 100000 - }, - // Additional options for the query, such as offset and limit - options: { - offset: 0, - limit: 3 - }, - // Define criteria for filtering transfer events - criteriaSet: [ - { - // Transaction origin, sender, and recipient addresses to filter transfer events - txOrigin: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d', - sender: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d', - recipient: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' - } - ], - // Specify the order in which transfer logs should be retrieved (ascending in this case) - order: 'asc' -}); -``` - -In this example, the code initializes a Thor client for the VeChainThor testnet network and demonstrates two essential methods for interacting with logs: - - - `filterGroupedEventLogs( - filterOptions: FilterEventLogsOptions - ): Promise` - -The `filterGroupedEventLogs` method simplifies the process of retrieving event logs from the VeChainThor network. Developers can set criteria for the block range, apply pagination options, and define filters based on specific addresses and topics. The result is an array of event logs that match the specified criteria. - - - `filterTransferLogs( - filterOptions: FilterTransferLogsOptions - ): Promise` - -The `filterTransferLogs` method provides a streamlined way to retrieve transfer logs from the VeChainThor network. Developers can define criteria, including the block range, pagination options, and filters for transaction origin, sender, and recipient. The method returns an array of transfer logs that meet the specified criteria. - -## Nodes - -The Thor-client allows developers to interact with nodes on the VeChainThor network, providing information about connected peers. The following code demonstrates how to use the Thor-client to retrieve connected peers of a node: - -```typescript { name=nodes, category=example } -// 1 - Create thor client for testnet - -const thorClient = ThorClient.at(TESTNET_URL); - -// 2 - Retrieves connected peers of a node - -const peerNodes = await thorClient.nodes.getNodes(); -``` - -In this example, the code initializes a Thor client for the VeChainThor testnet network and utilizes the `getNodes` method to retrieve information about connected peers. - - - `getNodes(): Promise` - -The `getNodes` method simplifies the process of obtaining details about connected peers of a node in the VeChainThor network. The method returns information about the connected peers, allowing developers to monitor and analyze the network's node connectivity. - -## Transactions - -Thor-client provides methods for developers to interact with transactions on the VeChainThor network, allowing retrieval of transaction details and transaction receipts. The following code illustrates how to use the Thor-client to fetch information about a specific transaction: - -```typescript { name=transactions, category=example } -// Sender account with private key -const senderAccount = { - privateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5', - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4' -}; - -// 1 - Create thor client for solo network - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2 - Get latest block - -const latestBlock = await thorSoloClient.blocks.getBestBlockCompressed(); - -// 3 - Create clauses - -const clauses = [ - Clause.transferVET( - Address.of('0x9e7911de289c3c856ce7f421034f66b6cde49c39'), - VET.of(10000) - ) -]; - -// Get gas estimate -const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - senderAccount.address -); - -// 4 - Create transaction - -const transactionBody = { - chainTag: 0xf6, - blockRef: latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678 -}; - -// 5 - Normal signature (NO delegation) - -const rawNormalSigned = Transaction.of(transactionBody).sign( - HexUInt.of(senderAccount.privateKey).bytes -).encoded; - -// 6 - Send transaction - -const send = await thorSoloClient.transactions.sendRawTransaction( - HexUInt.of(rawNormalSigned).toString() -); -expect(send).toBeDefined(); -expect(send).toHaveProperty('id'); -expect(HexUInt.isValid0x(send.id)).toBe(true); - -// 7 - Get transaction details and receipt - -const transactionDetails = await thorSoloClient.transactions.getTransaction( - send.id -); -const transactionReceipt = - await thorSoloClient.transactions.getTransactionReceipt(send.id); -``` - -In this example, the code initializes a Thor client for the VeChainThor testnet network and showcases three essential methods for interacting with transactions: - - - `sendTransaction(signedTx: Transaction): Promise` - -The `sendTransaction` method enables developers to broadcast a raw transaction to the VeChainThor network. This method is crucial for initiating new transactions and executing smart contract functions. - - - `getTransaction( - id: string, - options?: GetTransactionInputOptions - ): Promise` - -The `getTransaction` method facilitates the retrieval of detailed information about a specific transaction on the VeChainThor network. Developers can use this method to access data such as the sender, recipient, amount, and other transaction details. - - - `getTransactionReceipt( - id: string, - options?: GetTransactionReceiptInputOptions - ): Promise` - -The `getTransactionReceipt` method allows developers to retrieve the receipt of a specific transaction on the VeChainThor network. This includes information such as the transaction status, block number, and gas used. - -### Fee Delegation - -Fee delegation is a feature on the VeChainThor blockchain which enables the transaction sender to request another entity, a sponsor, to pay for the transaction fee on the sender's behalf. Fee delegation greatly improves the user experience, especially in the case of onboarding new users by removing the necessity of the user having to first acquire cryptocurrency assets before being able to interact on-chain. - -The following code demonstrates how to use Thor-client with the fee delegation feature: - -```typescript { name=delegated-transactions, category=example } -// Sender account with private key -const senderAccount = { - privateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5', - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4' -}; - -/** Delegate account with private key - * @NOTE The delegate account must have enough VET and VTHO to pay for the gas - */ -const delegateAccount = { - privateKey: - '432f38bcf338c374523e83fdb2ebe1030aba63c7f1e81f7d76c5f53f4d42e766', - address: '0x88b2551c3ed42ca663796c10ce68c88a65f73fe2' -}; - -// 1 - Create thor client for solo network - -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2 - Get latest block - -const latestBlock = await thorSoloClient.blocks.getBestBlockCompressed(); - -// 3 - Create transaction clauses - -const clauses = [ - Clause.transferVET( - Address.of('0x9e7911de289c3c856ce7f421034f66b6cde49c39'), - VET.of('10000') - ) as TransactionClause -]; - -// Get gas estimate -const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - senderAccount.address -); - -// 4 - Create delegated transaction - -const delegatedTransactionBody = { - chainTag: 0xf6, - blockRef: latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678, - reserved: { - features: 1 - } -}; - -// 5 - Normal signature and delegation signature - -const rawDelegatedSigned = Transaction.of( - delegatedTransactionBody -).signAsSenderAndGasPayer( - HexUInt.of(senderAccount.privateKey).bytes, - HexUInt.of(delegateAccount.privateKey).bytes -).encoded; - -// 6 - Send transaction - -const send = await thorSoloClient.transactions.sendRawTransaction( - HexUInt.of(rawDelegatedSigned).toString() -); -expect(send).toBeDefined(); -expect(send).toHaveProperty('id'); -expect(HexUInt.isValid0x(send.id)).toBe(true); - -// 7 - Get transaction details and receipt - -// Details of transaction -const transactionDetails = await thorSoloClient.transactions.getTransaction( - send.id -); - -// Receipt of transaction -const transactionReceipt = - await thorSoloClient.transactions.getTransactionReceipt(send.id); -``` - -## Gas - -The `GasModule` in Thor-client is designed to handle gas-related operations on the VeChainThor blockchain. Gas is a crucial aspect of executing transactions on the blockchain, representing the computational and storage resources consumed during transaction processing. This module provides convenient methods for estimating the gas cost of a transaction, allowing developers to optimize their interactions with the VeChainThor network. - -### gasPadding - -The `gasPadding` option adds a safety margin to estimated gas costs. It allows developers to specify a percentage increase in gas estimation to account for potential variations or complexities in transaction execution. This helps ensure transaction success by providing extra resources while managing costs effectively. - -```typescript { name=gas, category=example } -// 1 - Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2- Init transaction - -// 2.1 - Get latest block -const latestBlock = await thorSoloClient.blocks.getBestBlockCompressed(); - -// 2.2 - Transaction sender and receiver -const senderAccount = { - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4', - privateKey: HexUInt.of( - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - ).bytes -}; - -const receiverAccount = { - address: '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - privateKey: HexUInt.of( - '1758771c54938e977518e4ff1c297aca882f6598891df503030734532efa790e' - ).bytes -}; - -// 2 - Create transaction clauses and compute gas -const clauses = [ - { - to: receiverAccount.address, - value: 1000000, - data: '0x' - } -]; - -// Options to use gasPadding -const options = { - gasPadding: 0.2 // 20% -}; - -// Estimate gas -const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - senderAccount.address, - options -); - -// 4 - Create transaction - -const transactionBody = { - chainTag: networkInfo.solo.chainTag, - blockRef: latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678 -}; - -// 5 - Sign transaction -const rawNormalSigned = Transaction.of(transactionBody).sign( - senderAccount.privateKey -).encoded; - -// 6 - Send transaction - -const send = await thorSoloClient.transactions.sendRawTransaction( - HexUInt.of(rawNormalSigned).toString() -); - -// 7 - Get transaction details and receipt - -const transactionDetails = await thorSoloClient.transactions.getTransaction( - send.id -); -const transactionReceipt = - await thorSoloClient.transactions.getTransactionReceipt(send.id); -``` diff --git a/docs/transactions.md b/docs/transactions.md deleted file mode 100644 index a4360ecc9..000000000 --- a/docs/transactions.md +++ /dev/null @@ -1,699 +0,0 @@ ---- -description: Transactions related functions. ---- - -# Transactions - -The VeChain SDK provides comprehensive support for handling transactions. Developers can initialize a transaction by assembling the transaction body, adding clauses, and finally signing and sending the transaction. - -> ⚠️ **Warning:** -> All the examples listed below refer to low level transaction building. The VeChain SDK provides built-in methods to sign and send transactions. Please refer to the contracts section for more information. - - -To break it down: - -1. **Initializing a Transaction**: Developers can create a transaction by specifying the necessary details in the transaction body. This includes setting the chain tag, block reference, expiration, gas price coefficient, gas limit, and other relevant transaction parameters. -2. **Adding Clauses**: Clauses are the individual actions that the transaction will perform on the VeChainThor blockchain. Each clause contains information such as the recipient's address, the amount of VET to be transferred, and additional data, if required. -3. **Signing the Transaction**: After assembling the transaction body with the appropriate clauses, developers can sign the transaction using their private key. Signing the transaction ensures its authenticity and prevents tampering during transmission. - -## Example: Signing and Decoding -In this example a simple transaction with a single clause is created, signed, encoded and then decoded - -```typescript { name=sign-decode, category=example } -// 1 - Define clauses - -const clauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(10000) - ) as TransactionClause -]; - -// 2 - Calculate intrinsic gas of clauses - -const gas = HexUInt.of(Transaction.intrinsicGas(clauses).wei).toString(); - -// 3 - Body of transaction - -const body: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses, - gasPriceCoef: 128, - gas, - dependsOn: null, - nonce: 12345678 -}; - -// Create private key -const privateKey = await Secp256k1.generatePrivateKey(); - -// 4 - Sign transaction - -const signedTransaction = Transaction.of(body).sign(privateKey); - -// 5 - Encode transaction - -const encodedRaw = signedTransaction.encoded; - -// 6 - Decode transaction - -const decodedTx = Transaction.decode(encodedRaw, true); -``` - -## Example: Multiple Clauses -On the VeChainThor blockchain a transaction can be composed of multiple clauses. \ -Clauses are a feature of the VeChainThor blockchain that increase the scalability of the blockchain by enabling the sending of multiple payloads to different recipients within a single transaction. - -```typescript { name=multiple-clauses, category=example } -// 1 - Define multiple clauses - -const clauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(10000) - ) as TransactionClause, - Clause.transferToken( - Address.of(VTHO_ADDRESS), - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VTHO.of(10000) - ) as TransactionClause -]; - -// 2 - Calculate intrinsic gas of both clauses - -const gas = Number(Transaction.intrinsicGas(clauses).wei); - -// 3 - Body of transaction - -const body: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 32, - clauses, - gasPriceCoef: 0, - gas, - dependsOn: null, - nonce: 12345678 -}; - -// Create private key -const privateKey = await Secp256k1.generatePrivateKey(); - -// 4 - Sign transaction - -const signedTransaction = Transaction.of(body).sign(privateKey); - -// 5 - Encode transaction - -const encodedRaw = signedTransaction.encoded; - -// 6 - Decode transaction - -const decodedTx = Transaction.decode(encodedRaw, true); -``` - -## Example: Fee Delegation -Fee delegation is a feature on the VeChainThor blockchain which enables the transaction sender to request another entity, a sponsor, to pay for the transaction fee on the sender's behalf. - -```typescript { name=fee-delegation, category=example } -// Sender account with private key -const senderAccount = { - privateKey: - 'f9fc826b63a35413541d92d2bfb6661128cd5075fcdca583446d20c59994ba26', - address: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' -}; - -// 1 - Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL, { - isPollingEnabled: false -}); - -// 2 - Define clause and estimate gas - -const clauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(10000) - ) as TransactionClause -]; - -// Get gas estimate -const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - senderAccount.address -); - -// 3 - Define transaction body - -const body: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses, - gasPriceCoef: 0, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 1, - reserved: { - features: 1 // set the transaction to be delegated - } -}; - -// 4 - Create private keys of sender and delegate - -const nodeDelegate = HDKey.fromMnemonic(Mnemonic.of()); -const delegatorPrivateKey = nodeDelegate.privateKey; - -// 5 - Get address of delegate - -const delegatorAddress = Address.ofPublicKey(nodeDelegate.publicKey).toString(); - -// 6 - Sign transaction as sender and delegate - -const signedTransaction = Transaction.of(body).signAsSenderAndGasPayer( - HexUInt.of(senderAccount.privateKey).bytes, - HexUInt.of(delegatorPrivateKey).bytes -); - -// 7 - Encode transaction - -const encodedRaw = signedTransaction.encoded; - -// 8 - Decode transaction and check - -const decodedTx = Transaction.decode(encodedRaw, true); -``` - -## Example: BlockRef and Expiration -Using the _BlockRef_ and _Expiration_ fields a transaction can be set to be processed or expired by a particular block. _BlockRef_ should match the first eight bytes of the ID of the block. The sum of _BlockRef_ and _Expiration_ defines the height of the last block that the transaction can be included. - -```typescript { name=blockref-expiration, category=example } -// 1 - Define clauses - -const clauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(1000) - ) as TransactionClause -]; - -// 2 - Define transaction body - -const body: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x00ffecb8ac3142c4', // first 8 bytes of block id from block #16772280 - expiration: 32, // tx will expire after block #16772280 + 32 - clauses, - gasPriceCoef: 0, - gas: HexUInt.of(Transaction.intrinsicGas(clauses).wei).toString(), // use thor.gas.estimateGas() for better estimation - dependsOn: null, - nonce: 1 -}; - -// 3 - Create private key - -const privateKey = await Secp256k1.generatePrivateKey(); - -// 4 - Sign transaction - -const signedTransaction = Transaction.of(body).sign(privateKey); - -// 5 - Encode transaction - -const encodedRaw = signedTransaction.encoded; - -// 6 - Decode transaction and check - -const decodedTx = Transaction.decode(encodedRaw, true); -``` - -## Example: Transaction Dependency -A transaction can be set to only be processed after another transaction, therefore defining an execution order for transactions. The _DependsOn_ field is the Id of the transaction on which the current transaction depends on. If the transaction does not depend on others _DependsOn_ can be set to _null_ - -```typescript { name=tx-dependency, category=example } -// 1 - Define transaction clauses - -const txAClauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(1000) - ) as TransactionClause -]; -const txBClauses: TransactionClause[] = [ - Clause.transferVET( - Address.of('0x7ccadeea14dd6727845b58f8aa7aad0f41a002a2'), - VET.of(1) - ) -]; - -// 2 - Define transaction A with no dependencies - -// @NOTE: This transaction has nonce = 1 -const txABody: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses: txAClauses, - gasPriceCoef: 0, - gas: HexUInt.of(Transaction.intrinsicGas(txAClauses).wei).toString(), // use thor.gas.estimateGas() for better estimation - dependsOn: null, - nonce: 1 -}; - -// 3 - Define transaction B with nonce = 2 - -// @NOTE: at the moment dependsOn is null -const txBBody: TransactionBody = { - chainTag: networkInfo.mainnet.chainTag, - blockRef: '0x0000000000000000', - expiration: 0, - clauses: txBClauses, - gasPriceCoef: 0, - gas: HexUInt.of(Transaction.intrinsicGas(txBClauses).wei).toString(), // use thor.gas.estimateGas() for better estimation - dependsOn: null, - nonce: 2 -}; - -// Define the senders private key -const senderPrivateKey = await Secp256k1.generatePrivateKey(); - -// To define transaction B as dependent on transaction -// it's necessary to sign transaction A, and then get its Id -// and set that Id into transaction B's dependsOn field - -// 4 - Get Tx A id - -const txASigned = Transaction.of(txABody).sign(senderPrivateKey); - -// 5 - Set it inside tx B - -txBBody.dependsOn = txASigned.id.toString(); - -// 6 - Sign Tx B - -const txBSigned = Transaction.of(txBBody).sign(senderPrivateKey); - -// 7 - encode Tx B - -const rawTxB = txBSigned.encoded; - -// Check (we can decode Tx B) -const decodedTx = Transaction.decode(rawTxB, true); -``` - -## Example: Transaction Simulation -Simulation can be used to check if a transaction will fail before sending it. It can also be used to determine the gas cost of the transaction. -Additional fields are needed in the transaction object for the simulation and these conform to the _SimulateTransactionOptions_ interface. -Note - the result of a transaction might be different depending on the state(block) you are executing against. - -```typescript { name=simulation, category=example } -// In this example we simulate a transaction of sending 1 VET to another account -// And we demonstrate (1) how we can check the expected gas cost and (2) whether the transaction is successful - -// 1 - Create thor client for solo network -const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - -// 2(a) - create the transaction for a VET transfer -const transaction1 = { - clauses: [ - Clause.transferVET( - Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a'), - VET.of(1) - ) as TransactionClause - ], - // Please note - this field one of the optional fields that may be passed (see SimulateTransactionOptions), - // and is only required if you want to simulate a transaction - simulateTransactionOptions: { - caller: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' - } -}; - -// 3 - Simulate the transaction -const simulatedTx1 = await thorSoloClient.transactions.simulateTransaction( - transaction1.clauses, - { - ...transaction1.simulateTransactionOptions - } -); - -// In this next example we simulate a Simulate smart contract deployment -// And we demonstrate how we can check the expected gas cost and whether the transaction would succeed - -// 1(a) - create the transaction to simulate a smart deployment -const transaction2 = { - clauses: [ - { - to: null, - value: '0', - /** - * Sample contract bytecode (Without constructor arguments) - * - * @remarks - When deploying a contract that requires constructor arguments, the encoded constructor must be appended to the bytecode - * Otherwise the contract might revert if the constructor arguments are required. - */ - data: '0x60806040526040518060400160405280600681526020017f48656c6c6f210000000000000000000000000000000000000000000000000000815250600090816200004a9190620002d9565b503480156200005857600080fd5b50620003c0565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620000e157607f821691505b602082108103620000f757620000f662000099565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001617fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000122565b6200016d868362000122565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620001ba620001b4620001ae8462000185565b6200018f565b62000185565b9050919050565b6000819050919050565b620001d68362000199565b620001ee620001e582620001c1565b8484546200012f565b825550505050565b600090565b62000205620001f6565b62000212818484620001cb565b505050565b5b818110156200023a576200022e600082620001fb565b60018101905062000218565b5050565b601f82111562000289576200025381620000fd565b6200025e8462000112565b810160208510156200026e578190505b620002866200027d8562000112565b83018262000217565b50505b505050565b600082821c905092915050565b6000620002ae600019846008026200028e565b1980831691505092915050565b6000620002c983836200029b565b9150826002028217905092915050565b620002e4826200005f565b67ffffffffffffffff8111156200030057620002ff6200006a565b5b6200030c8254620000c8565b620003198282856200023e565b600060209050601f8311600181146200035157600084156200033c578287015190505b620003488582620002bb565b865550620003b8565b601f1984166200036186620000fd565b60005b828110156200038b5784890151825560018201915060208501945060208101905062000364565b86831015620003ab5784890151620003a7601f8916826200029b565b8355505b6001600288020188555050505b505050505050565b61081480620003d06000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631718ad881461004657806319ff1d211461007657806349da5de414610094575b600080fd5b610060600480360381019061005b91906102c1565b6100b0565b60405161006d919061037e565b60405180910390f35b61007e6101b5565b60405161008b919061037e565b60405180910390f35b6100ae60048036038101906100a99190610405565b610243565b005b606081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610122576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101199061049e565b60405180910390fd5b6000805461012f906104ed565b80601f016020809104026020016040519081016040528092919081815260200182805461015b906104ed565b80156101a85780601f1061017d576101008083540402835291602001916101a8565b820191906000526020600020905b81548152906001019060200180831161018b57829003601f168201915b5050505050915050919050565b600080546101c2906104ed565b80601f01602080910402602001604051908101604052809291908181526020018280546101ee906104ed565b801561023b5780601f106102105761010080835404028352916020019161023b565b820191906000526020600020905b81548152906001019060200180831161021e57829003601f168201915b505050505081565b81816000918261025492919061070e565b505050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061028e82610263565b9050919050565b61029e81610283565b81146102a957600080fd5b50565b6000813590506102bb81610295565b92915050565b6000602082840312156102d7576102d6610259565b5b60006102e5848285016102ac565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561032857808201518184015260208101905061030d565b60008484015250505050565b6000601f19601f8301169050919050565b6000610350826102ee565b61035a81856102f9565b935061036a81856020860161030a565b61037381610334565b840191505092915050565b600060208201905081810360008301526103988184610345565b905092915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126103c5576103c46103a0565b5b8235905067ffffffffffffffff8111156103e2576103e16103a5565b5b6020830191508360018202830111156103fe576103fd6103aa565b5b9250929050565b6000806020838503121561041c5761041b610259565b5b600083013567ffffffffffffffff81111561043a5761043961025e565b5b610446858286016103af565b92509250509250929050565b7f496e76616c696420616464726573730000000000000000000000000000000000600082015250565b6000610488600f836102f9565b915061049382610452565b602082019050919050565b600060208201905081810360008301526104b78161047b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061050557607f821691505b602082108103610518576105176104be565b5b50919050565b600082905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026105ba7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261057d565b6105c4868361057d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061060b610606610601846105dc565b6105e6565b6105dc565b9050919050565b6000819050919050565b610625836105f0565b61063961063182610612565b84845461058a565b825550505050565b600090565b61064e610641565b61065981848461061c565b505050565b5b8181101561067d57610672600082610646565b60018101905061065f565b5050565b601f8211156106c25761069381610558565b61069c8461056d565b810160208510156106ab578190505b6106bf6106b78561056d565b83018261065e565b50505b505050565b600082821c905092915050565b60006106e5600019846008026106c7565b1980831691505092915050565b60006106fe83836106d4565b9150826002028217905092915050565b610718838361051e565b67ffffffffffffffff81111561073157610730610529565b5b61073b82546104ed565b610746828285610681565b6000601f8311600181146107755760008415610763578287013590505b61076d85826106f2565b8655506107d5565b601f19841661078386610558565b60005b828110156107ab57848901358255600182019150602085019450602081019050610786565b868310156107c857848901356107c4601f8916826106d4565b8355505b6001600288020188555050505b5050505050505056fea2646970667358221220131b1aac58b5047d715ef4f6d1b050c9a836905c50de69cf41edc485446e5f5f64736f6c63430008110033' - } - ] -}; - -// 2 - Simulate the transaction -const simulatedTx2 = await thorSoloClient.transactions.simulateTransaction( - transaction2.clauses -); -``` - -## Complete examples -In the following complete examples, we will explore the entire lifecycle of a VeChainThor transaction, from building clauses to verifying the transaction on-chain. - -1. **No Delegation (Signing Only with an Origin Private Key)**: In this scenario, we'll demonstrate the basic process of creating a transaction, signing it with the origin private key, and sending it to the VeChainThor blockchain without involving fee delegation. - -```typescript { name=full-flow-no-delegator, category=example } -// 1 - Create the thor client -const thorSoloClient = ThorClient.at(THOR_SOLO_URL, { - isPollingEnabled: false -}); - -// Sender account with private key -const senderAccount: { privateKey: string; address: string } = { - privateKey: - 'f9fc826b63a35413541d92d2bfb6661128cd5075fcdca583446d20c59994ba26', - address: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' -}; - -// Create the provider (used in this case to sign the transaction with getSigner() method) -const provider = new VeChainProvider( - // Thor client used by the provider - thorSoloClient, - - // Internal wallet used by the provider (needed to call the getSigner() method) - new ProviderInternalBaseWallet([ - { - privateKey: HexUInt.of(senderAccount.privateKey).bytes, - address: senderAccount.address - } - ]), - - // Disable fee delegation (BY DEFAULT IT IS DISABLED) - false -); - -// 2 - Create the transaction clauses -const transaction = { - clauses: [ - Clause.transferVET( - Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a'), - VET.of(1) - ) as TransactionClause - ], - simulateTransactionOptions: { - caller: senderAccount.address - } -}; - -// 3 - Estimate gas -const gasResult = await thorSoloClient.gas.estimateGas( - transaction.clauses, - transaction.simulateTransactionOptions.caller -); - -// 4 - Build transaction body -const txBody = await thorSoloClient.transactions.buildTransactionBody( - transaction.clauses, - gasResult.totalGas -); - -// 4 - Sign the transaction -const signer = await provider.getSigner(senderAccount.address); - -const rawSignedTransaction = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - senderAccount.address - ) -); - -const signedTransaction = Transaction.decode( - HexUInt.of(rawSignedTransaction.slice(2)).bytes, - true -); - -// 5 - Send the transaction -const sendTransactionResult = - await thorSoloClient.transactions.sendTransaction(signedTransaction); - -// 6 - Wait for transaction receipt -const txReceipt = await thorSoloClient.transactions.waitForTransaction( - sendTransactionResult.id -); -``` - -2. **Delegation with Private Key**: Here, we'll extend the previous example by incorporating fee delegation. The transaction sender will delegate the transaction fee payment to another entity (delegator), and we'll guide you through the steps of building, signing, and sending such a transaction. - -```typescript { name=full-flow-delegator-private-key, category=example } -// 1 - Create the thor client -const thorSoloClient = ThorClient.at(THOR_SOLO_URL, { - isPollingEnabled: false -}); - -// Sender account with private key -const senderAccount: { privateKey: string; address: string } = { - privateKey: - 'f9fc826b63a35413541d92d2bfb6661128cd5075fcdca583446d20c59994ba26', - address: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' -}; - -// Delegator account with private key -const delegatorAccount: { privateKey: string; address: string } = { - privateKey: - '521b7793c6eb27d137b617627c6b85d57c0aa303380e9ca4e30a30302fbc6676', - address: '0x062F167A905C1484DE7e75B88EDC7439f82117DE' -}; - -// Create the provider (used in this case to sign the transaction with getSigner() method) -const providerWithDelegationEnabled = new VeChainProvider( - // Thor client used by the provider - thorSoloClient, - - // Internal wallet used by the provider (needed to call the getSigner() method) - new ProviderInternalBaseWallet( - [ - { - privateKey: HexUInt.of(senderAccount.privateKey).bytes, - address: senderAccount.address - } - ], - { - delegator: { - delegatorPrivateKey: delegatorAccount.privateKey - } - } - ), - - // Enable fee delegation - true -); - -// 2 - Create the transaction clauses -const transaction = { - clauses: [ - Clause.transferVET( - Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a'), - VET.of(1) - ) as TransactionClause - ], - simulateTransactionOptions: { - caller: senderAccount.address - } -}; - -// 3 - Estimate gas -const gasResult = await thorSoloClient.gas.estimateGas( - transaction.clauses, - transaction.simulateTransactionOptions.caller -); - -// 4 - Build transaction body -const txBody = await thorSoloClient.transactions.buildTransactionBody( - transaction.clauses, - gasResult.totalGas, - { - isDelegated: true - } -); - -// 4 - Sign the transaction -const signer = await providerWithDelegationEnabled.getSigner( - senderAccount.address -); - -const rawDelegateSigned = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - senderAccount.address - ) -); - -const delegatedSigned = Transaction.decode( - HexUInt.of(rawDelegateSigned.slice(2)).bytes, - true -); - -// 5 - Send the transaction -const sendTransactionResult = - await thorSoloClient.transactions.sendTransaction(delegatedSigned); - -// 6 - Wait for transaction receipt -const txReceipt = await thorSoloClient.transactions.waitForTransaction( - sendTransactionResult.id -); -``` - -3. **Delegation with URL**: This example will showcase the use of a delegation URL for fee delegation. The sender will specify a delegation URL in the `signTransaction` options, allowing a designated sponsor to pay the transaction fee. We'll cover the full process, from building clauses to verifying the transaction on-chain. - -```typescript { name=full-flow-delegator-url, category=example } -// 1 - Create the thor client -const thorClient = ThorClient.at(TESTNET_URL, { - isPollingEnabled: false -}); - -// Sender account with private key -const senderAccount: { - mnemonic: string; - privateKey: string; - address: string; -} = { - mnemonic: - 'fat draw position use tenant force south job notice soul time fruit', - privateKey: - '2153c1e49c14d92e8b558750e4ec3dc9b5a6ac4c13d24a71e0fa4f90f4a384b5', - address: '0x571E3E1fBE342891778151f037967E107fb89bd0' -}; - -// Delegator account with private key -const delegatorAccount = { - URL: 'https://sponsor-testnet.vechain.energy/by/269' -}; - -// Create the provider (used in this case to sign the transaction with getSigner() method) -const providerWithDelegationEnabled = new VeChainProvider( - // Thor client used by the provider - thorClient, - - // Internal wallet used by the provider (needed to call the getSigner() method) - new ProviderInternalBaseWallet( - [ - { - privateKey: HexUInt.of(senderAccount.privateKey).bytes, - address: senderAccount.address - } - ], - { - delegator: { - delegatorUrl: delegatorAccount.URL - } - } - ), - - // Enable fee delegation - true -); - -// 2 - Create the transaction clauses -const transaction = { - clauses: [ - Clause.transferVET( - Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a'), - VET.of(1) - ) as TransactionClause - ], - simulateTransactionOptions: { - caller: senderAccount.address - } -}; - -// 3 - Estimate gas -const gasResult = await thorClient.gas.estimateGas( - transaction.clauses, - senderAccount.address -); - -// 4 - Build transaction body -const txBody = await thorClient.transactions.buildTransactionBody( - transaction.clauses, - gasResult.totalGas, - { - isDelegated: true - } -); - -// 4 - Sign the transaction -const signer = await providerWithDelegationEnabled.getSigner( - senderAccount.address -); - -const rawDelegateSigned = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - senderAccount.address - ) -); - -const delegatedSigned = Transaction.decode( - HexUInt.of(rawDelegateSigned.slice(2)).bytes, - true -); - -// 5 - Send the transaction -const sendTransactionResult = - await thorClient.transactions.sendTransaction(delegatedSigned); - -// 6 - Wait for transaction receipt -const txReceipt = await thorClient.transactions.waitForTransaction( - sendTransactionResult.id -); -``` - -By examining these complete examples, developers can gain a comprehensive understanding of transaction handling in the VeChain SDK. Each example demonstrates the steps involved in initiating, signing, and sending transactions, as well as the nuances associated with fee delegation. - -# Errors handling on transactions -You can find the transaction revert reason by using `getRevertReason` method with the transaction hash. - -```typescript { name=revert-reason, category=example } -// Define transaction id's -const transactionHash = - '0x0a5177fb83346bb6ff7ca8408889f0c99f44b2b1b5c8bf6f0eb53c4b2e81d98d'; - -// Get the revert reason -const revertReason = - await thorClient.transactions.getRevertReason(transactionHash); -console.log(revertReason); -``` - -This method will return the revert reason of the transaction if it failed, otherwise it will return `null`. - -### Decoding revert reason when simulating a transaction -Even when using the `simulateTransaction` method you can find the revert reason. - -```typescript { name=revert-reason-with-simulation, category=example } -const simulatedTx: TransactionSimulationResult[] = - await thorSoloClient.transactions.simulateTransaction([ - { - to: '0x0000000000000000000000000000456e65726779', - value: '0', - data: ABIContract.ofAbi(energyABI) - .encodeFunctionInput('transfer', [ - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - Units.parseEther('1000000000').bi - ]) - .toString() - } - ]); - -const revertReason = thorSoloClient.transactions.decodeRevertReason( - simulatedTx[0].data -); -``` - -In this case there is only a `TransactionSimulationResult`, so no need to loop. diff --git a/docs/tsconfig.json b/docs/tsconfig.json deleted file mode 100644 index 1a83e52c0..000000000 --- a/docs/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "module": "ESNext", - "moduleResolution": "Node", - "allowSyntheticDefaultImports": true, - }, - "ts-node": { - "compilerOptions": { - "esModuleInterop": true, - "module": "ESNext", - "target": "ESNext", - "moduleResolution": "Node", - }, - "esm": true - } -} \ No newline at end of file diff --git a/package.json b/package.json index 170a2c81f..12654ed52 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,7 @@ ], "private": true, "workspaces": [ - "packages/*", - "docs" + "packages/*" ], "packageManager": "yarn@1.22.22", "scripts": { @@ -38,11 +37,9 @@ "test:integration:solo": "(yarn start-thor-solo && yarn test:integration && yarn stop-thor-solo) || yarn stop-thor-solo", "test:examples": "turbo test:examples", "test:examples:solo": "(yarn start-thor-solo && yarn test:examples && yarn stop-thor-solo) || yarn stop-thor-solo", - "test": "turbo test --force --filter='@vechain/sdk-core' --filter='@vechain/sdk-thorest-api' && yarn merge-coverage", - "test:browser": "turbo test:browser --force && yarn merge-coverage", + "test": "turbo test --force --filter='@vechain/sdk-core' --filter='@vechain/sdk-thorest-api'", "test:solo": "(yarn start-thor-solo && yarn test && yarn stop-thor-solo) || yarn stop-thor-solo", "test:browser:solo": "(yarn start-thor-solo && yarn test:browser && yarn stop-thor-solo) || yarn stop-thor-solo", - "merge-coverage": "ts-node scripts/merge-coverage.ts", "check:tests-naming": "ts-node scripts/check-tests-naming.ts" }, "devDependencies": { diff --git a/packages/core/README.md b/packages/core/README.md index d5a0fc172..3b0ae4911 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -30,8 +30,6 @@ Vechain SDK Core is your go-to solution for secure, offline dApp development on ## Usage -Explore examples of how to use this package in real-world scenarios at [vechain SDK examples](https://github.com/vechain/vechain-sdk/tree/main/docs/examples). - Feel free to leverage these resources and don't hesitate to reach out if you have any questions or need further assistance. Happy coding with the VeChain SDK! diff --git a/packages/errors/README.md b/packages/errors/README.md index 9c5195ea1..504db9a08 100644 --- a/packages/errors/README.md +++ b/packages/errors/README.md @@ -18,8 +18,6 @@ The VeChain SDK Error package is specifically designed to handle custom errors s ## Usage -Explore examples of how to use this package in real-world scenarios at [vechain SDK examples](https://github.com/vechain/vechain-sdk/tree/main/docs/examples). - Feel free to leverage these resources and don't hesitate to reach out if you have any questions or need further assistance. Happy coding with the VeChain SDK! diff --git a/packages/logging/README.md b/packages/logging/README.md index ff1a2bf0c..ff1cc15c7 100644 --- a/packages/logging/README.md +++ b/packages/logging/README.md @@ -24,8 +24,6 @@ The VeChain SDK Logging package provides features for logging, including: ## Usage -Explore examples of how to use this package in real-world scenarios at [vechain SDK examples](https://github.com/vechain/vechain-sdk/tree/main/docs/examples). - Feel free to leverage these resources and don't hesitate to reach out if you have any questions or need further assistance. Happy coding with the VeChain SDK! diff --git a/packages/network/README.md b/packages/network/README.md index 00587aa16..240bf993d 100644 --- a/packages/network/README.md +++ b/packages/network/README.md @@ -33,8 +33,6 @@ Vechain SDK Network is your all-in-one solution for seamlessly integrating with ## Usage -Explore examples of how to use this package in real-world scenarios at [vechain SDK examples](https://github.com/vechain/vechain-sdk/tree/main/docs/examples). - Feel free to leverage these resources and don't hesitate to reach out if you have any questions or need further assistance. Happy coding with the VeChain SDK! diff --git a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts b/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts index 2f43d16c3..cdce9e3b4 100644 --- a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts +++ b/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts @@ -48,7 +48,7 @@ const _getDelegationSignature = async ( '_getDelegationSignature()', 'Delegation failed: Cannot get signature from delegator.', { - gasPayerUrl: delegatorUrl + delegatorUrl }, error ); diff --git a/scripts/pre-release.ts b/scripts/pre-release.ts deleted file mode 100644 index 0d0129d1a..000000000 --- a/scripts/pre-release.ts +++ /dev/null @@ -1,99 +0,0 @@ -import util from 'util'; -import * as child_process from 'child_process'; -import * as fs from 'fs'; -import * as path from 'path'; - -const exec = util.promisify(child_process.exec); - -// variable packages should be all the child folders in the packages folder -const packages = fs.readdirSync(path.resolve(__dirname, '../packages')); - -const updatePackageVersions = (version: string): void => { - const packageNames = []; - - for (const pkg of packages) { - const pkgPath = path.resolve(__dirname, `../packages/${pkg}`); - const pkgJsonPath = path.resolve(pkgPath, './package.json'); - const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8')); - pkgJson.version = version; - packageNames.push(pkgJson.name); - fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2)); - } - - // if a package json contains a dependency on another package in this repo, update it to the new version - for (const pkg of packages) { - const pkgPath = path.resolve(__dirname, `../packages/${pkg}`); - const pkgJsonPath = path.resolve(pkgPath, './package.json'); - const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8')); - - if (pkgJson.dependencies != null) { - for (const dep of Object.keys(pkgJson.dependencies)) { - if (packageNames.includes(dep)) { - pkgJson.dependencies[dep] = version; - } - } - } - - fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2)); - } - - // Update versions in the docs directory - const docsPath = path.resolve(__dirname, `../docs`); - const docsJsonPath = path.resolve(docsPath, './package.json'); - const docsJson = JSON.parse(fs.readFileSync(docsJsonPath, 'utf8')); - docsJson.version = version; - fs.writeFileSync(docsJsonPath, JSON.stringify(docsJson, null, 2)); - - if (docsJson.dependencies != null) { - for (const dep of Object.keys(docsJson.dependencies)) { - if (packageNames.includes(dep)) { - docsJson.dependencies[dep] = version; - } - } - } - - fs.writeFileSync(docsJsonPath, JSON.stringify(docsJson, null, 2)); -}; - -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+(-beta\.\d+)?$/)) { - console.error( - `🚨 You must specify a semantic version as the first argument 🚨` - ); - process.exit(1); - } - - console.log(' Install:'); - console.log('\t- 📦 Installing dependencies...'); - await exec('yarn'); - console.log('\t- ✅ Installed!'); - - console.log(' Build:'); - console.log('\t- 📦 Building packages...'); - await exec('yarn build'); - console.log('\t- ✅ Built!'); - - console.log(' Test:'); - console.log('\t- 🧪 Testing packages...'); - console.log('\t- ✅ Success!'); - - console.log(' Version:'); - console.log(`\t- 🏷 Updating package versions to ${version}...`); - updatePackageVersions(version); - console.log('\t- ✅ Updated!'); - - console.log('\n______________________________________________________\n\n'); - console.log(' Publish:'); - console.log( - `\t- Run 'yarn changeset publish' to publish the packages, then release also on GitHub.` - ); - console.log('\n______________________________________________________\n\n'); -}; - -preparePackages().catch((e) => { - console.error(e); - process.exit(1); -}); diff --git a/scripts/test-rpc-proxy.ts b/scripts/test-rpc-proxy.ts deleted file mode 100644 index f61be917a..000000000 --- a/scripts/test-rpc-proxy.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { fail, strictEqual } from 'assert'; - -const endpointsTestCases = [ - { - method: 'net_version', - params: [], - expected: '0x186aa' - }, - { - method: 'eth_chainId', - params: [], - expected: '0x186aa' - }, - { - method: 'web3_clientVersion', - params: [], - expected: 'thor' - }, - { - method: 'eth_call', - params: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - 'latest' - ], - expected: '0x' - } -]; - -const proxyUrl = 'http://localhost:8545'; - -async function testRPCProxy(): Promise { - // Send RPC requests to test it - for (const { method, params, expected } of endpointsTestCases) { - const response = await fetch(proxyUrl, { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - jsonrpc: '2.0', - id: 1, - method, - params - }) - }); - - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - const data: { result?: unknown } = await response.json(); - - if (data.result === undefined) { - throw new Error('Response does not contain result'); - } - - strictEqual(data.result, expected, 'Expected a different result'); - - console.log(`RPC Proxy test for ${method} passed`); - } -} - -testRPCProxy().catch((error) => { - console.error( - 'Error occurred while testing RPC Proxy:', - (error as Error).message - ); - fail(); -}); diff --git a/yarn.lock b/yarn.lock index 80f984190..0873a6a69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1948,13 +1948,6 @@ "@types/conventional-commits-parser" "^5.0.0" chalk "^5.3.0" -"@cspotcode/source-map-support@^0.8.0": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" - integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== - dependencies: - "@jridgewell/trace-mapping" "0.3.9" - "@esbuild/aix-ppc64@0.24.0": version "0.24.0" resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz#b57697945b50e99007b4c2521507dc613d4a648c" @@ -2599,7 +2592,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.24" -"@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0": +"@jridgewell/resolve-uri@^3.1.0": version "3.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== @@ -2614,14 +2607,6 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== -"@jridgewell/trace-mapping@0.3.9": - version "0.3.9" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" - integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" @@ -3573,26 +3558,6 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== -"@tsconfig/node10@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" - integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== - -"@tsconfig/node12@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" - integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== - -"@tsconfig/node14@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" - integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== - -"@tsconfig/node16@^1.0.2": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" - integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== - "@tsd/typescript@~5.4.3": version "5.4.5" resolved "https://registry.yarnpkg.com/@tsd/typescript/-/typescript-5.4.5.tgz#a7c11d3a97ddfa201f831f4e4270a169a87f7655" @@ -4274,14 +4239,14 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^8.0.2, acorn-walk@^8.1.1: +acorn-walk@^8.0.2: version "8.3.4" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== dependencies: acorn "^8.11.0" -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.4.1, acorn@^8.8.1: +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.8.1: version "8.12.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== @@ -4445,11 +4410,6 @@ archy@^1.0.0: resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" integrity sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw== -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -5458,11 +5418,6 @@ create-jest@^29.7.0: jest-util "^29.7.0" prompts "^2.0.1" -create-require@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== - cross-env@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" @@ -5675,11 +5630,6 @@ diff-sequences@^29.6.3: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== - diff@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" @@ -8558,7 +8508,7 @@ make-dir@^4.0.0: dependencies: semver "^7.5.3" -make-error@^1.1.1, make-error@^1.3.6: +make-error@^1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== @@ -10779,33 +10729,6 @@ ts-jest@^29.2.5: semver "^7.6.3" yargs-parser "^21.1.1" -ts-node-test@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/ts-node-test/-/ts-node-test-0.4.4.tgz#736e74e1a928c0c8be8b8353224e88c359233f2b" - integrity sha512-OWq8/B8xk8X88IEMP12AAM1xNDV3y5brzzMKwAhUpeedscQDxU+wv9dDPRHnragYVOGjSsEsfRBvSgrUGhZcPg== - dependencies: - ts-node "10.9.2" - yargs "17.7.2" - -ts-node@10.9.2: - version "10.9.2" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" - integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== - dependencies: - "@cspotcode/source-map-support" "^0.8.0" - "@tsconfig/node10" "^1.0.7" - "@tsconfig/node12" "^1.0.7" - "@tsconfig/node14" "^1.0.0" - "@tsconfig/node16" "^1.0.2" - acorn "^8.4.1" - acorn-walk "^8.1.1" - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" - yn "3.1.1" - tsconfig-paths@^3.15.0: version "3.15.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4" @@ -11225,11 +11148,6 @@ uuid@^9.0.1: resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== -v8-compile-cache-lib@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" - integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== - v8-to-istanbul@^9.0.1: version "9.3.0" resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" @@ -11592,19 +11510,6 @@ yargs-unparser@^2.0.0: flat "^5.0.2" is-plain-obj "^2.1.0" -yargs@17.7.2, yargs@^17.0.0, yargs@^17.3.1: - version "17.7.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" - integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.1.1" - yargs@^15.0.2: version "15.4.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" @@ -11635,10 +11540,18 @@ yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== +yargs@^17.0.0, yargs@^17.3.1: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" yocto-queue@^0.1.0: version "0.1.0" From 6a1245db60519177022e26993bfdb9e7a9971b79 Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 16:05:34 +0000 Subject: [PATCH 07/15] fix: 1886 module removed --- .changeset/funny-masks-cheat.md | 1 - .changeset/pre.json | 1 - .github/workflows/publish-sdk.yml | 12 +- .github/workflows/unit-integration-test.yml | 6 +- packages/aws-kms-adapter/.gitignore | 1 - packages/aws-kms-adapter/README.md | 248 --- packages/aws-kms-adapter/eslint.config.mjs | 25 - packages/aws-kms-adapter/jest.config.js | 24 - packages/aws-kms-adapter/package.json | 50 - .../aws-kms-adapter/src/KMSVeChainProvider.ts | 123 -- .../aws-kms-adapter/src/KMSVeChainSigner.ts | 349 ---- packages/aws-kms-adapter/src/index.ts | 5 - .../tests/KMSVeChainProvider.unit.test.ts | 81 - .../tests/KMSVeChainSigner.solo.test.ts | 325 ---- .../tests/KMSVeChainSigner.testnet.test.ts | 157 -- .../tests/KMSVeChainSigner.unit.test.ts | 171 -- packages/aws-kms-adapter/tests/fixture.ts | 1399 ----------------- .../tests/test-aws-credentials.json | 21 - packages/aws-kms-adapter/tsconfig.json | 12 - packages/aws-kms-adapter/typedoc.json | 4 - packages/core/eslint.config.mjs | 1 - packages/errors/eslint.config.mjs | 3 +- packages/ethers-adapter/eslint.config.mjs | 3 +- packages/hardhat-plugin/eslint.config.mjs | 3 +- packages/logging/eslint.config.mjs | 3 +- packages/network/eslint.config.mjs | 3 +- packages/rpc-proxy/eslint.config.mjs | 3 +- yarn.lock | 886 +---------- 28 files changed, 11 insertions(+), 3909 deletions(-) delete mode 100644 packages/aws-kms-adapter/.gitignore delete mode 100644 packages/aws-kms-adapter/README.md delete mode 100644 packages/aws-kms-adapter/eslint.config.mjs delete mode 100644 packages/aws-kms-adapter/jest.config.js delete mode 100644 packages/aws-kms-adapter/package.json delete mode 100644 packages/aws-kms-adapter/src/KMSVeChainProvider.ts delete mode 100644 packages/aws-kms-adapter/src/KMSVeChainSigner.ts delete mode 100644 packages/aws-kms-adapter/src/index.ts delete mode 100644 packages/aws-kms-adapter/tests/KMSVeChainProvider.unit.test.ts delete mode 100644 packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts delete mode 100644 packages/aws-kms-adapter/tests/KMSVeChainSigner.testnet.test.ts delete mode 100644 packages/aws-kms-adapter/tests/KMSVeChainSigner.unit.test.ts delete mode 100644 packages/aws-kms-adapter/tests/fixture.ts delete mode 100644 packages/aws-kms-adapter/tests/test-aws-credentials.json delete mode 100644 packages/aws-kms-adapter/tsconfig.json delete mode 100644 packages/aws-kms-adapter/typedoc.json diff --git a/.changeset/funny-masks-cheat.md b/.changeset/funny-masks-cheat.md index 2b74eca83..e82954336 100644 --- a/.changeset/funny-masks-cheat.md +++ b/.changeset/funny-masks-cheat.md @@ -1,5 +1,4 @@ --- -"@vechain/sdk-aws-kms-adapter": patch "@vechain/sdk-core": patch "@vechain/sdk-errors": patch "@vechain/sdk-ethers-adapter": patch diff --git a/.changeset/pre.json b/.changeset/pre.json index a5f9ab0b2..b52ec9c25 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -2,7 +2,6 @@ "mode": "exit", "tag": "latest", "initialVersions": { - "@vechain/sdk-aws-kms-adapter": "1.0.0", "@vechain/sdk-core": "1.0.0", "@vechain/sdk-errors": "1.0.0", "@vechain/sdk-ethers-adapter": "1.0.0", diff --git a/.github/workflows/publish-sdk.yml b/.github/workflows/publish-sdk.yml index 624f3dafa..eb3424ecd 100644 --- a/.github/workflows/publish-sdk.yml +++ b/.github/workflows/publish-sdk.yml @@ -49,7 +49,7 @@ jobs: yarn publish env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - + - name: Publish network run: | cd packages/network @@ -73,7 +73,7 @@ jobs: yarn publish env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - + - name: Publish RPC proxy run: | cd packages/rpc-proxy @@ -89,11 +89,3 @@ jobs: yarn publish env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - - name: Publish AWS KMS Adapter - run: | - cd packages/aws-kms-adapter - yarn version --no-git-tag-version --new-version ${{ github.ref_name }} - yarn publish - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/unit-integration-test.yml b/.github/workflows/unit-integration-test.yml index 953d13320..e41cb2287 100644 --- a/.github/workflows/unit-integration-test.yml +++ b/.github/workflows/unit-integration-test.yml @@ -59,8 +59,7 @@ jobs: network, packages/network/junit.xml errors, packages/errors/junit.xml logging, packages/logging/junit.xml - hardhat-plugin, packages/hardhat-plugin/junit.xml - aws-kms-adapter, packages/aws-kms-adapter/junit.xml + hardhat-plugin, packages/hardhat-plugin/junit.xml ethers-adapter, packages/ethers-adapter/junit.xml rpc-proxy, packages/rpc-proxy/junit.xml @@ -71,7 +70,7 @@ jobs: name: coverage-results path: | packages/**/coverage/lcov.info - + - name: Post unit test results to slack if: always() && github.ref == 'refs/heads/main' && (steps.unit-test.outcome == 'failure') uses: slackapi/slack-github-action@v2.0.0 @@ -86,4 +85,3 @@ jobs: "message": "unit tests failed, see run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" } - \ No newline at end of file diff --git a/packages/aws-kms-adapter/.gitignore b/packages/aws-kms-adapter/.gitignore deleted file mode 100644 index d5d914332..000000000 --- a/packages/aws-kms-adapter/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tests/aws-credentials.json \ No newline at end of file diff --git a/packages/aws-kms-adapter/README.md b/packages/aws-kms-adapter/README.md deleted file mode 100644 index 8a00b2290..000000000 --- a/packages/aws-kms-adapter/README.md +++ /dev/null @@ -1,248 +0,0 @@ -# AWS KMS Adapter for VeChain SDK - -The AWS KMS Adapter for VeChain SDK provides a secure way to sign transactions using AWS Key Management Service (KMS). This adapter allows you to leverage AWS KMS to manage and protect your private keys, ensuring that sensitive cryptographic operations are performed in a secure environment. - -## Features - -- **Secure Key Management**: Use AWS KMS to securely manage and protect your private keys. -- **Transaction Signing**: Sign VeChain transactions using keys stored in AWS KMS. -- **Integration with VeChain SDK**: Seamlessly integrate with the VeChain SDK for blockchain interactions. -- **Sign and send transactions using a delegator key**: You can specify the key ID of a delegator key to leverage this VeChain feature for signing and sending transactions. - -## Installation - -To install the AWS KMS Adapter, use the following command: - -```sh -yarn add @vechain/sdk-aws-kms-adapter -``` - -## Test - -To run all the tests, including the ones relying on a local instance of Thor Solo + LocalStack and Testnet, please run: - -```bash -yarn test:integration -``` - -## Usage - -To integrate this into your code, depending on how you plan to manage your AWS credentials, you can choose one of the following examples. - -Within this repo, you can create a credentials file called `aws-credentials.json` with your custom credentials under the `tests` folder in case you want to give it a try before integrating with your project. A valid format would be as follows (it is an array in case you want to include a delegator key, assumed to be the second one): - -```json -[ - { - // AWS KMS keyId (mandatory) - "keyId": "00000000-0000-0000-0000-000000000000", - // AWS region (mandatory) - "region": "eu-west-1", - // AWS credentials (optional) - "credentials": { - // AWS access key id (mandatory if credentials) - "accessKeyId": "test", - // AWS secret access key (mandatory if credentials) - "secretAccessKey": "test", - // AWS session token if SSO is configured (optional) - "sessionToken": "test" - }, - // AWS endpoint (optional, to be used locally along with LocalStack) - "endpoint": "http://localhost:4599" - } -] -``` - -### IAM roles - -This is the preferred way. If you integrate this library in an app deployed in AWS following with IAM roles, you can just do as follows: - -```ts -import { type KMSClientParameters, KMSVeChainProvider, KMSVeChainSigner } from '@vechain/sdk-aws-kms-adapter'; -import { - THOR_SOLO_URL, - ThorClient -} from '@vechain/sdk-network'; - ... - const awsClientParameters: KMSClientParameters = { - keyId: 'keyId', - region: 'region' - }; - ... - - const thorClient = ThorClient.fromUrl(THOR_SOLO_URL); - const provider = new KMSVeChainProvider( - thorClient, - awsClientParameters - ); - const signer = new KMSVeChainSigner(provider); - // Signing typed data as per EIP712 - const signature = await signer.signTypedData( - typedData.domain, - typedData.types, - typedData.data - ); -``` - -### AWS credentials (SSO) - -This way you can connect to your AWS account by using `accessKeyId`, `secretAccessKey` and `sessionToken` if SSO is enabled. - -```ts -import { type KMSClientParameters, KMSVeChainProvider, KMSVeChainSigner } from '@vechain/sdk-aws-kms-adapter'; -import { - signerUtils, - THOR_SOLO_URL, - ThorClient -} from '@vechain/sdk-network'; - ... - const awsClientParameters: KMSClientParameters = { - keyId: 'keyId', - region: 'region', - credentials: { - accessKeyId: 'accessKeyId', - secretAccessKey: 'secretAccessKey' - } - }; - ... - - const thorClient = ThorClient.fromUrl(THOR_SOLO_URL); - const provider = new KMSVeChainProvider( - thorClient, - awsClientParameters - ); - const signer = new KMSVeChainSigner(provider); - // Signing and sending a transaction - const receipt = await signer.sendTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - originAddress - ) - ); -``` - -### AWS endpoint (LocalStack) - -You can also leverage LocalStack so you can try the library locally. Sample values are included in the file `tests/test-aws-credentials.json`. - -```ts -import { type KMSClientParameters, KMSVeChainProvider, KMSVeChainSigner } from '@vechain/sdk-aws-kms-adapter'; -import { - THOR_SOLO_URL, - ThorClient -} from '@vechain/sdk-network'; - ... - const awsClientParameters: KMSClientParameters = { - keyId: 'keyId', - region: 'region', - credentials: { - accessKeyId: 'accessKeyId', - secretAccessKey: 'secretAccessKey' - }, - endpoint: 'localstackEndpoint' - }; - ... - - const thorClient = ThorClient.fromUrl(THOR_SOLO_URL); - const provider = new KMSVeChainProvider( - thorClient, - awsClientParameters - ); - const signer = new KMSVeChainSigner(provider); - // Returns the address related to the KMS key - const address = await signer.getAddress(); -``` - -### Delegation (provider) - -You can also use delegation to sign your transactions. In this example the source of the delegation is a delegator which key is in KMS so requires a `KMSVeChainProvider`. - -```ts -import { type KMSClientParameters, KMSVeChainProvider, KMSVeChainSigner } from '@vechain/sdk-aws-kms-adapter'; -import { - THOR_SOLO_URL, - ThorClient -} from '@vechain/sdk-network'; - ... - const awsClientParameters: KMSClientParameters = { - keyId: 'keyId', - region: 'region', - credentials: { - accessKeyId: 'accessKeyId', - secretAccessKey: 'secretAccessKey' - }, - endpoint: 'localstackEndpoint' - }; - - const delegatorAwsClientParameters: KMSClientParameters = { - // Same format as awsClientParameters, changing values so we can connect - // to something different to LocalStack if we want (see examples above) - } - ... - - const thorClient = ThorClient.fromUrl(THOR_SOLO_URL); - const provider = new KMSVeChainProvider( - thorClient, - awsClientParameters - ); - - // Signer with delegator enabled - const delegatorProvider = new KMSVeChainProvider( - thorClient, - delegatorAwsClientParameters - ); - const signerWithDelegator = new KMSVeChainSigner( - provider, - { - provider: delegatorProvider - } - ); - - // Returns the address related to the origin KMS key - const address = await signerWithDelegator.getAddress(); - // Returns the address related to the delegator KMS key - const address = await signerWithDelegator.getAddress(true); -``` - -### Delegation (url) - -You can also use delegation to sign your transactions. In this example the source of the delegation is a URL that returns the signature (for instance, `https://sponsor-testnet.vechain.energy/by/705`, more details on how to get yours [here](https://learn.vechain.energy/vechain.energy/FeeDelegation/Setup/)). - -```ts -import { type KMSClientParameters, KMSVeChainProvider, KMSVeChainSigner } from '@vechain/sdk-aws-kms-adapter'; -import { - THOR_SOLO_URL, - ThorClient -} from '@vechain/sdk-network'; - ... - const awsClientParameters: KMSClientParameters = { - keyId: 'keyId', - region: 'region', - credentials: { - accessKeyId: 'accessKeyId', - secretAccessKey: 'secretAccessKey' - }, - endpoint: 'localstackEndpoint' - }; - ... - - const thorClient = ThorClient.fromUrl(THOR_SOLO_URL); - - // Signer with delegator enabled - const provider = new KMSVeChainProvider( - thorClient, - awsClientParameters - ); - const signerWithDelegator = new KMSVeChainSigner( - provider, - { - url: 'https://sponsor-testnet.vechain.energy/by/705' - } - ); - - // Returns the address related to the origin KMS key - const address = await signerWithDelegator.getAddress(); - - // See /tests folder for more examples. This time we wont get the address - // of the delegator since there is no provider -``` diff --git a/packages/aws-kms-adapter/eslint.config.mjs b/packages/aws-kms-adapter/eslint.config.mjs deleted file mode 100644 index bda7831eb..000000000 --- a/packages/aws-kms-adapter/eslint.config.mjs +++ /dev/null @@ -1,25 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - rules: { - "import/no-restricted-paths": ["error", { - zones: [{ - target: "./src", - - from: [ - "../core", - "../errors", - "../ethers-adapter", - "../hardhat-plugin", - "../logging", - "../network", - "../rpc-proxy", - ], - - message: "Please import using @vechain/sdk-", - }], - }], - }, - }]; \ No newline at end of file diff --git a/packages/aws-kms-adapter/jest.config.js b/packages/aws-kms-adapter/jest.config.js deleted file mode 100644 index adf941c77..000000000 --- a/packages/aws-kms-adapter/jest.config.js +++ /dev/null @@ -1,24 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -// Coverage threshold would apply to yarn test, not yarn test:unit -const isUnitTest = process.env.UNIT; - -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - coverageReporters: ['html', 'lcov', 'json'], - runner: 'groups', - reporters: ['default', 'jest-junit'], - coveragePathIgnorePatterns: ['/node_modules/', '/tests/'], - workerThreads: true, - coverageThreshold: - isUnitTest !== 'true' - ? { - global: { - branches: 100, - functions: 100, - lines: 99, - statements: 99 - } - } - : undefined -}; diff --git a/packages/aws-kms-adapter/package.json b/packages/aws-kms-adapter/package.json deleted file mode 100644 index 427e9916f..000000000 --- a/packages/aws-kms-adapter/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@vechain/sdk-aws-kms-adapter", - "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", - "homepage": "https://github.com/vechain/vechain-sdk-js", - "repository": { - "type": "git", - "url": "github:vechain/vechain-sdk-js" - }, - "keywords": [ - "VeChain", - "AWS", - "KMS", - "adapter", - "signer" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "package.json", - "README.md", - "LICENSE" - ], - "scripts": { - "build": "rm -rf ./dist && tsup-node src/index.ts --format cjs,esm --dts", - "lint": "eslint", - "format": "prettier --write src/**/*.ts tests/**/*.ts", - "start-thor-solo": "echo 'Starting thor solo node ...' && docker compose -f ../../docker-compose.thor.yml -f ../../docker-compose.localstack.yml --profile thor-solo up -d --wait && echo '\nThor solo node and localstack started ...'", - "stop-thor-solo": "echo 'Stopping thor solo node ...' && docker compose -f ../../docker-compose.thor.yml -f ../../docker-compose.localstack.yml --profile thor-solo down && echo 'Thor solo node and localstack stopped ...'", - "test": "docker compose -f ../../docker-compose.localstack.yml up -d && sleep 10 && yarn test:all; ret=$?; docker compose -f ../../docker-compose.localstack.yml down; exit $ret", - "test:all": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit", - "test:integration": "(yarn start-thor-solo && yarn test:all && yarn stop-thor-solo) || yarn stop-thor-solo", - "test:unit": "rm -rf ./coverageUnit && UNIT=true jest --coverage --coverageDirectory=coverageUnit --group=unit" - }, - "dependencies": { - "@aws-sdk/client-kms": "^3.723.0", - "@noble/curves": "^1.7.0", - "@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.5", - "viem": "^2.22.8" - } -} \ No newline at end of file diff --git a/packages/aws-kms-adapter/src/KMSVeChainProvider.ts b/packages/aws-kms-adapter/src/KMSVeChainProvider.ts deleted file mode 100644 index 2e23419ce..000000000 --- a/packages/aws-kms-adapter/src/KMSVeChainProvider.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { - GetPublicKeyCommand, - KMSClient, - MessageType, - SignCommand, - SigningAlgorithmSpec -} from '@aws-sdk/client-kms'; -import { ProviderMethodError } from '@vechain/sdk-errors'; -import { - type ThorClient, - VeChainProvider, - type VeChainSigner -} from '@vechain/sdk-network'; -import { KMSVeChainSigner } from './KMSVeChainSigner'; - -interface KMSClientParameters { - keyId: string; - region: string; - credentials?: { - accessKeyId: string; - secretAccessKey: string; - sessionToken?: string; - }; - endpoint?: string; -} - -class KMSVeChainProvider extends VeChainProvider { - private readonly kmsClient: KMSClient; - private readonly keyId: string; - private signer?: KMSVeChainSigner; - - /** - * Creates a new instance of KMSVeChainProvider. - * @param thorClient The thor client instance to use. - * @param params The parameters to configure the KMS client and the keyId. - * @param enableDelegation Whether to enable delegation or not. - **/ - public constructor( - thorClient: ThorClient, - params: KMSClientParameters, - enableDelegation: boolean = false - ) { - super(thorClient, undefined, enableDelegation); - this.keyId = params.keyId; - this.kmsClient = - params.endpoint !== undefined - ? new KMSClient({ - region: params.region, - endpoint: params.endpoint, - credentials: params.credentials - }) - : params.credentials !== undefined - ? new KMSClient({ - region: params.region, - credentials: params.credentials - }) - : new KMSClient({ region: params.region }); - } - - /** - * Returns a new instance of the KMSVeChainSigner using this provider configuration. - * @param _addressOrIndex Unused parameter, will always return the signer associated to the keyId - * @returns {KMSVeChainSigner} An instance of KMSVeChainSigner - */ - public override async getSigner( - _addressOrIndex?: string | number - ): Promise { - if (this.signer !== undefined) { - return this.signer; - } - this.signer = new KMSVeChainSigner(this); - return await Promise.resolve(this.signer); - } - - /** - * Returns the public key associated with the keyId provided in the constructor. - * @returns {Uint8Array} The public key associated with the keyId - */ - public async getPublicKey(): Promise { - const getPublicKeyCommand = new GetPublicKeyCommand({ - KeyId: this.keyId - }); - const getPublicKeyOutput = - await this.kmsClient.send(getPublicKeyCommand); - - if (getPublicKeyOutput.PublicKey === undefined) { - throw new ProviderMethodError( - 'KMSVeChainProvider.getPublicKey', - 'The public key could not be retrieved.', - { getPublicKeyOutput } - ); - } - return getPublicKeyOutput.PublicKey; - } - - /** - * Performs a sign operation using the keyId provided in the constructor. - * @param {Uint8Array} message Message to sign using KMS - * @returns {Uint8Array} The signature of the message - */ - public async sign(message: Uint8Array): Promise { - const command = new SignCommand({ - KeyId: this.keyId, - Message: message, - SigningAlgorithm: SigningAlgorithmSpec.ECDSA_SHA_256, - MessageType: MessageType.DIGEST - }); - - const signOutput = await this.kmsClient.send(command); - - if (signOutput.Signature === undefined) { - throw new ProviderMethodError( - 'KMSVeChainProvider.sign', - 'The signature could not be generated.', - { signOutput } - ); - } - - return signOutput.Signature; - } -} - -export { KMSVeChainProvider, type KMSClientParameters }; diff --git a/packages/aws-kms-adapter/src/KMSVeChainSigner.ts b/packages/aws-kms-adapter/src/KMSVeChainSigner.ts deleted file mode 100644 index 611659136..000000000 --- a/packages/aws-kms-adapter/src/KMSVeChainSigner.ts +++ /dev/null @@ -1,349 +0,0 @@ -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, Transaction } from '@vechain/sdk-core'; -import { JSONRPCInvalidParams, SignerMethodError } from '@vechain/sdk-errors'; -import { - type AvailableVeChainProviders, - DelegationHandler, - RPC_METHODS, - type TransactionRequestInput, - VeChainAbstractSigner -} from '@vechain/sdk-network'; -import { BitString, ObjectIdentifier, Sequence, verifySchema } from 'asn1js'; -import { recoverPublicKey, toHex } from 'viem'; -import { KMSVeChainProvider } from './KMSVeChainProvider'; - -class KMSVeChainSigner extends VeChainAbstractSigner { - private readonly kmsVeChainProvider?: KMSVeChainProvider; - private readonly kmsVeChainDelegatorProvider?: KMSVeChainProvider; - private readonly kmsVeChainDelegatorUrl?: string; - - public constructor( - provider?: AvailableVeChainProviders, - delegator?: { - provider?: AvailableVeChainProviders; - url?: string; - } - ) { - // Origin provider - super(provider); - if (this.provider !== undefined) { - if (!(this.provider instanceof KMSVeChainProvider)) { - throw new JSONRPCInvalidParams( - 'KMSVeChainSigner.constructor', - 'The provider must be an instance of KMSVeChainProvider.', - { provider } - ); - } - this.kmsVeChainProvider = this.provider; - } - - // Delegator provider, if any - if (delegator !== undefined) { - if ( - delegator.provider !== undefined && - delegator.provider instanceof KMSVeChainProvider - ) { - this.kmsVeChainDelegatorProvider = delegator.provider; - } else if (delegator.url !== undefined) { - this.kmsVeChainDelegatorUrl = delegator.url; - } else { - throw new JSONRPCInvalidParams( - 'KMSVeChainSigner.constructor', - 'The delegator object is not well formed, either provider or url should be provided.', - { delegator } - ); - } - } - } - - /** - * Connects the signer to a provider. - * @param provider The provider to connect to. - * @returns {this} The signer instance. - * @override VeChainAbstractSigner.connect - **/ - public connect(provider: AvailableVeChainProviders): this { - try { - return new KMSVeChainSigner(provider) as this; - } catch (error) { - throw new SignerMethodError( - 'KMSVeChainSigner.connect', - 'The signer could not be connected to the provider.', - { provider }, - error - ); - } - } - - /** - * Decodes the public key from the DER-encoded public key. - * @param {Uint8Array} encodedPublicKey DER-encoded public key - * @returns {Uint8Array} The decoded public key. - */ - private decodePublicKey(encodedPublicKey: Uint8Array): Uint8Array { - const schema = new Sequence({ - value: [ - new Sequence({ value: [new ObjectIdentifier()] }), - new BitString({ name: 'objectIdentifier' }) - ] - }); - const parsed = verifySchema(encodedPublicKey, schema); - if (!parsed.verified) { - throw new SignerMethodError( - 'KMSVeChainSigner.decodePublicKey', - `Failed to parse the encoded public key: ${parsed.result.error}`, - { parsed } - ); - } - - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - const objectIdentifier: ArrayBuffer = - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - parsed.result.objectIdentifier.valueBlock.valueHex; - - return new Uint8Array(objectIdentifier); - } - - /** - * Gets the DER-encoded public key from KMS and decodes it. - * @param {KMSVeChainProvider} kmsProvider (Optional) The provider to get the public key from. - * @returns {Uint8Array} The decoded public key. - */ - private async getDecodedPublicKey( - kmsProvider: KMSVeChainProvider | undefined = this.kmsVeChainProvider - ): Promise { - if (kmsProvider === undefined) { - throw new JSONRPCInvalidParams( - 'KMSVeChainSigner.getDecodedPublicKey', - 'Thor provider is not found into the signer. Please attach a Provider to your signer instance.', - {} - ); - } - const publicKey = await kmsProvider.getPublicKey(); - return this.decodePublicKey(publicKey); - } - - /** - * It returns the address associated with the signer. - * @param {boolean} fromDelegatorProvider (Optional) If true, the provider will be the delegator. - * @returns The address associated with the signer. - */ - public async getAddress( - fromDelegatorProvider: boolean | undefined = false - ): Promise { - try { - const kmsProvider = fromDelegatorProvider - ? this.kmsVeChainDelegatorProvider - : this.kmsVeChainProvider; - const publicKeyDecoded = - await this.getDecodedPublicKey(kmsProvider); - return Address.ofPublicKey(publicKeyDecoded).toString(); - } catch (error) { - throw new SignerMethodError( - 'KMSVeChainSigner.getAddress', - 'The address could not be retrieved.', - { fromDelegatorProvider }, - error - ); - } - } - - /** - * 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. - */ - private async buildVeChainSignatureFromPayload( - payload: Uint8Array, - kmsProvider: KMSVeChainProvider | undefined = this.kmsVeChainProvider - ): Promise { - if (kmsProvider === undefined) { - throw new JSONRPCInvalidParams( - 'KMSVeChainSigner.buildVeChainSignatureFromPayload', - 'Thor provider is not found into the signer. Please attach a Provider to your signer instance.', - { payload } - ); - } - - // Sign the transaction hash - const signature = await kmsProvider.sign(payload); - - // Build the VeChain signature using the r, s and v components - const hexSignature = bytesToHex(signature); - const decodedSignatureWithoutRecoveryBit = - secp256k1.Signature.fromDER(hexSignature).normalizeS(); - - const recoveryBit = await this.getRecoveryBit( - decodedSignatureWithoutRecoveryBit, - payload, - kmsProvider - ); - - return concatBytes( - decodedSignatureWithoutRecoveryBit.toCompactRawBytes(), - new Uint8Array([recoveryBit]) - ); - } - - /** - * Returns the recovery bit of a signature. - * @param {SignatureType} decodedSignatureWithoutRecoveryBit Signature with the R and S components only. - * @param {Uint8Array} transactionHash Raw transaction hash. - * @param {KMSVeChainProvider} kmsProvider The provider to sign the payload. - * @returns {number} The V component of the signature (either 0 or 1). - */ - private async getRecoveryBit( - decodedSignatureWithoutRecoveryBit: SignatureType, - transactionHash: Uint8Array, - kmsProvider: KMSVeChainProvider - ): Promise { - const publicKey = await this.getDecodedPublicKey(kmsProvider); - const publicKeyHex = toHex(publicKey); - - for (let i = 0n; i < 2n; i++) { - const publicKeyRecovered = await recoverPublicKey({ - hash: transactionHash, - signature: { - r: toHex(decodedSignatureWithoutRecoveryBit.r), - s: toHex(decodedSignatureWithoutRecoveryBit.s), - v: i - } - }); - if (publicKeyRecovered === publicKeyHex) { - return Number(i); - } - } - - throw new SignerMethodError( - 'KMSVeChainSigner.getRecoveryBit', - 'The recovery bit could not be found.', - { decodedSignatureWithoutRecoveryBit, transactionHash } - ); - } - - /** - * Concat the origin signature to the delegator signature if the delegator is set. - * @param {Transaction} transaction Transaction to sign. - * @returns Both signatures concatenated if the delegator is set, the origin signature otherwise. - */ - private async concatSignatureIfDelegation( - transaction: Transaction - ): Promise { - // Get the transaction hash - const transactionHash = transaction.getTransactionHash().bytes; - - // Sign the transaction hash using origin key - const originSignature = - await this.buildVeChainSignatureFromPayload(transactionHash); - - // We try first in case there is a delegator provider - if (this.kmsVeChainDelegatorProvider !== undefined) { - const publicKeyDecoded = await this.getDecodedPublicKey(); - const originAddress = Address.ofPublicKey(publicKeyDecoded); - const delegatedHash = - transaction.getTransactionHash(originAddress).bytes; - const delegatorSignature = - await this.buildVeChainSignatureFromPayload( - delegatedHash, - this.kmsVeChainDelegatorProvider - ); - return concatBytes(originSignature, delegatorSignature); - } else if ( - // If not, we try with the delegator URL - this.kmsVeChainDelegatorUrl !== undefined && - this.provider !== undefined - ) { - const originAddress = await this.getAddress(); - const delegatorSignature = await DelegationHandler({ - delegatorUrl: this.kmsVeChainDelegatorUrl - }).getDelegationSignatureUsingUrl( - transaction, - originAddress, - this.provider.thorClient.httpClient - ); - - return concatBytes(originSignature, delegatorSignature); - } - - return originSignature; - } - - /** - * It signs a transaction. - * @param transactionToSign Transaction body to sign in plain format. - * @returns {string} The signed transaction in hexadecimal format. - */ - public async signTransaction( - transactionToSign: TransactionRequestInput - ): Promise { - try { - // Populate the call, to get proper from and to address (compatible with multi-clause transactions) - const transactionBody = - await this.populateTransaction(transactionToSign); - - // Get the transaction object - const transaction = Transaction.of(transactionBody); - - // Sign the transaction hash using delegation if needed - const signature = - await this.concatSignatureIfDelegation(transaction); - - return Hex.of( - Transaction.of(transactionBody, signature).encoded - ).toString(); - } catch (error) { - throw new SignerMethodError( - 'KMSVeChainSigner.signTransaction', - 'The transaction could not be signed.', - { transactionToSign }, - error - ); - } - } - - /** - * Submits a signed transaction to the network. - * @param transactionToSend Transaction to be signed and sent to the network. - * @returns {string} The transaction ID. - */ - public async sendTransaction( - transactionToSend: TransactionRequestInput - ): Promise { - try { - // Sign the transaction - const signedTransaction = - await this.signTransaction(transactionToSend); - - // Send the signed transaction (the provider will always exist if it gets to this point) - return (await this.kmsVeChainProvider?.request({ - method: RPC_METHODS.eth_sendRawTransaction, - params: [signedTransaction] - })) as string; - } catch (error) { - throw new SignerMethodError( - 'KMSVeChainSigner.sendTransaction', - 'The transaction could not be sent.', - { transactionToSend }, - error - ); - } - } - - /** - * 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. - */ - 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(); - } -} - -export { KMSVeChainSigner }; diff --git a/packages/aws-kms-adapter/src/index.ts b/packages/aws-kms-adapter/src/index.ts deleted file mode 100644 index bc5be7721..000000000 --- a/packages/aws-kms-adapter/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { - KMSVeChainProvider, - type KMSClientParameters -} from './KMSVeChainProvider'; -export { KMSVeChainSigner } from './KMSVeChainSigner'; diff --git a/packages/aws-kms-adapter/tests/KMSVeChainProvider.unit.test.ts b/packages/aws-kms-adapter/tests/KMSVeChainProvider.unit.test.ts deleted file mode 100644 index 25b29712a..000000000 --- a/packages/aws-kms-adapter/tests/KMSVeChainProvider.unit.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { GetPublicKeyCommand, SignCommand } from '@aws-sdk/client-kms'; -import { ProviderMethodError } from '@vechain/sdk-errors'; -import { type ThorClient } from '@vechain/sdk-network'; -import { KMSVeChainProvider } from '../src'; -jest.mock('@aws-sdk/client-kms', () => ({ - GetPublicKeyCommand: jest.fn(), - SignCommand: jest.fn(), - MessageType: jest.fn(), - SigningAlgorithmSpec: jest.fn(), - KMSClient: jest.fn().mockImplementation(() => ({ - send: jest.fn().mockImplementation(async (command) => { - if (command instanceof GetPublicKeyCommand) { - return await Promise.resolve({ - PublicKey: undefined - }); - } - if (command instanceof SignCommand) { - return await Promise.resolve({ - Signature: undefined - }); - } - return await Promise.reject(new Error('Unknown command')); - }) - })) -})); - -/** - * AWS KMS VeChain provider tests - unit - * - * @group unit/providers/vechain-aws-kms-provider - */ -describe('KMSVeChainProvider', () => { - let instance: KMSVeChainProvider; - beforeEach(() => { - jest.clearAllMocks(); - instance = new KMSVeChainProvider({} as unknown as ThorClient, { - keyId: 'keyId', - region: 'region' - }); - }); - describe('constructor', () => { - it('should return the instance of the client', () => { - expect(instance).toBeInstanceOf(KMSVeChainProvider); - }); - it('should return an instance when credentials and no endpoint', () => { - const instance = new KMSVeChainProvider( - {} as unknown as ThorClient, - { - keyId: 'keyId', - region: 'region', - credentials: { - accessKeyId: 'accessKeyId', - secretAccessKey: 'secretAccess' - } - } - ); - expect(instance).toBeInstanceOf(KMSVeChainProvider); - }); - }); - describe('getSigner', () => { - it('should return the instance of the signer', async () => { - const signer = await instance.getSigner(); - expect(signer).toBeDefined(); - expect(signer).toBe(await instance.getSigner()); - }); - }); - describe('getPublicKey', () => { - it('should throw an error', async () => { - await expect(instance.getPublicKey()).rejects.toThrow( - ProviderMethodError - ); - }); - }); - describe('sign', () => { - it('should throw an error', async () => { - await expect(instance.sign(new Uint8Array([]))).rejects.toThrow( - ProviderMethodError - ); - }); - }); -}); diff --git a/packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts b/packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts deleted file mode 100644 index cd4f33379..000000000 --- a/packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts +++ /dev/null @@ -1,325 +0,0 @@ -import { - ABIContract, - Address, - Clause, - HexUInt, - Transaction, - type TransactionClause -} from '@vechain/sdk-core'; -import { signerUtils, THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network'; -import fs from 'fs'; -import path from 'path'; -import { - type KMSClientParameters, - KMSVeChainProvider, - KMSVeChainSigner -} from '../src'; -import { - EIP712_CONTRACT, - EIP712_FROM, - EIP712_TO, - fundVTHO, - signTransactionTestCases as sendTransactionTestCases, - signTransactionTestCases, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS, - timeout -} from './fixture'; - -// This variable should be replaced once this is clarified https://github.com/localstack/localstack/issues/11678 -let expectedAddress: string; - -/** - * AWS KMS VeChain signer tests - solo - * - * @group integration/signers/vechain-aws-kms-signer-solo - */ -describe('KMSVeChainSigner - Thor Solo', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - - /** - * KMSVeChainSigner instance - */ - let signer: KMSVeChainSigner; - - /** - * KMSVeChainSigner with delegator instance - */ - let signerWithDelegator: KMSVeChainSigner; - - /** - * Init thor client and provider before all tests - */ - beforeAll(async () => { - const awsCredentialsPath = path.resolve( - __dirname, - './aws-credentials.json' - ); - let awsClientParameters: KMSClientParameters; - let delegatorAwsClientParameters: KMSClientParameters; - try { - [awsClientParameters, delegatorAwsClientParameters] = JSON.parse( - fs.readFileSync(awsCredentialsPath, 'utf8') - ) as KMSClientParameters[]; - } catch (error) { - console.log('Loading test credentials'); - const testAwsCredentialsPath = path.resolve( - __dirname, - './test-aws-credentials.json' - ); - [awsClientParameters, delegatorAwsClientParameters] = JSON.parse( - fs.readFileSync(testAwsCredentialsPath, 'utf8') - ) as KMSClientParameters[]; - } - thorClient = ThorClient.at(THOR_SOLO_URL); - - // Signer with delegator disabled - signer = new KMSVeChainSigner( - new KMSVeChainProvider(thorClient, awsClientParameters) - ); - expectedAddress = await signer.getAddress(); - // This step should be removed once this is clarified https://github.com/localstack/localstack/issues/11678 - await fundVTHO(thorClient, expectedAddress); - - // Signer with delegator enabled - const delegatorProvider = new KMSVeChainProvider( - thorClient, - delegatorAwsClientParameters - ); - expect(delegatorProvider).toBeInstanceOf(KMSVeChainProvider); - signerWithDelegator = new KMSVeChainSigner( - new KMSVeChainProvider(thorClient, awsClientParameters, true), - { - provider: delegatorProvider - } - ); - // This step should be removed once this is clarified https://github.com/localstack/localstack/issues/11678 - await fundVTHO(thorClient, await signerWithDelegator.getAddress(true)); - }, timeout); - - describe('getAddress', () => { - test('should get the address from the public key', async () => { - expect(signer).toBeInstanceOf(KMSVeChainSigner); - expect(await signer.getAddress()).toBe(expectedAddress); - }); - }); - - /** - * Test suite for signTransaction method - */ - describe('signTransaction', () => { - /** - * signTransaction test cases with different options - */ - signTransactionTestCases.solo.correct.forEach( - ({ description, isDelegated, expected }) => { - test( - description, - async () => { - const signTransactionSigner = isDelegated - ? signerWithDelegator - : signer; - const sampleClause = Clause.callFunction( - Address.of(TESTING_CONTRACT_ADDRESS), - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - 'deposit' - ), - [123] - ) as TransactionClause; - - const originAddress = - await signTransactionSigner.getAddress(); - - const gasResult = await thorClient.gas.estimateGas( - [sampleClause], - originAddress - ); - - const txBody = - await thorClient.transactions.buildTransactionBody( - [sampleClause], - gasResult.totalGas, - { - isDelegated - } - ); - - const signedRawTx = - await signTransactionSigner.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - originAddress - ) - ); - const signedTx = Transaction.decode( - HexUInt.of(signedRawTx.slice(2)).bytes, - true - ); - - expect(signedTx).toBeDefined(); - expect(signedTx.body).toMatchObject(expected.body); - expect(signedTx.origin.toString()).toBe( - Address.checksum(HexUInt.of(originAddress)) - ); - expect(signedTx.isDelegated).toBe(isDelegated); - expect(signedTx.isSigned).toBe(true); - expect(signedTx.signature).toBeDefined(); - }, - timeout - ); - } - ); - }); - - /** - * Test suite for sendTransaction method - */ - describe('sendTransaction', () => { - /** - * sendTransaction test cases with different options - */ - sendTransactionTestCases.solo.correct.forEach( - ({ description, isDelegated }) => { - test( - description, - async () => { - const signTransactionSigner = isDelegated - ? signerWithDelegator - : signer; - const sampleClause = Clause.callFunction( - Address.of(TESTING_CONTRACT_ADDRESS), - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - 'deposit' - ), - [123] - ) as TransactionClause; - - const originAddress = - await signTransactionSigner.getAddress(); - - const gasResult = await thorClient.gas.estimateGas( - [sampleClause], - originAddress - ); - - const txBody = - await thorClient.transactions.buildTransactionBody( - [sampleClause], - gasResult.totalGas, - { - isDelegated - } - ); - - const receipt = - await signTransactionSigner.sendTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - originAddress - ) - ); - - expect( - /^0x([A-Fa-f0-9]{64})$/.exec(receipt) - ).toBeTruthy(); - }, - timeout - ); - } - ); - }); - - /** - * Test suite for signMessage method - */ - describe('signMessage', () => { - test('should sign a message successfully', async () => { - const message = 'Hello, VeChain!'; - const signature = await signer.signMessage(message); - expect(signature).toBeDefined(); - // 64-bytes hex string - expect(signature.length).toBe(132); - }); - }); - - /** - * Test suite for signTypedData method - */ - describe('signTypedData', () => { - test('should sign typed data successfully', async () => { - const typedData = { - domain: { - name: 'Ether Mail', - version: '1', - chainId: 1, - verifyingContract: EIP712_CONTRACT - }, - primaryType: 'Mail', - types: { - Person: [ - { - name: 'name', - type: 'string' - }, - { - name: 'wallet', - type: 'address' - } - ], - Mail: [ - { - name: 'from', - type: 'Person' - }, - { - name: 'to', - type: 'Person' - }, - { - name: 'contents', - type: 'string' - } - ] - }, - data: { - from: { - name: 'Cow', - wallet: EIP712_FROM - }, - to: { - name: 'Bob', - wallet: EIP712_TO - }, - contents: 'Hello, Bob!' - } - }; - const signature = await signer.signTypedData( - typedData.domain, - typedData.types, - typedData.data, - typedData.primaryType - ); - expect(signature).toBeDefined(); - // 64-bytes hex string - 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.testnet.test.ts b/packages/aws-kms-adapter/tests/KMSVeChainSigner.testnet.test.ts deleted file mode 100644 index 9c9d8d6a8..000000000 --- a/packages/aws-kms-adapter/tests/KMSVeChainSigner.testnet.test.ts +++ /dev/null @@ -1,157 +0,0 @@ -import { - ABIContract, - Address, - Clause, - HexUInt, - Transaction, - type TransactionClause -} from '@vechain/sdk-core'; -import { signerUtils, TESTNET_URL, ThorClient } from '@vechain/sdk-network'; -import fs from 'fs'; -import path from 'path'; -import { - type KMSClientParameters, - KMSVeChainProvider, - KMSVeChainSigner -} from '../src'; -import { - addAddressToFeeDelegationWhitelist, - removeAddressFromFeeDelegationWhitelist, - signTransactionTestCases, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS, - TESTNET_DELEGATE_URL, - timeout -} from './fixture'; - -/** - * AWS KMS VeChain signer tests - testnet - * - * @group integration/signers/vechain-aws-kms-signer-testnet - */ -describe('KMSVeChainSigner - Testnet', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - - /** - * KMSVeChainSigner with delegator instance - */ - let signerWithDelegator: KMSVeChainSigner; - - /** - * Init thor client and provider before all tests - */ - beforeAll(async () => { - const awsCredentialsPath = path.resolve( - __dirname, - './aws-credentials.json' - ); - let awsClientParameters: KMSClientParameters; - try { - [awsClientParameters] = JSON.parse( - fs.readFileSync(awsCredentialsPath, 'utf8') - ) as KMSClientParameters[]; - } catch (error) { - console.log('Loading test credentials'); - const testAwsCredentialsPath = path.resolve( - __dirname, - './test-aws-credentials.json' - ); - [awsClientParameters] = JSON.parse( - fs.readFileSync(testAwsCredentialsPath, 'utf8') - ) as KMSClientParameters[]; - } - thorClient = ThorClient.at(TESTNET_URL); - - signerWithDelegator = new KMSVeChainSigner( - new KMSVeChainProvider(thorClient, awsClientParameters, true), - { - url: TESTNET_DELEGATE_URL - } - ); - - await addAddressToFeeDelegationWhitelist( - thorClient, - await signerWithDelegator.getAddress() - ); - }, 4 * timeout); - - afterAll(async () => { - await removeAddressFromFeeDelegationWhitelist( - thorClient, - await signerWithDelegator.getAddress() - ); - }, 4 * timeout); - - describe('constructor', () => { - test('should create a new instance of KMSVeChainSigner', () => { - expect(() => new KMSVeChainSigner(undefined, {})).toThrow(); - }); - }); - - /** - * Test suite for signTransaction method - */ - describe('signTransaction', () => { - /** - * signTransaction test cases with different options - */ - signTransactionTestCases.testnet.correct.forEach( - ({ description, isDelegated, expected }) => { - test( - description, - async () => { - const sampleClause = Clause.callFunction( - Address.of(TESTING_CONTRACT_ADDRESS), - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - 'deposit' - ), - [123] - ) as TransactionClause; - - const originAddress = - await signerWithDelegator.getAddress(); - - const gasResult = await thorClient.gas.estimateGas( - [sampleClause], - originAddress - ); - - const txBody = - await thorClient.transactions.buildTransactionBody( - [sampleClause], - gasResult.totalGas, - { - isDelegated - } - ); - - const signedRawTx = - await signerWithDelegator.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - originAddress - ) - ); - const signedTx = Transaction.decode( - HexUInt.of(signedRawTx.slice(2)).bytes, - true - ); - - expect(signedTx).toBeDefined(); - expect(signedTx.body).toMatchObject(expected.body); - expect(signedTx.origin.toString()).toBe( - Address.checksum(HexUInt.of(originAddress)) - ); - expect(signedTx.isDelegated).toBe(isDelegated); - expect(signedTx.isSigned).toBe(true); - expect(signedTx.signature).toBeDefined(); - }, - timeout - ); - } - ); - }); -}); diff --git a/packages/aws-kms-adapter/tests/KMSVeChainSigner.unit.test.ts b/packages/aws-kms-adapter/tests/KMSVeChainSigner.unit.test.ts deleted file mode 100644 index 9dad5a409..000000000 --- a/packages/aws-kms-adapter/tests/KMSVeChainSigner.unit.test.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { Hex, Txt } from '@vechain/sdk-core'; -import { JSONRPCInvalidParams, SignerMethodError } from '@vechain/sdk-errors'; -import { - VeChainProvider, - type ThorClient, - type TransactionRequestInput, - type TypedDataDomain, - type TypedDataParameter -} from '@vechain/sdk-network'; -import { KMSVeChainProvider, KMSVeChainSigner } from '../src'; -import { EIP712_CONTRACT, EIP712_FROM, EIP712_TO } from './fixture'; -jest.mock('asn1js', () => ({ - Sequence: jest.fn(), - ObjectIdentifier: jest.fn(), - BitString: jest.fn(), - verifySchema: jest.fn().mockImplementation(() => ({ - verified: false - })) -})); - -/** - * AWS KMS VeChain signer tests - unit - * - * @group unit/signers/vechain-aws-kms-signer - */ -describe('KMSVeChainSigner', () => { - describe('constructor', () => { - it('should break if the provider is not a KMSVeChainProvider', () => { - expect( - () => - new KMSVeChainSigner( - new VeChainProvider({} as unknown as ThorClient) - ) - ).toThrow(JSONRPCInvalidParams); - }); - }); - describe('connect', () => { - it('should break if the provider is not a KMSVeChainProvider', () => { - const signer = new KMSVeChainSigner(); - expect(() => - signer.connect(new VeChainProvider({} as unknown as ThorClient)) - ).toThrow(SignerMethodError); - }); - }); - describe('getAddress', () => { - it('should break if there is no provider', async () => { - const signer = new KMSVeChainSigner(); - await expect(signer.getAddress()).rejects.toThrow( - SignerMethodError - ); - }); - it('should break if asn1 decoding fails', async () => { - const provider = new KMSVeChainProvider( - {} as unknown as ThorClient, - { keyId: 'keyId', region: 'region' } - ); - jest.spyOn(provider, 'getPublicKey').mockResolvedValue( - Txt.of('publicKey').bytes - ); - const signer = new KMSVeChainSigner(provider); - await expect(signer.getAddress()).rejects.toThrow( - SignerMethodError - ); - }); - }); - describe('signTransaction', () => { - it('should throw an error if there is an error in the body of the method', async () => { - const provider = new KMSVeChainProvider( - {} as unknown as ThorClient, - { keyId: 'keyId', region: 'region' } - ); - const signer = new KMSVeChainSigner(provider); - await expect( - signer.signTransaction({} as unknown as TransactionRequestInput) - ).rejects.toThrow(SignerMethodError); - }); - }); - describe('sendTransaction', () => { - it('should throw an error if there is an error in the body of the method', async () => { - const provider = new KMSVeChainProvider( - {} as unknown as ThorClient, - { keyId: 'keyId', region: 'region' } - ); - const signer = new KMSVeChainSigner(provider); - await expect( - signer.sendTransaction({} as unknown as TransactionRequestInput) - ).rejects.toThrow(SignerMethodError); - }); - }); - describe('signMessage', () => { - it('should throw an error if there is an error in the body of the method', async () => { - const provider = new KMSVeChainProvider( - {} as unknown as ThorClient, - { keyId: 'keyId', region: 'region' } - ); - const signer = new KMSVeChainSigner(provider); - await expect( - signer.signMessage({} as unknown as Uint8Array) - ).rejects.toThrow(SignerMethodError); - }); - }); - describe('signTypedData', () => { - it('should throw an error if there is no provider instance', async () => { - jest.spyOn(Hex, 'of').mockReturnValue(Hex.of('0x1')); - const signer = new KMSVeChainSigner(); - await expect( - signer.signTypedData( - { - name: 'Ether Mail', - version: '1', - chainId: 1, - verifyingContract: EIP712_CONTRACT - }, - { - Person: [ - { - name: 'name', - type: 'string' - }, - { - name: 'wallet', - type: 'address' - } - ], - Mail: [ - { - name: 'from', - type: 'Person' - }, - { - name: 'to', - type: 'Person' - }, - { - name: 'contents', - type: 'string' - } - ] - }, - { - from: { - name: 'Cow', - wallet: EIP712_FROM - }, - to: { - name: 'Bob', - wallet: EIP712_TO - }, - contents: 'Hello, Bob!' - }, - 'Mail' - ) - ).rejects.toThrow(SignerMethodError); - }); - it('should throw an error if there is an error in the body of the method', async () => { - const provider = new KMSVeChainProvider( - {} as unknown as ThorClient, - { keyId: 'keyId', region: 'region' } - ); - const signer = new KMSVeChainSigner(provider); - await expect( - signer.signTypedData( - {} as unknown as TypedDataDomain, - {} as unknown as Record, - {} as unknown as Record, - 'primaryType' - ) - ).rejects.toThrow(SignerMethodError); - }); - }); -}); diff --git a/packages/aws-kms-adapter/tests/fixture.ts b/packages/aws-kms-adapter/tests/fixture.ts deleted file mode 100644 index 1c1ae7860..000000000 --- a/packages/aws-kms-adapter/tests/fixture.ts +++ /dev/null @@ -1,1399 +0,0 @@ -import { ERC20_ABI, HexUInt, Mnemonic, VTHO_ADDRESS } from '@vechain/sdk-core'; -import { - ProviderInternalBaseWallet, - THOR_SOLO_ACCOUNTS, - type ThorClient, - type TransactionReceipt, - VeChainPrivateKeySigner, - VeChainProvider -} from '@vechain/sdk-network'; - -const timeout = 8000; // 8 seconds - -/** - * `TestingContract.sol` deployed contract address on thor-solo snapshot. - */ -const TESTING_CONTRACT_ADDRESS: string = - '0xb2c20a6de401003a671659b10629eb82ff254fb8'; - -/** - * ABI of the `TestingContract` smart contract. - */ -const TESTING_CONTRACT_ABI = [ - { - inputs: [ - { - internalType: 'string', - name: 'message', - type: 'string' - } - ], - name: 'CustomError', - type: 'error' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'newValue', - type: 'uint256' - }, - { - indexed: true, - internalType: 'uint256', - name: 'oldValue', - type: 'uint256' - }, - { - indexed: true, - internalType: 'address', - name: 'sender', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'timestamp', - type: 'uint256' - } - ], - name: 'StateChanged', - type: 'event' - }, - { - inputs: [ - { - internalType: 'address', - name: '_addressData', - type: 'address' - } - ], - name: 'addressData', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - name: 'balances', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bool', - name: '_boolData', - type: 'bool' - } - ], - name: 'boolData', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: '_byteData', - type: 'bytes32' - } - ], - name: 'bytes32Data', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes', - name: '_data', - type: 'bytes' - } - ], - name: 'calculateBlake2b256', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_amount', - type: 'uint256' - } - ], - name: 'deposit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256[]', - name: '_dynamicArrayData', - type: 'uint256[]' - } - ], - name: 'dynamicArrayData', - outputs: [ - { - internalType: 'uint256[]', - name: '', - type: 'uint256[]' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'enum TestingContract.ExampleEnum', - name: '_enumData', - type: 'uint8' - } - ], - name: 'enumData', - outputs: [ - { - internalType: 'enum TestingContract.ExampleEnum', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256[3]', - name: '_fixedArrayData', - type: 'uint256[3]' - } - ], - name: 'fixedArrayData', - outputs: [ - { - internalType: 'uint256[3]', - name: '', - type: 'uint256[3]' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - } - ], - name: 'getBalance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockID', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockSigner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockTime', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockTotalScore', - outputs: [ - { - internalType: 'uint64', - name: '', - type: 'uint64' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTotalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxBlockRef', - outputs: [ - { - internalType: 'bytes8', - name: '', - type: 'bytes8' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxExpiration', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxID', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxProvedWork', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'int256', - name: '_intData', - type: 'int256' - } - ], - name: 'intData', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_uintData', - type: 'uint256' - }, - { - internalType: 'address', - name: '_addressData', - type: 'address' - }, - { - internalType: 'bytes32', - name: '_byteData', - type: 'bytes32' - }, - { - internalType: 'string', - name: '_stringData', - type: 'string' - }, - { - internalType: 'uint256[3]', - name: '_fixedArrayData', - type: 'uint256[3]' - }, - { - internalType: 'uint256[]', - name: '_dynamicArrayData', - type: 'uint256[]' - }, - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '_structData', - type: 'tuple' - }, - { - internalType: 'enum TestingContract.ExampleEnum', - name: '_enumData', - type: 'uint8' - } - ], - name: 'multipleData', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - }, - { - internalType: 'address', - name: '', - type: 'address' - }, - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - }, - { - internalType: 'string', - name: '', - type: 'string' - }, - { - internalType: 'uint256[3]', - name: '', - type: 'uint256[3]' - }, - { - internalType: 'uint256[]', - name: '', - type: 'uint256[]' - }, - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '', - type: 'tuple' - }, - { - internalType: 'enum TestingContract.ExampleEnum', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint8', - name: '_uint8Data', - type: 'uint8' - }, - { - internalType: 'uint16', - name: '_uint16Data', - type: 'uint16' - }, - { - internalType: 'uint32', - name: '_uint32Data', - type: 'uint32' - }, - { - internalType: 'uint64', - name: '_uint64Data', - type: 'uint64' - }, - { - internalType: 'uint160', - name: '_uint160Data', - type: 'uint160' - }, - { - internalType: 'uint256', - name: '_uint256Data', - type: 'uint256' - } - ], - name: 'multipleIntData', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8' - }, - { - internalType: 'uint16', - name: '', - type: 'uint16' - }, - { - internalType: 'uint32', - name: '', - type: 'uint32' - }, - { - internalType: 'uint64', - name: '', - type: 'uint64' - }, - { - internalType: 'uint160', - name: '', - type: 'uint160' - }, - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_newValue', - type: 'uint256' - } - ], - name: 'setStateVariable', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'stateVariable', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'string', - name: '_stringData', - type: 'string' - } - ], - name: 'stringData', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '_structData', - type: 'tuple' - } - ], - name: 'structData', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '', - type: 'tuple' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testAssertError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testCustomError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [], - name: 'testInvalidOpcodeError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint8', - name: '_value', - type: 'uint8' - } - ], - name: 'testOverflowError', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testRequireError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testRevertError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_uintData', - type: 'uint256' - } - ], - name: 'uintData', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_amount', - type: 'uint256' - } - ], - name: 'withdraw', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -// This is private for EIP-712 unit test case only. Dummy address. -const EIP712_CONTRACT = '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'; - -// This is private for EIP-712 unit test case only. Dummy address. -const EIP712_FROM = '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826'; - -// This is private for EIP-712 unit test case only. Dummy address. -const EIP712_TO = '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB'; - -/** - * SignTransaction test cases - * Has both correct and incorrect for solo and an example of using delegatorUrl on testnet - */ -const signTransactionTestCases = { - solo: { - /** - * Correct test cases - */ - correct: [ - { - description: 'Should sign a transaction without delegation', - isDelegated: false, - expected: { - body: { - chainTag: 246, - clauses: [ - { - data: '0xb6b55f25000000000000000000000000000000000000000000000000000000000000007b', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: 0 - } - ], - dependsOn: null, - expiration: 32, - gas: 57491, - gasPriceCoef: 0 - } - } - }, - { - description: - 'Should sign a transaction with private key delegation', - isDelegated: true, - expected: { - body: { - chainTag: 246, - clauses: [ - { - data: '0xb6b55f25000000000000000000000000000000000000000000000000000000000000007b', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: 0 - } - ], - dependsOn: null, - expiration: 32, - gas: 57491, - gasPriceCoef: 0, - reserved: { - features: 1 - } - } - } - } - ] - }, - testnet: { - correct: [ - { - description: 'Should sign a transaction with delegation url', - isDelegated: true, - expected: { - body: { - chainTag: 39, - clauses: [ - { - data: '0xb6b55f25000000000000000000000000000000000000000000000000000000000000007b', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: 0 - } - ], - dependsOn: null, - expiration: 32, - gas: 21464, - gasPriceCoef: 0, - reserved: { - features: 1 - } - } - } - } - ] - } -}; - -const fundVTHO = async ( - thorClient: ThorClient, - receiverAddress: string -): Promise => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of(THOR_SOLO_ACCOUNTS[0].privateKey).bytes, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([]), - false - ) - ); - // Load the ERC20 contract - const contract = thorClient.contracts.load(VTHO_ADDRESS, ERC20_ABI, signer); - - const expectedVTHO = 200000000000000000000n; - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - const transferResult = await contract.transact.transfer( - { value: 0, comment: 'Transferring tokens' }, - receiverAddress, - expectedVTHO - ); - - // Wait for the transfer transaction to complete and obtain its receipt - const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - - // Verify that the transfer transaction did not revert - expect(transactionReceiptTransfer.reverted).toBe(false); - - // Execute a 'balanceOf' call on the contract to check the balance of the receiver - const balanceOfResult = await contract.read.balanceOf(receiverAddress); - expect(balanceOfResult).toStrictEqual([expectedVTHO]); -}; - -/** - * Delegate url fixture to test signing transactions with delegation by URL - */ -const TESTNET_DELEGATE_URL = 'https://sponsor-testnet.vechain.energy/by/705'; - -const FEE_DELEGATION_ABI = [ - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - }, - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'addAllowedRecipientFor', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: '_title', - type: 'bytes32' - } - ], - name: 'mintSponsorship', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - }, - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'addAllowedSenderFor', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - }, - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'addMaintainerFor', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'signerOf', - outputs: [ - { - internalType: 'address', - name: 'signer', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'contractOf', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'ownerOf', - outputs: [ - { - internalType: 'address', - name: 'owner', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32[]', - name: '_keys', - type: 'bytes32[]' - }, - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'getDataFor', - outputs: [ - { - internalType: 'bytes32[]', - name: '_values', - type: 'bytes32[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_tokenId', - type: 'uint256' - } - ], - name: 'requestWithdrawBalanceFor', - outputs: [], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'burn', - outputs: [], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'maintainersFor', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'allowedRecipientsFor', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'allowedSendersFor', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - }, - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'removeAllowedRecipientFor', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - }, - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'removeAllowedSenderFor', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - }, - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'removeMaintainerFor', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'maintainersFor', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - }, - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'setContractFor', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256' - } - ], - name: 'contractOf', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; - -const FEE_DELEGATION_ADDRESS = '0x0bc7cc67d618a9b5054183faa3b58a25bd5bb928'; - -const FEE_DELEGATION_PRIVATE_KEY = Mnemonic.toPrivateKey( - 'tone life garage donkey panic female night scout cram chair fade fork'.split( - ' ' - ) -); - -const addAddressToFeeDelegationWhitelist = async ( - thorClient: ThorClient, - address: string -): Promise => { - const signer = new VeChainPrivateKeySigner( - FEE_DELEGATION_PRIVATE_KEY, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([]), - false - ) - ); - // Load the FeeDelegation contract - const contract = thorClient.contracts.load( - FEE_DELEGATION_ADDRESS, - FEE_DELEGATION_ABI, - signer - ); - - // Execute a 'addAllowedSenderFor' transaction on the loaded contract - const whitelistResult = await contract.transact.addAllowedSenderFor( - address, - 705n - ); - - // Wait for the transfer transaction to complete and obtain its receipt - const whitelistTransactionReceipt = - (await whitelistResult.wait()) as TransactionReceipt; - - // Verify that the transfer transaction did not revert - expect(whitelistTransactionReceipt.reverted).toBe(false); - - const [[contractAddress]] = (await contract.read.allowedRecipientsFor( - 705n - )) as readonly [ReadonlyArray<`0x${string}`>]; - - if ( - contractAddress !== undefined && - contractAddress.toLowerCase() === TESTING_CONTRACT_ADDRESS - ) { - console.log( - `Contract address ${contractAddress} is already an allowed recipient for` - ); - return; - } - - // Execute a 'addAllowedRecipientFor' transaction on the loaded contract - const whitelistRecipientResult = - await contract.transact.addAllowedRecipientFor( - TESTING_CONTRACT_ADDRESS, - 705n - ); - - // Wait for the transfer transaction to complete and obtain its receipt - const whitelistRecipientTransactionReceipt = - (await whitelistRecipientResult.wait()) as TransactionReceipt; - - // Verify that the transfer transaction did not revert - expect(whitelistRecipientTransactionReceipt.reverted).toBe(false); -}; - -const removeAddressFromFeeDelegationWhitelist = async ( - thorClient: ThorClient, - address: string -): Promise => { - const signer = new VeChainPrivateKeySigner( - FEE_DELEGATION_PRIVATE_KEY, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([]), - false - ) - ); - // Load the FeeDelegation contract - const contract = thorClient.contracts.load( - FEE_DELEGATION_ADDRESS, - FEE_DELEGATION_ABI, - signer - ); - - // Execute a 'removeAllowedSenderFor' transaction on the loaded contract - const whitelistResult = await contract.transact.removeAllowedSenderFor( - address, - 705n - ); - - // Wait for the transfer transaction to complete and obtain its receipt - const whitelistTransactionReceipt = - (await whitelistResult.wait()) as TransactionReceipt; - - // Verify that the transfer transaction did not revert - expect(whitelistTransactionReceipt.reverted).toBe(false); - - // Execute a 'addAllowedRecipientFor' transaction on the loaded contract - const whitelistRecipientResult = - await contract.transact.removeAllowedRecipientFor( - TESTING_CONTRACT_ADDRESS, - 705n - ); - - // Wait for the transfer transaction to complete and obtain its receipt - const whitelistRecipientTransactionReceipt = - (await whitelistRecipientResult.wait()) as TransactionReceipt; - - // Verify that the transfer transaction did not revert - expect(whitelistRecipientTransactionReceipt.reverted).toBe(false); -}; - -export { - addAddressToFeeDelegationWhitelist, - EIP712_CONTRACT, - EIP712_FROM, - EIP712_TO, - fundVTHO, - removeAddressFromFeeDelegationWhitelist, - signTransactionTestCases, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS, - TESTNET_DELEGATE_URL, - timeout -}; diff --git a/packages/aws-kms-adapter/tests/test-aws-credentials.json b/packages/aws-kms-adapter/tests/test-aws-credentials.json deleted file mode 100644 index be703653b..000000000 --- a/packages/aws-kms-adapter/tests/test-aws-credentials.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "keyId": "bffb20d8-35ca-4408-9d54-f775b929b38d", - "region": "eu-west-1", - "credentials": { - "accessKeyId": "test", - "secretAccessKey": "test" - }, - "endpoint": "http://localhost:4599" - }, - { - "keyId": "3e47cac8-de37-4f50-b591-57f525c1b05c", - "region": "eu-west-1", - "credentials": { - "accessKeyId": "test", - "secretAccessKey": "test" - }, - "endpoint": "http://localhost:4599" - } -] - diff --git a/packages/aws-kms-adapter/tsconfig.json b/packages/aws-kms-adapter/tsconfig.json deleted file mode 100644 index c2e0c31ae..000000000 --- a/packages/aws-kms-adapter/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - }, - "include": [ - "./src/**/*.ts", - "./tests/**/*.ts", - ] -} \ No newline at end of file diff --git a/packages/aws-kms-adapter/typedoc.json b/packages/aws-kms-adapter/typedoc.json deleted file mode 100644 index b16806beb..000000000 --- a/packages/aws-kms-adapter/typedoc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": ["../../typedoc.base.json"], - "entryPoints": ["src/index.ts"] -} \ No newline at end of file diff --git a/packages/core/eslint.config.mjs b/packages/core/eslint.config.mjs index c621040f9..332be6112 100644 --- a/packages/core/eslint.config.mjs +++ b/packages/core/eslint.config.mjs @@ -8,7 +8,6 @@ export default [ zones: [{ target: "./src", from: [ - "../aws-kms-adapter", "../errors", "../ethers-adapter", "../hardhat-plugin", diff --git a/packages/errors/eslint.config.mjs b/packages/errors/eslint.config.mjs index f268b7a1d..78910dc4f 100644 --- a/packages/errors/eslint.config.mjs +++ b/packages/errors/eslint.config.mjs @@ -9,7 +9,6 @@ export default [ target: "./src", from: [ - "../aws-kms-adapter", "../core", "../ethers-adapter", "../hardhat-plugin", @@ -22,4 +21,4 @@ export default [ }], }], }, - }]; \ No newline at end of file + }]; diff --git a/packages/ethers-adapter/eslint.config.mjs b/packages/ethers-adapter/eslint.config.mjs index cba717729..cc1dd3b15 100644 --- a/packages/ethers-adapter/eslint.config.mjs +++ b/packages/ethers-adapter/eslint.config.mjs @@ -9,7 +9,6 @@ export default [ target: "./src", from: [ - "../aws-kms-adapter", "../core", "../errors", "../hardhat-plugin", @@ -22,4 +21,4 @@ export default [ }], }], }, - }]; \ No newline at end of file + }]; diff --git a/packages/hardhat-plugin/eslint.config.mjs b/packages/hardhat-plugin/eslint.config.mjs index 040433995..fc8238543 100644 --- a/packages/hardhat-plugin/eslint.config.mjs +++ b/packages/hardhat-plugin/eslint.config.mjs @@ -9,7 +9,6 @@ export default [ target: "./src", from: [ - "../aws-kms-adapter", "../core", "../errors", "../ethers-adapter", @@ -22,4 +21,4 @@ export default [ }], }], }, - }]; \ No newline at end of file + }]; diff --git a/packages/logging/eslint.config.mjs b/packages/logging/eslint.config.mjs index 419ce8875..d555f2cae 100644 --- a/packages/logging/eslint.config.mjs +++ b/packages/logging/eslint.config.mjs @@ -9,7 +9,6 @@ export default [ target: "./src", from: [ - "../aws-kms-adapter", "../core", "../errors", "../ethers-adapter", @@ -22,4 +21,4 @@ export default [ }], }], }, - }]; \ No newline at end of file + }]; diff --git a/packages/network/eslint.config.mjs b/packages/network/eslint.config.mjs index 16897a3f2..491344dfd 100644 --- a/packages/network/eslint.config.mjs +++ b/packages/network/eslint.config.mjs @@ -9,7 +9,6 @@ export default [ target: "./src", from: [ - "../aws-kms-adapter", "../core", "../errors", "../ethers-adapter", @@ -22,4 +21,4 @@ export default [ }], }], }, - }]; \ No newline at end of file + }]; diff --git a/packages/rpc-proxy/eslint.config.mjs b/packages/rpc-proxy/eslint.config.mjs index a801e91ea..612021f33 100644 --- a/packages/rpc-proxy/eslint.config.mjs +++ b/packages/rpc-proxy/eslint.config.mjs @@ -9,7 +9,6 @@ export default [ target: "./src", from: [ - "../aws-kms-adapter", "../core", "../errors", "../ethers-adapter", @@ -22,4 +21,4 @@ export default [ }], }], }, - }]; \ No newline at end of file + }]; diff --git a/yarn.lock b/yarn.lock index 0873a6a69..382ec1cb3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20,454 +20,6 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@aws-crypto/sha256-browser@5.2.0": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz#153895ef1dba6f9fce38af550e0ef58988eb649e" - integrity sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw== - dependencies: - "@aws-crypto/sha256-js" "^5.2.0" - "@aws-crypto/supports-web-crypto" "^5.2.0" - "@aws-crypto/util" "^5.2.0" - "@aws-sdk/types" "^3.222.0" - "@aws-sdk/util-locate-window" "^3.0.0" - "@smithy/util-utf8" "^2.0.0" - tslib "^2.6.2" - -"@aws-crypto/sha256-js@5.2.0", "@aws-crypto/sha256-js@^5.2.0": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz#c4fdb773fdbed9a664fc1a95724e206cf3860042" - integrity sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA== - dependencies: - "@aws-crypto/util" "^5.2.0" - "@aws-sdk/types" "^3.222.0" - tslib "^2.6.2" - -"@aws-crypto/supports-web-crypto@^5.2.0": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz#a1e399af29269be08e695109aa15da0a07b5b5fb" - integrity sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg== - dependencies: - tslib "^2.6.2" - -"@aws-crypto/util@^5.2.0": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@aws-crypto/util/-/util-5.2.0.tgz#71284c9cffe7927ddadac793c14f14886d3876da" - integrity sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ== - dependencies: - "@aws-sdk/types" "^3.222.0" - "@smithy/util-utf8" "^2.0.0" - tslib "^2.6.2" - -"@aws-sdk/client-kms@^3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-kms/-/client-kms-3.723.0.tgz#25b91b2dd8e25242e60ca0f67734686f3bb27b31" - integrity sha512-8myHtlBFEUk5RHZlbprWK+qqZNsWTCPaE9M2KxcsTd8nqoNsMGZFcvjiQDi6Nt09MEd8X8/yPpiC34i8y4fKLQ== - dependencies: - "@aws-crypto/sha256-browser" "5.2.0" - "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/client-sso-oidc" "3.723.0" - "@aws-sdk/client-sts" "3.723.0" - "@aws-sdk/core" "3.723.0" - "@aws-sdk/credential-provider-node" "3.723.0" - "@aws-sdk/middleware-host-header" "3.723.0" - "@aws-sdk/middleware-logger" "3.723.0" - "@aws-sdk/middleware-recursion-detection" "3.723.0" - "@aws-sdk/middleware-user-agent" "3.723.0" - "@aws-sdk/region-config-resolver" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@aws-sdk/util-endpoints" "3.723.0" - "@aws-sdk/util-user-agent-browser" "3.723.0" - "@aws-sdk/util-user-agent-node" "3.723.0" - "@smithy/config-resolver" "^4.0.0" - "@smithy/core" "^3.0.0" - "@smithy/fetch-http-handler" "^5.0.0" - "@smithy/hash-node" "^4.0.0" - "@smithy/invalid-dependency" "^4.0.0" - "@smithy/middleware-content-length" "^4.0.0" - "@smithy/middleware-endpoint" "^4.0.0" - "@smithy/middleware-retry" "^4.0.0" - "@smithy/middleware-serde" "^4.0.0" - "@smithy/middleware-stack" "^4.0.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/node-http-handler" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/url-parser" "^4.0.0" - "@smithy/util-base64" "^4.0.0" - "@smithy/util-body-length-browser" "^4.0.0" - "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.0" - "@smithy/util-defaults-mode-node" "^4.0.0" - "@smithy/util-endpoints" "^3.0.0" - "@smithy/util-middleware" "^4.0.0" - "@smithy/util-retry" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/client-sso-oidc@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.723.0.tgz#d2111164c2563dead8c87291f0c6073ebebe1dde" - integrity sha512-9IH90m4bnHogBctVna2FnXaIGVORncfdxcqeEIovOxjIJJyHDmEAtA7B91dAM4sruddTbVzOYnqfPVst3odCbA== - dependencies: - "@aws-crypto/sha256-browser" "5.2.0" - "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.723.0" - "@aws-sdk/credential-provider-node" "3.723.0" - "@aws-sdk/middleware-host-header" "3.723.0" - "@aws-sdk/middleware-logger" "3.723.0" - "@aws-sdk/middleware-recursion-detection" "3.723.0" - "@aws-sdk/middleware-user-agent" "3.723.0" - "@aws-sdk/region-config-resolver" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@aws-sdk/util-endpoints" "3.723.0" - "@aws-sdk/util-user-agent-browser" "3.723.0" - "@aws-sdk/util-user-agent-node" "3.723.0" - "@smithy/config-resolver" "^4.0.0" - "@smithy/core" "^3.0.0" - "@smithy/fetch-http-handler" "^5.0.0" - "@smithy/hash-node" "^4.0.0" - "@smithy/invalid-dependency" "^4.0.0" - "@smithy/middleware-content-length" "^4.0.0" - "@smithy/middleware-endpoint" "^4.0.0" - "@smithy/middleware-retry" "^4.0.0" - "@smithy/middleware-serde" "^4.0.0" - "@smithy/middleware-stack" "^4.0.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/node-http-handler" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/url-parser" "^4.0.0" - "@smithy/util-base64" "^4.0.0" - "@smithy/util-body-length-browser" "^4.0.0" - "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.0" - "@smithy/util-defaults-mode-node" "^4.0.0" - "@smithy/util-endpoints" "^3.0.0" - "@smithy/util-middleware" "^4.0.0" - "@smithy/util-retry" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/client-sso@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.723.0.tgz#4fb8c88a9cb45456bb84c716d39b0f2638bde395" - integrity sha512-r1ddZDb8yPmdofX1gQ4m8oqKozgkgVONLlAuSprGObbyMy8bYt1Psxu+GjnwMmgVu3vlF069PHyW1ndrBiL1zA== - dependencies: - "@aws-crypto/sha256-browser" "5.2.0" - "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.723.0" - "@aws-sdk/middleware-host-header" "3.723.0" - "@aws-sdk/middleware-logger" "3.723.0" - "@aws-sdk/middleware-recursion-detection" "3.723.0" - "@aws-sdk/middleware-user-agent" "3.723.0" - "@aws-sdk/region-config-resolver" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@aws-sdk/util-endpoints" "3.723.0" - "@aws-sdk/util-user-agent-browser" "3.723.0" - "@aws-sdk/util-user-agent-node" "3.723.0" - "@smithy/config-resolver" "^4.0.0" - "@smithy/core" "^3.0.0" - "@smithy/fetch-http-handler" "^5.0.0" - "@smithy/hash-node" "^4.0.0" - "@smithy/invalid-dependency" "^4.0.0" - "@smithy/middleware-content-length" "^4.0.0" - "@smithy/middleware-endpoint" "^4.0.0" - "@smithy/middleware-retry" "^4.0.0" - "@smithy/middleware-serde" "^4.0.0" - "@smithy/middleware-stack" "^4.0.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/node-http-handler" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/url-parser" "^4.0.0" - "@smithy/util-base64" "^4.0.0" - "@smithy/util-body-length-browser" "^4.0.0" - "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.0" - "@smithy/util-defaults-mode-node" "^4.0.0" - "@smithy/util-endpoints" "^3.0.0" - "@smithy/util-middleware" "^4.0.0" - "@smithy/util-retry" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/client-sts@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sts/-/client-sts-3.723.0.tgz#18f9f612ce2d77e4e5c2a4c979521daef44e78a5" - integrity sha512-YyN8x4MI/jMb4LpHsLf+VYqvbColMK8aZeGWVk2fTFsmt8lpTYGaGC1yybSwGX42mZ4W8ucu8SAYSbUraJZEjA== - dependencies: - "@aws-crypto/sha256-browser" "5.2.0" - "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/client-sso-oidc" "3.723.0" - "@aws-sdk/core" "3.723.0" - "@aws-sdk/credential-provider-node" "3.723.0" - "@aws-sdk/middleware-host-header" "3.723.0" - "@aws-sdk/middleware-logger" "3.723.0" - "@aws-sdk/middleware-recursion-detection" "3.723.0" - "@aws-sdk/middleware-user-agent" "3.723.0" - "@aws-sdk/region-config-resolver" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@aws-sdk/util-endpoints" "3.723.0" - "@aws-sdk/util-user-agent-browser" "3.723.0" - "@aws-sdk/util-user-agent-node" "3.723.0" - "@smithy/config-resolver" "^4.0.0" - "@smithy/core" "^3.0.0" - "@smithy/fetch-http-handler" "^5.0.0" - "@smithy/hash-node" "^4.0.0" - "@smithy/invalid-dependency" "^4.0.0" - "@smithy/middleware-content-length" "^4.0.0" - "@smithy/middleware-endpoint" "^4.0.0" - "@smithy/middleware-retry" "^4.0.0" - "@smithy/middleware-serde" "^4.0.0" - "@smithy/middleware-stack" "^4.0.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/node-http-handler" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/url-parser" "^4.0.0" - "@smithy/util-base64" "^4.0.0" - "@smithy/util-body-length-browser" "^4.0.0" - "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.0" - "@smithy/util-defaults-mode-node" "^4.0.0" - "@smithy/util-endpoints" "^3.0.0" - "@smithy/util-middleware" "^4.0.0" - "@smithy/util-retry" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/core@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.723.0.tgz#7a441b1362fa22609f80ede42d4e069829b9b4d1" - integrity sha512-UraXNmvqj3vScSsTkjMwQkhei30BhXlW5WxX6JacMKVtl95c7z0qOXquTWeTalYkFfulfdirUhvSZrl+hcyqTw== - dependencies: - "@aws-sdk/types" "3.723.0" - "@smithy/core" "^3.0.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/signature-v4" "^5.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-middleware" "^4.0.0" - fast-xml-parser "4.4.1" - tslib "^2.6.2" - -"@aws-sdk/credential-provider-env@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.723.0.tgz#7d85014d21ce50f9f6a108c5c673e87c54860eaa" - integrity sha512-OuH2yULYUHTVDUotBoP/9AEUIJPn81GQ/YBtZLoo2QyezRJ2QiO/1epVtbJlhNZRwXrToLEDmQGA2QfC8c7pbA== - dependencies: - "@aws-sdk/core" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/credential-provider-http@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.723.0.tgz#3b5db3225bb6dd97fecf22e18c06c3567eb1bce4" - integrity sha512-DTsKC6xo/kz/ZSs1IcdbQMTgiYbpGTGEd83kngFc1bzmw7AmK92DBZKNZpumf8R/UfSpTcj9zzUUmrWz1kD0eQ== - dependencies: - "@aws-sdk/core" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@smithy/fetch-http-handler" "^5.0.0" - "@smithy/node-http-handler" "^4.0.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-stream" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/credential-provider-ini@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.723.0.tgz#3dc8e8d88d0c66a7ba890b5c510ced86fd98c066" - integrity sha512-fWRLksuSG851e7Iu+ltMrQTM7C/5iI9OkxAmCYblcCetAzjTRmMB2arku0Z83D8edIZEQtOJMt5oQ9KNg43pzg== - dependencies: - "@aws-sdk/core" "3.723.0" - "@aws-sdk/credential-provider-env" "3.723.0" - "@aws-sdk/credential-provider-http" "3.723.0" - "@aws-sdk/credential-provider-process" "3.723.0" - "@aws-sdk/credential-provider-sso" "3.723.0" - "@aws-sdk/credential-provider-web-identity" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@smithy/credential-provider-imds" "^4.0.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/shared-ini-file-loader" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/credential-provider-node@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.723.0.tgz#9e136a8c6df2324ff0d82e18f8ec22181bb0f25b" - integrity sha512-OyLHt+aY+rkuRejigcxviS5RLUBcqbxhDTSNfP8dp9I+1SP610qRLpTIROvtKwXZssFcATpPfgikFtVYRrihXQ== - dependencies: - "@aws-sdk/credential-provider-env" "3.723.0" - "@aws-sdk/credential-provider-http" "3.723.0" - "@aws-sdk/credential-provider-ini" "3.723.0" - "@aws-sdk/credential-provider-process" "3.723.0" - "@aws-sdk/credential-provider-sso" "3.723.0" - "@aws-sdk/credential-provider-web-identity" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@smithy/credential-provider-imds" "^4.0.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/shared-ini-file-loader" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/credential-provider-process@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.723.0.tgz#32bc55573b0a8f31e69b15939202d266adbbe711" - integrity sha512-fgupvUjz1+jeoCBA7GMv0L6xEk92IN6VdF4YcFhsgRHlHvNgm7ayaoKQg7pz2JAAhG/3jPX6fp0ASNy+xOhmPA== - dependencies: - "@aws-sdk/core" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/shared-ini-file-loader" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/credential-provider-sso@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.723.0.tgz#b05a9bff698de12be9b929802cd85538adfccc36" - integrity sha512-laCnxrk0pgUegU+ib6rj1/Uv51wei+cH8crvBJddybc8EDn7Qht61tCvBwf3o33qUDC+ZWZZewlpSebf+J+tBw== - dependencies: - "@aws-sdk/client-sso" "3.723.0" - "@aws-sdk/core" "3.723.0" - "@aws-sdk/token-providers" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/shared-ini-file-loader" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/credential-provider-web-identity@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.723.0.tgz#5c17ea243b05b4dca0584db597ac68d8509dd754" - integrity sha512-tl7pojbFbr3qLcOE6xWaNCf1zEfZrIdSJtOPeSXfV/thFMMAvIjgf3YN6Zo1a6cxGee8zrV/C8PgOH33n+Ev/A== - dependencies: - "@aws-sdk/core" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/middleware-host-header@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-host-header/-/middleware-host-header-3.723.0.tgz#f043689755e5b45ee6500b0d0a7090d9b4a864f7" - integrity sha512-LLVzLvk299pd7v4jN9yOSaWDZDfH0SnBPb6q+FDPaOCMGBY8kuwQso7e/ozIKSmZHRMGO3IZrflasHM+rI+2YQ== - dependencies: - "@aws-sdk/types" "3.723.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/middleware-logger@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-logger/-/middleware-logger-3.723.0.tgz#e8718056fc2d73a0d51308cad20676228be26652" - integrity sha512-chASQfDG5NJ8s5smydOEnNK7N0gDMyuPbx7dYYcm1t/PKtnVfvWF+DHCTrRC2Ej76gLJVCVizlAJKM8v8Kg3cg== - dependencies: - "@aws-sdk/types" "3.723.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/middleware-recursion-detection@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.723.0.tgz#b4557c7f554492f56eeb0cbf5bc02dac7ef102a8" - integrity sha512-7usZMtoynT9/jxL/rkuDOFQ0C2mhXl4yCm67Rg7GNTstl67u7w5WN1aIRImMeztaKlw8ExjoTyo6WTs1Kceh7A== - dependencies: - "@aws-sdk/types" "3.723.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/middleware-user-agent@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.723.0.tgz#a989ddebd490e8fa4fc7d3d6f12bd5c81afc7ae7" - integrity sha512-AY5H2vD3IRElplBO4DCyRMNnOG/4/cb0tsHyLe1HJy0hdUF6eY5z/VVjKJoKbbDk7ui9euyOBWslXxDyLmyPWg== - dependencies: - "@aws-sdk/core" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@aws-sdk/util-endpoints" "3.723.0" - "@smithy/core" "^3.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/region-config-resolver@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/region-config-resolver/-/region-config-resolver-3.723.0.tgz#07b7ee4788ec7a7f5638bbbe0f9f7565125caf22" - integrity sha512-tGF/Cvch3uQjZIj34LY2mg8M2Dr4kYG8VU8Yd0dFnB1ybOEOveIK/9ypUo9ycZpB9oO6q01KRe5ijBaxNueUQg== - dependencies: - "@aws-sdk/types" "3.723.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-config-provider" "^4.0.0" - "@smithy/util-middleware" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/token-providers@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.723.0.tgz#ae173a18783886e592212abb820d28cbdb9d9237" - integrity sha512-hniWi1x4JHVwKElANh9afKIMUhAutHVBRD8zo6usr0PAoj+Waf220+1ULS74GXtLXAPCiNXl5Og+PHA7xT8ElQ== - dependencies: - "@aws-sdk/types" "3.723.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/shared-ini-file-loader" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/types@3.723.0", "@aws-sdk/types@^3.222.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.723.0.tgz#f0c5a6024a73470421c469b6c1dd5bc4b8fb851b" - integrity sha512-LmK3kwiMZG1y5g3LGihT9mNkeNOmwEyPk6HGcJqh0wOSV4QpWoKu2epyKE4MLQNUUlz2kOVbVbOrwmI6ZcteuA== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@aws-sdk/util-endpoints@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-endpoints/-/util-endpoints-3.723.0.tgz#de645ddebf29e40582a651351935bdf995820a94" - integrity sha512-vR1ZfAUvrTtdA1Q78QxgR8TFgi2gzk+N4EmNjbyR5hHmeOXuaKRdhbNQAzLPYVe1aNUpoiy9cl8mWkg9SrNHBw== - dependencies: - "@aws-sdk/types" "3.723.0" - "@smithy/types" "^4.0.0" - "@smithy/util-endpoints" "^3.0.0" - tslib "^2.6.2" - -"@aws-sdk/util-locate-window@^3.0.0": - version "3.568.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-locate-window/-/util-locate-window-3.568.0.tgz#2acc4b2236af0d7494f7e517401ba6b3c4af11ff" - integrity sha512-3nh4TINkXYr+H41QaPelCceEB2FXP3fxp93YZXB/kqJvX0U9j0N0Uk45gvsjmEPzG8XxkPEeLIfT2I1M7A6Lig== - dependencies: - tslib "^2.6.2" - -"@aws-sdk/util-user-agent-browser@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.723.0.tgz#64b0b4413c1be1585f95c3e2606429cc9f86df83" - integrity sha512-Wh9I6j2jLhNFq6fmXydIpqD1WyQLyTfSxjW9B+PXSnPyk3jtQW8AKQur7p97rO8LAUzVI0bv8kb3ZzDEVbquIg== - dependencies: - "@aws-sdk/types" "3.723.0" - "@smithy/types" "^4.0.0" - bowser "^2.11.0" - tslib "^2.6.2" - -"@aws-sdk/util-user-agent-node@3.723.0": - version "3.723.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.723.0.tgz#289831fd85edce37eb600caea84d12456a8a997c" - integrity sha512-uCtW5sGq8jCwA9w57TvVRIwNnPbSDD1lJaTIgotf7Jit2bTrYR64thgMy/drL5yU5aHOdFIQljqn/5aDXLtTJw== - dependencies: - "@aws-sdk/middleware-user-agent" "3.723.0" - "@aws-sdk/types" "3.723.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.25.7": version "7.25.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.25.7.tgz#438f2c524071531d643c6f0188e1e28f130cebc7" @@ -3160,399 +2712,6 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@smithy/abort-controller@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/abort-controller/-/abort-controller-4.0.0.tgz#c28e4e39191fde8ce93a595cd89f646dcb597632" - integrity sha512-xFNL1ZfluscKiVI0qlPEnu7pL1UgNNIzQdjTPkaO7JCJtIkbArPYNtqbxohuNaQdksJ01Tn1wLbDA5oIp62P8w== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/config-resolver@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/config-resolver/-/config-resolver-4.0.0.tgz#0f24a0f47fcbc8749bf5cb0cbfa19a291073bd59" - integrity sha512-29pIDlUY/a9+ChJPAarPiD9cU8fBtBh0wFnmnhj7j5AhgMzc+uyXdfzmziH6xx2jzw54waSP3HfnFkTANZuPYA== - dependencies: - "@smithy/node-config-provider" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-config-provider" "^4.0.0" - "@smithy/util-middleware" "^4.0.0" - tslib "^2.6.2" - -"@smithy/core@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@smithy/core/-/core-3.0.0.tgz#087f4da0100b824b6ec8b8c2ef74f6decdd61ce2" - integrity sha512-pKaas7RWvPljJ8uByCeBa10rtbVJCy4N/Fr7OSPxFezcyG0SQuXWnESZqzXj7m2+A+kPzG6fKyP4wrKidl2Ikg== - dependencies: - "@smithy/middleware-serde" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-body-length-browser" "^4.0.0" - "@smithy/util-middleware" "^4.0.0" - "@smithy/util-stream" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@smithy/credential-provider-imds@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/credential-provider-imds/-/credential-provider-imds-4.0.0.tgz#3fbee0d9203462a195cc3e9ac886907e997c38a0" - integrity sha512-+hTShyZHiq2AVFOxJja3k6O17DKU6TaZbwr2y1OH5HQtUw2a+7O3mMR+10LVmc39ef72SAj+uFX0IW9rJGaLQQ== - dependencies: - "@smithy/node-config-provider" "^4.0.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/url-parser" "^4.0.0" - tslib "^2.6.2" - -"@smithy/fetch-http-handler@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@smithy/fetch-http-handler/-/fetch-http-handler-5.0.0.tgz#f432a59e9fd6a066364e7159914e2fec0e475632" - integrity sha512-jUEq+4056uqsDLRqQb1fm48rrSMBYcBxVvODfiP37ORcV5n9xWJQsINWcIffyYxWTM5K0Y/GOfhSQGDtWpAPpQ== - dependencies: - "@smithy/protocol-http" "^5.0.0" - "@smithy/querystring-builder" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-base64" "^4.0.0" - tslib "^2.6.2" - -"@smithy/hash-node@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/hash-node/-/hash-node-4.0.0.tgz#1f6244f830f80ce196966e8ad4578bd60d1057d1" - integrity sha512-25OxGYGnG3JPEOTk4iFE03bfmoC6GXUQ4L13z4cNdsS3mkncH22AGSDRfKwwEqutNUxXQZWVy9f72Fm59C9qlg== - dependencies: - "@smithy/types" "^4.0.0" - "@smithy/util-buffer-from" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@smithy/invalid-dependency@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/invalid-dependency/-/invalid-dependency-4.0.0.tgz#69180b347b122b1ae46691697d0eb5ff8ed777ff" - integrity sha512-0GTyet02HX/sPctEhOExY+3HI7hwkVwOoJg0XnItTJ+Xw7JMuL9FOxALTmKVIV6+wg0kF6veLeg72hVSbD9UCw== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/is-array-buffer@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz#f84f0d9f9a36601a9ca9381688bd1b726fd39111" - integrity sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA== - dependencies: - tslib "^2.6.2" - -"@smithy/is-array-buffer@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/is-array-buffer/-/is-array-buffer-4.0.0.tgz#55a939029321fec462bcc574890075cd63e94206" - integrity sha512-saYhF8ZZNoJDTvJBEWgeBccCg+yvp1CX+ed12yORU3NilJScfc6gfch2oVb4QgxZrGUx3/ZJlb+c/dJbyupxlw== - dependencies: - tslib "^2.6.2" - -"@smithy/middleware-content-length@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/middleware-content-length/-/middleware-content-length-4.0.0.tgz#b860215d325ee8484b729f315d9b85d84d6d5c34" - integrity sha512-nM1RJqLwkSCidumGK8WwNEZ0a0D/4LkwqdPna+QmHrdPoAK6WGLyZFosdMpsAW1OIbDLWGa+r37Mo4Vth4S4kQ== - dependencies: - "@smithy/protocol-http" "^5.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/middleware-endpoint@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/middleware-endpoint/-/middleware-endpoint-4.0.0.tgz#fe727b28452bc3fe85399521daab7600966e4174" - integrity sha512-/f6z5SqUurmqemhBZNhM0c+C7QW0AY/zJpic//sbdu26q98HSPAI/xvzStjYq+UhtWeAe/jaX6gamdL/2r3W1g== - dependencies: - "@smithy/core" "^3.0.0" - "@smithy/middleware-serde" "^4.0.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/shared-ini-file-loader" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/url-parser" "^4.0.0" - "@smithy/util-middleware" "^4.0.0" - tslib "^2.6.2" - -"@smithy/middleware-retry@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-4.0.0.tgz#35c6ad71a6d662ed2d718bb5ca0b87593cf1433a" - integrity sha512-K6tsFp3Ik44H3694a+LWoXLV8mqy8zn6/vTw2feU72MaIzi51EHMVNNxxpL6e2GI6oxw8FFRGWgGn8+wQRrHZQ== - dependencies: - "@smithy/node-config-provider" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/service-error-classification" "^4.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-middleware" "^4.0.0" - "@smithy/util-retry" "^4.0.0" - tslib "^2.6.2" - uuid "^9.0.1" - -"@smithy/middleware-serde@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/middleware-serde/-/middleware-serde-4.0.0.tgz#cbb22e84f297e7089f988364325d36d508791fd8" - integrity sha512-aW4Zo8Cm988RCvhysErzqrQ4YPKgZFhajvgPoZnsWIDaZfT419J17Ahr13Lul3kqGad2dCz7YOrXd7r+UAEj/w== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/middleware-stack@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/middleware-stack/-/middleware-stack-4.0.0.tgz#d4d818fc70d44a76a616f990bee4075608a46f0e" - integrity sha512-4NFaX88RmgVrCyJv/3RsSdqMwxzI/EQa8nvhUDVxmLUMRS2JUdHnliD6IwKuqIwIzz+E1aZK3EhSHUM4HXp3ww== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/node-config-provider@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/node-config-provider/-/node-config-provider-4.0.0.tgz#950c451951ddd4e22c4e5ba1178893ade8124303" - integrity sha512-Crp9rg1ewjqgM2i7pWSpNhfbBa0usyKGDVQLEXTOpu6trFqq3BFLLCgbCE1S18h6mxqKnOqUONq3nWOxUk75XA== - dependencies: - "@smithy/property-provider" "^4.0.0" - "@smithy/shared-ini-file-loader" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/node-http-handler@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/node-http-handler/-/node-http-handler-4.0.0.tgz#d90cdb19cc25c05a077278c07e776a6949944791" - integrity sha512-WvumtEaFyxaI95zmj6eYlF/vCFCKNyru3P/UUHCUS9BjvajUtNckH2cY3bBfi+qqMPX5gha4g26lcOlE/wPz/Q== - dependencies: - "@smithy/abort-controller" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/querystring-builder" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/property-provider@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/property-provider/-/property-provider-4.0.0.tgz#5e328d086a867646b147d55a8551aec9d2e318b2" - integrity sha512-AJSvY1k3SdM0stGrIjL8/FIjXO7X9I7KkznXDmr76RGz+yvaDHLsLm2hSHyzAlmwEQnHaafSU2dwaV0JcnR/4w== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/protocol-http@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@smithy/protocol-http/-/protocol-http-5.0.0.tgz#bd395e6b6271dcebdef5d846a5dab050fc9c57c9" - integrity sha512-laAcIHWq9GQ5VdAS71DUrCj5HUHZ/89Ee+HRTLhFR5/E3toBlnZfPG+kqBajwfEB5aSdRuKslfzl5Dzrn3pr8A== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/querystring-builder@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/querystring-builder/-/querystring-builder-4.0.0.tgz#7eb2d94d5f9f5d7ef3a003c90af83a1ee734ee42" - integrity sha512-kMqPDRf+/hwm+Dmk8AQCaYTJxNWWpNdJJteeMm0jwDbmRDqSqHQ7oLEVzvOnbWJu1poVtOhv6v7jsbyx9JASsw== - dependencies: - "@smithy/types" "^4.0.0" - "@smithy/util-uri-escape" "^4.0.0" - tslib "^2.6.2" - -"@smithy/querystring-parser@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/querystring-parser/-/querystring-parser-4.0.0.tgz#d21b7d1396d863d3498a72d561955b5dc77670d7" - integrity sha512-SbogL1PNEmm28ya0eK2S0EZEbYwe0qpaqSGrODm+uYS6dQ7pekPLVNXjBRuuLIAT26ZF2wTsp6X7AVRBNZd8qw== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/service-error-classification@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/service-error-classification/-/service-error-classification-4.0.0.tgz#91eca0ac1a454e2166ee1f86577cdc5308115778" - integrity sha512-hIZreT6aXSG0PK/psT1S+kfeGTnYnRRlf7rU3yDmH/crSVjTbS/5h5w2J7eO2ODrQb3xfhJcYxQBREdwsZk6TA== - dependencies: - "@smithy/types" "^4.0.0" - -"@smithy/shared-ini-file-loader@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-4.0.0.tgz#ee8334f935138c92e11699bc81be5d1f76e6dce3" - integrity sha512-Ktupe8msp2GPaKKVfiz3NNUNnslJiGGRoVh3BDpm/RChkQ5INQpqmTc2taE0XChNYumNynLfb3keekIPaiaZeg== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/signature-v4@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-5.0.0.tgz#176ab46d0e161f5e7a08aa3b39930fb0e154ee15" - integrity sha512-zqcOR1sZTuoA6K3PBNwzu4YgT1pmIwz47tYpgaJjBTfGUIMtcjUaXKtuSKEScdv+0wx45/PbXz0//hk80fky3w== - dependencies: - "@smithy/is-array-buffer" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-hex-encoding" "^4.0.0" - "@smithy/util-middleware" "^4.0.0" - "@smithy/util-uri-escape" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@smithy/smithy-client@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-4.0.0.tgz#06bff6c99bfe4b9332a299721c367327eae98c92" - integrity sha512-AgcZ6B+JuqArYioAbaYrCpTCjYsD3/1hPSXntbN2ipsfc4hE+72RFZevUPYgsKxpy3G+QxuLfqm11i3+oX4oSA== - dependencies: - "@smithy/core" "^3.0.0" - "@smithy/middleware-endpoint" "^4.0.0" - "@smithy/middleware-stack" "^4.0.0" - "@smithy/protocol-http" "^5.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-stream" "^4.0.0" - tslib "^2.6.2" - -"@smithy/types@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/types/-/types-4.0.0.tgz#7458c1c4dde3c6cf23221370acf5acd03215de6e" - integrity sha512-aNwIGSOgDOhtTRY/rrn2aeuQeKw/IFrQ998yK5l6Ah853WeWIEmFPs/EO4OpfADEdcK+igWnZytm/oUgkLgUYg== - dependencies: - tslib "^2.6.2" - -"@smithy/url-parser@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/url-parser/-/url-parser-4.0.0.tgz#c379b812860f88a435164cd5d3d940009e464ea7" - integrity sha512-2iPpuLoH0hCKpLtqVgilHtpPKsmHihbkwBm3h3RPuEctdmuiOlFRZ2ZI8IHSwl0o4ff5IdyyJ0yu/2tS9KpUug== - dependencies: - "@smithy/querystring-parser" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/util-base64@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-base64/-/util-base64-4.0.0.tgz#8345f1b837e5f636e5f8470c4d1706ae0c6d0358" - integrity sha512-CvHfCmO2mchox9kjrtzoHkWHxjHZzaFojLc8quxXY7WAAMAg43nuxwv95tATVgQFNDwd4M9S1qFzj40Ul41Kmg== - dependencies: - "@smithy/util-buffer-from" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@smithy/util-body-length-browser@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-body-length-browser/-/util-body-length-browser-4.0.0.tgz#965d19109a4b1e5fe7a43f813522cce718036ded" - integrity sha512-sNi3DL0/k64/LO3A256M+m3CDdG6V7WKWHdAiBBMUN8S3hK3aMPhwnPik2A/a2ONN+9doY9UxaLfgqsIRg69QA== - dependencies: - tslib "^2.6.2" - -"@smithy/util-body-length-node@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-body-length-node/-/util-body-length-node-4.0.0.tgz#3db245f6844a9b1e218e30c93305bfe2ffa473b3" - integrity sha512-q0iDP3VsZzqJyje8xJWEJCNIu3lktUGVoSy1KB0UWym2CL1siV3artm+u1DFYTLejpsrdGyCSWBdGNjJzfDPjg== - dependencies: - tslib "^2.6.2" - -"@smithy/util-buffer-from@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz#6fc88585165ec73f8681d426d96de5d402021e4b" - integrity sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA== - dependencies: - "@smithy/is-array-buffer" "^2.2.0" - tslib "^2.6.2" - -"@smithy/util-buffer-from@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-buffer-from/-/util-buffer-from-4.0.0.tgz#b23b7deb4f3923e84ef50c8b2c5863d0dbf6c0b9" - integrity sha512-9TOQ7781sZvddgO8nxueKi3+yGvkY35kotA0Y6BWRajAv8jjmigQ1sBwz0UX47pQMYXJPahSKEKYFgt+rXdcug== - dependencies: - "@smithy/is-array-buffer" "^4.0.0" - tslib "^2.6.2" - -"@smithy/util-config-provider@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-config-provider/-/util-config-provider-4.0.0.tgz#e0c7c8124c7fba0b696f78f0bd0ccb060997d45e" - integrity sha512-L1RBVzLyfE8OXH+1hsJ8p+acNUSirQnWQ6/EgpchV88G6zGBTDPdXiiExei6Z1wR2RxYvxY/XLw6AMNCCt8H3w== - dependencies: - tslib "^2.6.2" - -"@smithy/util-defaults-mode-browser@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.0.0.tgz#925046f4c18607b7af409be914b13159dbf04c68" - integrity sha512-7wqsXkzaJkpSqV+Ca95pN9yQutXvhaKeCxGGmjWnRGXY1fW/yR7wr1ouNnUYCJuTS8MvmB61xp5Qdj8YMgIA2Q== - dependencies: - "@smithy/property-provider" "^4.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - bowser "^2.11.0" - tslib "^2.6.2" - -"@smithy/util-defaults-mode-node@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.0.0.tgz#110cfa24dbc7ebcdbde71770bb7cc2daa19ea8dd" - integrity sha512-P8VK885kiRT6TEtvcQvz+L/+xIhrDhCmM664ToUtrshFSBhwGYaJWlQNAH9fXlMhwnNvR+tmh1KngKJIgQP6bw== - dependencies: - "@smithy/config-resolver" "^4.0.0" - "@smithy/credential-provider-imds" "^4.0.0" - "@smithy/node-config-provider" "^4.0.0" - "@smithy/property-provider" "^4.0.0" - "@smithy/smithy-client" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/util-endpoints@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-endpoints/-/util-endpoints-3.0.0.tgz#d1abf9ac6311e0876b444845f1b2ef47e953b5ce" - integrity sha512-kyOKbkg77lsIVN2jC08uEWm3s16eK1YdVDyi/nKeBDbUnjR30dmTEga79E5tiu5OEgTAdngNswA9V+L6xa65sA== - dependencies: - "@smithy/node-config-provider" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/util-hex-encoding@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-hex-encoding/-/util-hex-encoding-4.0.0.tgz#dd449a6452cffb37c5b1807ec2525bb4be551e8d" - integrity sha512-Yk5mLhHtfIgW2W2WQZWSg5kuMZCVbvhFmC7rV4IO2QqnZdbEFPmQnCcGMAX2z/8Qj3B9hYYNjZOhWym+RwhePw== - dependencies: - tslib "^2.6.2" - -"@smithy/util-middleware@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-middleware/-/util-middleware-4.0.0.tgz#0401ada0ebd61af1c0965c6e15e379fe6ebab27f" - integrity sha512-ncuvK6ekpDqtASHg7jx3d3nrkD2BsTzUmeVgvtepuHGxtySY8qUlb4SiNRdxHYcv3pL2SwdXs70RwKBU0edW5w== - dependencies: - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/util-retry@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-retry/-/util-retry-4.0.0.tgz#c08f1894278afce4ab3c00b55883f13026f04222" - integrity sha512-64WFoC19NVuHh3HQO2QbGw+n6GzQ6VH/drxwXLOU3GDLKxUUzIR9XNm9aTVqh8/7R+y+DgITiv5LpX5XdOy73A== - dependencies: - "@smithy/service-error-classification" "^4.0.0" - "@smithy/types" "^4.0.0" - tslib "^2.6.2" - -"@smithy/util-stream@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-stream/-/util-stream-4.0.0.tgz#c604497ae110216e92ccd586a40b8cf4fa8d9b62" - integrity sha512-ctcLq8Ogi2FQuGy2RxJXGGrozhFEb4p9FawB5SpTNAkNQWbNHcwrGcVSVI3FtdQtkNAINLiEdMnrx+UN/mafvw== - dependencies: - "@smithy/fetch-http-handler" "^5.0.0" - "@smithy/node-http-handler" "^4.0.0" - "@smithy/types" "^4.0.0" - "@smithy/util-base64" "^4.0.0" - "@smithy/util-buffer-from" "^4.0.0" - "@smithy/util-hex-encoding" "^4.0.0" - "@smithy/util-utf8" "^4.0.0" - tslib "^2.6.2" - -"@smithy/util-uri-escape@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-uri-escape/-/util-uri-escape-4.0.0.tgz#a96c160c76f3552458a44d8081fade519d214737" - integrity sha512-77yfbCbQMtgtTylO9itEAdpPXSog3ZxMe09AEhm0dU0NLTalV70ghDZFR+Nfi1C60jnJoh/Re4090/DuZh2Omg== - dependencies: - tslib "^2.6.2" - -"@smithy/util-utf8@^2.0.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@smithy/util-utf8/-/util-utf8-2.3.0.tgz#dd96d7640363259924a214313c3cf16e7dd329c5" - integrity sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A== - dependencies: - "@smithy/util-buffer-from" "^2.2.0" - tslib "^2.6.2" - -"@smithy/util-utf8@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@smithy/util-utf8/-/util-utf8-4.0.0.tgz#09ca2d9965e5849e72e347c130f2a29d5c0c863c" - integrity sha512-b+zebfKCfRdgNJDknHCob3O7FpeYQN6ZG6YLExMcasDHsCXlsXCEuiPZeLnJLpwa5dvPetGlnGCiMHuLwGvFow== - dependencies: - "@smithy/util-buffer-from" "^4.0.0" - tslib "^2.6.2" - "@tootallnate/once@2": version "2.0.0" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" @@ -4543,15 +3702,6 @@ asn1@^0.2.6: dependencies: safer-buffer "~2.1.0" -asn1js@^3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38" - integrity sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ== - dependencies: - pvtsutils "^1.3.2" - pvutils "^1.1.3" - tslib "^2.4.0" - ast-types-flow@^0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.8.tgz#0a85e1c92695769ac13a428bb653e7538bea27d6" @@ -4803,11 +3953,6 @@ body-parser@1.20.3: type-is "~1.6.18" unpipe "1.0.0" -bowser@^2.11.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f" - integrity sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA== - boxen@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.1.2.tgz#788cb686fc83c1f486dfa8a40c68fc2b831d2b50" @@ -6571,13 +5716,6 @@ fast-uri@^3.0.1: resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.2.tgz#d78b298cf70fd3b752fd951175a3da6a7b48f024" integrity sha512-GR6f0hD7XXyNJa25Tb9BuIdN0tdr+0BMi6/CJPH3wJO1JjNG3n/VsSw38AwRdKZABm8lGbPfakLRkYzx2V9row== -fast-xml-parser@4.4.1: - version "4.4.1" - resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz#86dbf3f18edf8739326447bcaac31b4ae7f6514f" - integrity sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw== - dependencies: - strnum "^1.0.5" - fastq@^1.6.0: version "1.17.1" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" @@ -9447,18 +8585,6 @@ pure-rand@^6.0.0: resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== -pvtsutils@^1.3.2: - version "1.3.5" - resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.5.tgz#b8705b437b7b134cd7fd858f025a23456f1ce910" - integrity sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA== - dependencies: - tslib "^2.6.1" - -pvutils@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3" - integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ== - qs@6.13.0: version "6.13.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" @@ -10418,11 +9544,6 @@ strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -strnum@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" - integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== - sucrase@^3.35.0: version "3.35.0" resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.35.0.tgz#57f17a3d7e19b36d8995f06679d121be914ae263" @@ -10762,7 +9883,7 @@ tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.4.0, tslib@^2.6.1, tslib@^2.6.2: +tslib@^2.6.2: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== @@ -11143,11 +10264,6 @@ uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -uuid@^9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" - integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== - v8-to-istanbul@^9.0.1: version "9.3.0" resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" From 5776e22234b4a9c3fd0ee4688d9ff2be651b8582 Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 16:09:46 +0000 Subject: [PATCH 08/15] chore: 1886 module removed --- packages/ethers-adapter/README.md | 18 ---- packages/ethers-adapter/eslint.config.mjs | 24 ------ packages/ethers-adapter/jest.config.js | 17 ---- packages/ethers-adapter/package.json | 41 --------- .../src/adapters/contract-adapter.ts | 25 ------ .../src/adapters/factory-adapter.ts | 57 ------------ .../ethers-adapter/src/adapters/helpers.ts | 22 ----- packages/ethers-adapter/src/adapters/index.ts | 3 - packages/ethers-adapter/src/ethers-adapter.ts | 1 - packages/ethers-adapter/src/index.ts | 5 -- .../adapters/contract-adapter.solo.test.ts | 58 ------------- .../adapters/factory-adapter.solo.test.ts | 86 ------------------- .../tests/adapters/helpers.solo.test.ts | 58 ------------- packages/ethers-adapter/tests/fixture.ts | 7 -- packages/ethers-adapter/tsconfig.json | 12 --- packages/ethers-adapter/typedoc.json | 4 - 16 files changed, 438 deletions(-) delete mode 100644 packages/ethers-adapter/README.md delete mode 100644 packages/ethers-adapter/eslint.config.mjs delete mode 100644 packages/ethers-adapter/jest.config.js delete mode 100644 packages/ethers-adapter/package.json delete mode 100644 packages/ethers-adapter/src/adapters/contract-adapter.ts delete mode 100644 packages/ethers-adapter/src/adapters/factory-adapter.ts delete mode 100644 packages/ethers-adapter/src/adapters/helpers.ts delete mode 100644 packages/ethers-adapter/src/adapters/index.ts delete mode 100644 packages/ethers-adapter/src/ethers-adapter.ts delete mode 100644 packages/ethers-adapter/src/index.ts delete mode 100644 packages/ethers-adapter/tests/adapters/contract-adapter.solo.test.ts delete mode 100644 packages/ethers-adapter/tests/adapters/factory-adapter.solo.test.ts delete mode 100644 packages/ethers-adapter/tests/adapters/helpers.solo.test.ts delete mode 100644 packages/ethers-adapter/tests/fixture.ts delete mode 100644 packages/ethers-adapter/tsconfig.json delete mode 100644 packages/ethers-adapter/typedoc.json diff --git a/packages/ethers-adapter/README.md b/packages/ethers-adapter/README.md deleted file mode 100644 index 59dda9a30..000000000 --- a/packages/ethers-adapter/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# @vechain/sdk-ethers-adapter - -Welcome to the **sdk-ethers-adapter** package of the VeChain SDK! This package serves as a crucial bridge between the standard Ethereum tooling provided by Hardhat and the unique features of the VeChainThor blockchain. By utilizing this adapter, the hardhatVeChain plugin can seamlessly integrate veChain's capabilities, leveraging the Hardhat environment for smart contract deployment and testing on veChain's network. - -## Features - -- **Ethers.js Integration**: Fully compatible with ethers.js, providing a familiar interface for Ethereum developers. -- **vechain Extensions**: Implements vechain-specific functionalities, such as multi-clause transactions, fee delegation, and native token (VET and VTHO) handling. -- **Custom Provider**: Includes a VeChainThor Provider to interact with the VeChainThor blockchain. -- **Transaction Signing**: Enhancements for signing transactions using vechain's unique model, including support for block ref and expiration. -- **Contract Interaction**: Facilitates interaction with contracts deployed on the VeChainThor blockchain, taking into account vechain-specific transaction parameters. - -## Installation - -To install the `@vechain/sdk-ethers-adapter`, run the following command in your project directory: - -```bash -npm install @vechain/sdk-ethers-adapter diff --git a/packages/ethers-adapter/eslint.config.mjs b/packages/ethers-adapter/eslint.config.mjs deleted file mode 100644 index cc1dd3b15..000000000 --- a/packages/ethers-adapter/eslint.config.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - rules: { - "import/no-restricted-paths": ["error", { - zones: [{ - target: "./src", - - from: [ - "../core", - "../errors", - "../hardhat-plugin", - "../logging", - "../network", - "../rpc-proxy", - ], - - message: "Please import using @vechain/sdk-", - }], - }], - }, - }]; diff --git a/packages/ethers-adapter/jest.config.js b/packages/ethers-adapter/jest.config.js deleted file mode 100644 index 3b5979909..000000000 --- a/packages/ethers-adapter/jest.config.js +++ /dev/null @@ -1,17 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: '../../customEnv.js', - coverageReporters: ['html', 'lcov', 'json'], - runner: 'groups', - reporters: ['default', 'jest-junit'], - workerThreads: false, - coverageThreshold: { - global: { - branches: 100, - functions: 100, - lines: 100, - statements: 100 - } - } -}; diff --git a/packages/ethers-adapter/package.json b/packages/ethers-adapter/package.json deleted file mode 100644 index 10188143d..000000000 --- a/packages/ethers-adapter/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@vechain/sdk-ethers-adapter", - "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", - "homepage": "https://github.com/vechain/vechain-sdk-js", - "repository": { - "type": "git", - "url": "github:vechain/vechain-sdk-js" - }, - "keywords": [ - "VeChain", - "ethers", - "adapter" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "package.json", - "README.md", - "LICENSE" - ], - "scripts": { - "build": "rm -rf ./dist && tsup-node src/index.ts --format cjs,esm --dts", - "lint": "eslint", - "format": "prettier --write src/**/*.ts tests/**/*.ts", - "test:unit": "rm -rf ./coverageUnit && jest --coverage --coverageDirectory=coverageUnit --group=unit", - "test:integration": "rm -rf ./coverageIntegration && jest --coverage --coverageDirectory=coverageIntegration --group=integration", - "test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit" - }, - "dependencies": { - "@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.5" - } -} \ No newline at end of file diff --git a/packages/ethers-adapter/src/adapters/contract-adapter.ts b/packages/ethers-adapter/src/adapters/contract-adapter.ts deleted file mode 100644 index 7c6b21522..000000000 --- a/packages/ethers-adapter/src/adapters/contract-adapter.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { type HardhatVeChainProvider } from '@vechain/sdk-network'; -import { type Contract } from 'ethers'; -import { helpers } from './helpers'; - -/** - * Contract adapter for the VeChain hardhat plugin - * - * @param contract - The contract to adapt to the VeChain network - * @param hardhatVeChainProvider - The hardhatVeChain provider - * @returns The adapted contract - */ -const contractAdapter = ( - contract: Contract, - hardhatVeChainProvider: HardhatVeChainProvider -): Contract => { - contract.getAddress = async function getAddress(): Promise { - return await helpers.getContractAddress( - contract.deploymentTransaction()?.hash ?? '', - hardhatVeChainProvider - ); - }; - return contract; -}; - -export { contractAdapter }; diff --git a/packages/ethers-adapter/src/adapters/factory-adapter.ts b/packages/ethers-adapter/src/adapters/factory-adapter.ts deleted file mode 100644 index 78ac6f23f..000000000 --- a/packages/ethers-adapter/src/adapters/factory-adapter.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { UnsupportedOperation } from '@vechain/sdk-errors'; -import type { HardhatVeChainProvider } from '@vechain/sdk-network'; -import { - BaseContract, - type ContractFactory, - type ContractMethodArgs, - type ContractTransactionResponse -} from 'ethers'; - -/** - * Factory adapter for the VeChain hardhat plugin - * - * @param contractFactory - The contract factory to adapt to the VeChain network - * @param hardhatVeChainProvider - The hardhatVeChain provider - * @returns The adapted contract factory - * @throws {UnsupportedOperation} - */ -function factoryAdapter( - contractFactory: ContractFactory, - hardhatVeChainProvider: HardhatVeChainProvider -): ContractFactory { - contractFactory.deploy = async function (...args: ContractMethodArgs) { - const tx = await this.getDeployTransaction(...args); - - if ( - this.runner == null || - typeof this.runner.sendTransaction !== 'function' - ) { - throw new UnsupportedOperation( - 'factoryAdapter()', - 'Runner does not support sending transactions', - { - operation: 'sendTransaction' - } - ); - } - - const sentTx = await this.runner.sendTransaction(tx); - - const receipt = - await hardhatVeChainProvider.thorClient.transactions.waitForTransaction( - sentTx.hash - ); - - return new BaseContract( - receipt?.outputs[0].contractAddress ?? '', - this.interface, - this.runner, - sentTx - ) as BaseContract & { - deploymentTransaction: () => ContractTransactionResponse; - } & Omit; - }; - return contractFactory; -} - -export { factoryAdapter }; diff --git a/packages/ethers-adapter/src/adapters/helpers.ts b/packages/ethers-adapter/src/adapters/helpers.ts deleted file mode 100644 index a1313f0b9..000000000 --- a/packages/ethers-adapter/src/adapters/helpers.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { HardhatVeChainProvider } from '@vechain/sdk-network'; - -/** - * Get the contract address from a transaction id - * @param txId - The contract deployment transaction id - * @param hardhatVeChainProvider - The hardhatVeChain provider - * @returns The contract address - */ -const getContractAddress = async ( - txId: string, - hardhatVeChainProvider: HardhatVeChainProvider -): Promise => { - const tx = - await hardhatVeChainProvider.thorClient.transactions.waitForTransaction( - txId - ); - return tx?.outputs[0].contractAddress ?? ''; -}; - -export const helpers = { - getContractAddress -}; diff --git a/packages/ethers-adapter/src/adapters/index.ts b/packages/ethers-adapter/src/adapters/index.ts deleted file mode 100644 index 678838e2a..000000000 --- a/packages/ethers-adapter/src/adapters/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './contract-adapter'; -export * from './factory-adapter'; -export * from './helpers'; diff --git a/packages/ethers-adapter/src/ethers-adapter.ts b/packages/ethers-adapter/src/ethers-adapter.ts deleted file mode 100644 index d8623c33d..000000000 --- a/packages/ethers-adapter/src/ethers-adapter.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './adapters'; diff --git a/packages/ethers-adapter/src/index.ts b/packages/ethers-adapter/src/index.ts deleted file mode 100644 index 189dd74d1..000000000 --- a/packages/ethers-adapter/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as adapters from './ethers-adapter'; - -export { adapters }; - -export * from './ethers-adapter'; diff --git a/packages/ethers-adapter/tests/adapters/contract-adapter.solo.test.ts b/packages/ethers-adapter/tests/adapters/contract-adapter.solo.test.ts deleted file mode 100644 index dff2c5e06..000000000 --- a/packages/ethers-adapter/tests/adapters/contract-adapter.solo.test.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - *VeChain provider tests - Solo Network - * - * @group integration/providers/vechain-provider-solo - */ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - HardhatVeChainProvider, - ProviderInternalBaseWallet, - THOR_SOLO_URL, - ThorClient -} from '@vechain/sdk-network'; -import { Contract } from 'ethers'; -import { contractAdapter, helpers } from '../../src'; - -/** - *VeChain adapters tests - Solo Network - * - * @group integration/adapter/contract-adapter-solo - */ -describe('Hardhat contract adapter tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: HardhatVeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(THOR_SOLO_URL); - provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - THOR_SOLO_URL, - (message: string, parent?: Error) => new Error(message, parent) - ); - expect(thorClient).toBeDefined(); - }); - - test('Should create a contract adapter', () => { - const contract = new Contract('0x', []); - // Create a contract adapter - const adapter = contractAdapter(contract, provider); - expect(adapter).toBeDefined(); - }); - - test('Should get the address of a contract', () => { - const contract = new Contract('0x', []); - helpers.getContractAddress = jest.fn( - async () => await Promise.resolve('0x') - ); - contract.getAddress = jest.fn(async () => await Promise.resolve('0x')); - // Create a contract adapter - const adapter = contractAdapter(contract, provider); - expect(adapter.getAddress()).toBeDefined(); - }); -}); diff --git a/packages/ethers-adapter/tests/adapters/factory-adapter.solo.test.ts b/packages/ethers-adapter/tests/adapters/factory-adapter.solo.test.ts deleted file mode 100644 index 9ec98d123..000000000 --- a/packages/ethers-adapter/tests/adapters/factory-adapter.solo.test.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { ERC20_ABI } from '@vechain/sdk-core'; -import { UnsupportedOperation } from '@vechain/sdk-errors'; -import { - HardhatVeChainProvider, - ProviderInternalBaseWallet, - THOR_SOLO_URL, - ThorClient, - type WaitForTransactionOptions -} from '@vechain/sdk-network'; -import { - ContractFactory, - type Signer, - type TransactionResponse, - VoidSigner -} from 'ethers'; -import { factoryAdapter } from '../../src'; -import { erc20ContractBytecode } from '../fixture'; - -/** - *VeChain adapters tests - Solo Network - * - * @group integration/adapter/contract-adapter-solo - */ -describe('Hardhat factory adapter tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: HardhatVeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(THOR_SOLO_URL); - provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - THOR_SOLO_URL, - (message: string, parent?: Error) => new Error(message, parent) - ); - expect(thorClient).toBeDefined(); - - provider.thorClient.transactions.waitForTransaction = jest.fn( - async (_txID: string, _options?: WaitForTransactionOptions) => { - return await Promise.resolve(null); - } - ); - }); - - test('Should create a factory adapter and deploy', async () => { - const signer: Signer = new VoidSigner('0x'); - - signer.sendTransaction = jest.fn(async (_tx) => { - return await ({} as unknown as Promise); - }); - - signer.resolveName = jest.fn(async (_name: string) => { - return await Promise.resolve('mock'); - }); - - const contract = new ContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - // Create a contract adapter - const adapter = factoryAdapter(contract, provider); - - expect(await adapter.deploy()).toBeDefined(); - }); - - test('Should fail to deploy with a factory adapter', async () => { - const contract = new ContractFactory(ERC20_ABI, erc20ContractBytecode); - - // Create a contract adapter - const adapter = factoryAdapter(contract, provider); - - await expect(async () => await adapter.deploy()).rejects.toThrowError( - UnsupportedOperation - ); - - expect(adapter).toBeDefined(); - }); -}); diff --git a/packages/ethers-adapter/tests/adapters/helpers.solo.test.ts b/packages/ethers-adapter/tests/adapters/helpers.solo.test.ts deleted file mode 100644 index c61ab9ce0..000000000 --- a/packages/ethers-adapter/tests/adapters/helpers.solo.test.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { - HardhatVeChainProvider, - ProviderInternalBaseWallet, - THOR_SOLO_URL, - ThorClient, - type TransactionReceipt, - type WaitForTransactionOptions -} from '@vechain/sdk-network'; -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { helpers } from '../../src'; - -/** - *VeChain helpers tests - Solo Network - * - * @group integration/adapter/contract-adapter-solo - */ -describe('Helpers tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: HardhatVeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(THOR_SOLO_URL); - provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - THOR_SOLO_URL, - (message: string, parent?: Error) => new Error(message, parent) - ); - expect(thorClient).toBeDefined(); - }); - - test('Should get the contract address', async () => { - provider.thorClient.transactions.waitForTransaction = jest.fn( - async (_txID: string, _options?: WaitForTransactionOptions) => { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - return await Promise.resolve({ - outputs: [{ contractAddress: 'sampleAddress' }] - } as TransactionReceipt); - } - ); - const address = await helpers.getContractAddress('0x', provider); - expect(address).toBe('sampleAddress'); - - provider.thorClient.transactions.waitForTransaction = jest.fn( - async (_txID: string, _options?: WaitForTransactionOptions) => { - return await Promise.resolve(null); - } - ); - - const addressEmpty = await helpers.getContractAddress('0x', provider); - expect(addressEmpty).toBe(''); - }); -}); diff --git a/packages/ethers-adapter/tests/fixture.ts b/packages/ethers-adapter/tests/fixture.ts deleted file mode 100644 index dae0c667f..000000000 --- a/packages/ethers-adapter/tests/fixture.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Simple ERC20 contract bytecode - */ -const erc20ContractBytecode: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600b81526020017f53616d706c65546f6b656e0000000000000000000000000000000000000000008152506040518060400160405280600281526020017f535400000000000000000000000000000000000000000000000000000000000081525081600390816200008f91906200062c565b508060049081620000a191906200062c565b505050620000e633620000b9620000ec60201b60201c565b60ff16600a620000ca919062000896565b620f4240620000da9190620008e7565b620000f560201b60201c565b62000a3a565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200016a5760006040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000161919062000977565b60405180910390fd5b6200017e600083836200018260201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603620001d8578060026000828254620001cb919062000994565b92505081905550620002ae565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101562000267578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016200025e93929190620009e0565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620002f9578060026000828254039250508190555062000346565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620003a5919062000a1d565b60405180910390a3505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043457607f821691505b6020821081036200044a5762000449620003ec565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620004b47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000475565b620004c0868362000475565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200050d620005076200050184620004d8565b620004e2565b620004d8565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b84845462000482565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000450565b620005b18462000465565b81016020851015620005c1578190505b620005d9620005d08562000465565b8301826200056a565b50505b505050565b600082821c905092915050565b60006200060160001984600802620005e1565b1980831691505092915050565b60006200061c8383620005ee565b9150826002028217905092915050565b6200063782620003b2565b67ffffffffffffffff811115620006535762000652620003bd565b5b6200065f82546200041b565b6200066c82828562000591565b600060209050601f831160018114620006a457600084156200068f578287015190505b6200069b85826200060e565b8655506200070b565b601f198416620006b48662000450565b60005b82811015620006de57848901518255600182019150602085019450602081019050620006b7565b86831015620006fe5784890151620006fa601f891682620005ee565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620007a15780860481111562000779576200077862000713565b5b6001851615620007895780820291505b8081029050620007998562000742565b945062000759565b94509492505050565b600082620007bc57600190506200088f565b81620007cc57600090506200088f565b8160018114620007e55760028114620007f05762000826565b60019150506200088f565b60ff84111562000805576200080462000713565b5b8360020a9150848211156200081f576200081e62000713565b5b506200088f565b5060208310610133831016604e8410600b8410161715620008605782820a9050838111156200085a576200085962000713565b5b6200088f565b6200086f84848460016200074f565b9250905081840481111562000889576200088862000713565b5b81810290505b9392505050565b6000620008a382620004d8565b9150620008b083620004d8565b9250620008df7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620007aa565b905092915050565b6000620008f482620004d8565b91506200090183620004d8565b92508282026200091181620004d8565b915082820484148315176200092b576200092a62000713565b5b5092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200095f8262000932565b9050919050565b620009718162000952565b82525050565b60006020820190506200098e600083018462000966565b92915050565b6000620009a182620004d8565b9150620009ae83620004d8565b9250828201905080821115620009c957620009c862000713565b5b92915050565b620009da81620004d8565b82525050565b6000606082019050620009f7600083018662000966565b62000a066020830185620009cf565b62000a156040830184620009cf565b949350505050565b600060208201905062000a346000830184620009cf565b92915050565b610e558062000a4a6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610aa9565b60405180910390f35b6100d060048036038101906100cb9190610b64565b610292565b6040516100dd9190610bbf565b60405180910390f35b6100ee6102b5565b6040516100fb9190610be9565b60405180910390f35b61011e60048036038101906101199190610c04565b6102bf565b60405161012b9190610bbf565b60405180910390f35b61013c6102ee565b6040516101499190610c73565b60405180910390f35b61016c60048036038101906101679190610c8e565b6102f7565b6040516101799190610be9565b60405180910390f35b61018a61033f565b6040516101979190610aa9565b60405180910390f35b6101ba60048036038101906101b59190610b64565b6103d1565b6040516101c79190610bbf565b60405180910390f35b6101ea60048036038101906101e59190610cbb565b6103f4565b6040516101f79190610be9565b60405180910390f35b60606003805461020f90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461023b90610d2a565b80156102885780601f1061025d57610100808354040283529160200191610288565b820191906000526020600020905b81548152906001019060200180831161026b57829003601f168201915b5050505050905090565b60008061029d61047b565b90506102aa818585610483565b600191505092915050565b6000600254905090565b6000806102ca61047b565b90506102d7858285610495565b6102e2858585610529565b60019150509392505050565b60006012905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461034e90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610d2a565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050505050905090565b6000806103dc61047b565b90506103e9818585610529565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b610490838383600161061d565b505050565b60006104a184846103f4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146105235781811015610513578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161050a93929190610d6a565b60405180910390fd5b6105228484848403600061061d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361059b5760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105929190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361060d5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016106049190610da1565b60405180910390fd5b6106188383836107f4565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361068f5760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016106869190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036107015760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016106f89190610da1565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080156107ee578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516107e59190610be9565b60405180910390a35b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084657806002600082825461083a9190610deb565b92505081905550610919565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156108d2578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016108c993929190610d6a565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361096257806002600082825403925050819055506109af565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a0c9190610be9565b60405180910390a3505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610a53578082015181840152602081019050610a38565b60008484015250505050565b6000601f19601f8301169050919050565b6000610a7b82610a19565b610a858185610a24565b9350610a95818560208601610a35565b610a9e81610a5f565b840191505092915050565b60006020820190508181036000830152610ac38184610a70565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610afb82610ad0565b9050919050565b610b0b81610af0565b8114610b1657600080fd5b50565b600081359050610b2881610b02565b92915050565b6000819050919050565b610b4181610b2e565b8114610b4c57600080fd5b50565b600081359050610b5e81610b38565b92915050565b60008060408385031215610b7b57610b7a610acb565b5b6000610b8985828601610b19565b9250506020610b9a85828601610b4f565b9150509250929050565b60008115159050919050565b610bb981610ba4565b82525050565b6000602082019050610bd46000830184610bb0565b92915050565b610be381610b2e565b82525050565b6000602082019050610bfe6000830184610bda565b92915050565b600080600060608486031215610c1d57610c1c610acb565b5b6000610c2b86828701610b19565b9350506020610c3c86828701610b19565b9250506040610c4d86828701610b4f565b9150509250925092565b600060ff82169050919050565b610c6d81610c57565b82525050565b6000602082019050610c886000830184610c64565b92915050565b600060208284031215610ca457610ca3610acb565b5b6000610cb284828501610b19565b91505092915050565b60008060408385031215610cd257610cd1610acb565b5b6000610ce085828601610b19565b9250506020610cf185828601610b19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610d4257607f821691505b602082108103610d5557610d54610cfb565b5b50919050565b610d6481610af0565b82525050565b6000606082019050610d7f6000830186610d5b565b610d8c6020830185610bda565b610d996040830184610bda565b949350505050565b6000602082019050610db66000830184610d5b565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df682610b2e565b9150610e0183610b2e565b9250828201905080821115610e1957610e18610dbc565b5b9291505056fea2646970667358221220912f5265edaea44910db734f0d00fccd257c78dba79c126931551eaad1a334f764736f6c63430008170033'; - -export { erc20ContractBytecode }; diff --git a/packages/ethers-adapter/tsconfig.json b/packages/ethers-adapter/tsconfig.json deleted file mode 100644 index b523f6a50..000000000 --- a/packages/ethers-adapter/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - }, - "include": [ - "./src/**/*.ts", - "./tests/**/*.ts" - ] -} \ No newline at end of file diff --git a/packages/ethers-adapter/typedoc.json b/packages/ethers-adapter/typedoc.json deleted file mode 100644 index b16806beb..000000000 --- a/packages/ethers-adapter/typedoc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": ["../../typedoc.base.json"], - "entryPoints": ["src/index.ts"] -} \ No newline at end of file From 360d8aa289b662a54f34ccc31c687cfdd08d1531 Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 16:14:31 +0000 Subject: [PATCH 09/15] chore: 1886 module removed --- .changeset/funny-masks-cheat.md | 2 - .changeset/pre.json | 2 - .github/workflows/publish-sdk.yml | 23 +-- .github/workflows/unit-integration-test.yml | 5 +- README.md | 3 +- packages/core/eslint.config.mjs | 2 - packages/errors/eslint.config.mjs | 2 - packages/hardhat-plugin/README.md | 75 -------- packages/hardhat-plugin/eslint.config.mjs | 24 --- packages/hardhat-plugin/jest.config.js | 23 --- packages/hardhat-plugin/package.json | 49 ----- packages/hardhat-plugin/src/helpers/index.ts | 1 - .../src/helpers/provider-helper.ts | 87 --------- packages/hardhat-plugin/src/index.ts | 174 ------------------ .../hardhat-plugin/src/type-extensions.ts | 70 ------- ...onCount-default-value-project.unit.test.ts | 64 ------- ...sactionCount-no-value-project.unit.test.ts | 64 ------- ...ionCount-random-value-project.unit.test.ts | 64 ------- .../hardhat.config.ts | 64 ------- .../hardhat.config.ts | 62 ------- .../hardhat.config.ts | 64 ------- .../hardhat.config.ts | 18 -- .../f80ce3c255b9cd7b327e989536eb216e.json | 1 - .../VechainHelloWorld.dbg.json | 4 - .../VechainHelloWorld.json | 42 ----- ...HelloWorldWithNonEmptyConstructor.dbg.json | 4 - ...hainHelloWorldWithNonEmptyConstructor.json | 61 ------ .../contracts/VechainHelloWorld.sol | 22 --- ...chainHelloWorldWithNonEmptyConstructor.sol | 24 --- .../contracts/erc20Contract.sol | 11 -- .../contracts/erc721Contract.sol | 24 --- .../hardhat.config.ts | 79 -------- .../hardhat-plugin/tests/helpers/fixture.ts | 147 --------------- .../helpers/provider-helpers.unit.test.ts | 55 ------ ...chain-network-defined-project.unit.test.ts | 42 ----- ...imple-vechain-hardhat-project.solo.test.ts | 159 ---------------- packages/hardhat-plugin/tests/test-utils.ts | 18 -- packages/hardhat-plugin/tsconfig.json | 12 -- packages/hardhat-plugin/typedoc.json | 4 - packages/logging/eslint.config.mjs | 2 - packages/network/eslint.config.mjs | 2 - packages/rpc-proxy/eslint.config.mjs | 2 - yarn.lock | 13 -- 43 files changed, 3 insertions(+), 1667 deletions(-) delete mode 100644 packages/hardhat-plugin/README.md delete mode 100644 packages/hardhat-plugin/eslint.config.mjs delete mode 100644 packages/hardhat-plugin/jest.config.js delete mode 100644 packages/hardhat-plugin/package.json delete mode 100644 packages/hardhat-plugin/src/helpers/index.ts delete mode 100644 packages/hardhat-plugin/src/helpers/provider-helper.ts delete mode 100644 packages/hardhat-plugin/src/index.ts delete mode 100644 packages/hardhat-plugin/src/type-extensions.ts delete mode 100644 packages/hardhat-plugin/tests/eth_getTransactionCount-default-value-project.unit.test.ts delete mode 100644 packages/hardhat-plugin/tests/eth_getTransactionCount-no-value-project.unit.test.ts delete mode 100644 packages/hardhat-plugin/tests/eth_getTransactionCount-random-value-project.unit.test.ts delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-default-value-project/hardhat.config.ts delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-no-value-project/hardhat.config.ts delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-random-value-project/hardhat.config.ts delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/no-vechain-network-defined-project/hardhat.config.ts delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/build-info/f80ce3c255b9cd7b327e989536eb216e.json delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorld.sol/VechainHelloWorld.dbg.json delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorld.sol/VechainHelloWorld.json delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorldWithNonEmptyConstructor.sol/VechainHelloWorldWithNonEmptyConstructor.dbg.json delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorldWithNonEmptyConstructor.sol/VechainHelloWorldWithNonEmptyConstructor.json delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/VechainHelloWorld.sol delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/VechainHelloWorldWithNonEmptyConstructor.sol delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/erc20Contract.sol delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/erc721Contract.sol delete mode 100644 packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/hardhat.config.ts delete mode 100644 packages/hardhat-plugin/tests/helpers/fixture.ts delete mode 100644 packages/hardhat-plugin/tests/helpers/provider-helpers.unit.test.ts delete mode 100644 packages/hardhat-plugin/tests/no-vechain-network-defined-project.unit.test.ts delete mode 100644 packages/hardhat-plugin/tests/simple-vechain-hardhat-project.solo.test.ts delete mode 100644 packages/hardhat-plugin/tests/test-utils.ts delete mode 100644 packages/hardhat-plugin/tsconfig.json delete mode 100644 packages/hardhat-plugin/typedoc.json diff --git a/.changeset/funny-masks-cheat.md b/.changeset/funny-masks-cheat.md index e82954336..68b0ea6c7 100644 --- a/.changeset/funny-masks-cheat.md +++ b/.changeset/funny-masks-cheat.md @@ -1,8 +1,6 @@ --- "@vechain/sdk-core": patch "@vechain/sdk-errors": patch -"@vechain/sdk-ethers-adapter": patch -"@vechain/sdk-hardhat-plugin": patch "@vechain/sdk-logging": patch "@vechain/sdk-network": patch "@vechain/sdk-rpc-proxy": patch diff --git a/.changeset/pre.json b/.changeset/pre.json index b52ec9c25..d5735925d 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -4,8 +4,6 @@ "initialVersions": { "@vechain/sdk-core": "1.0.0", "@vechain/sdk-errors": "1.0.0", - "@vechain/sdk-ethers-adapter": "1.0.0", - "@vechain/sdk-hardhat-plugin": "1.0.0", "@vechain/sdk-logging": "1.0.0", "@vechain/sdk-network": "1.0.0", "@vechain/sdk-rpc-proxy": "1.0.0" diff --git a/.github/workflows/publish-sdk.yml b/.github/workflows/publish-sdk.yml index eb3424ecd..8e59e6301 100644 --- a/.github/workflows/publish-sdk.yml +++ b/.github/workflows/publish-sdk.yml @@ -58,14 +58,6 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Publish Hardhat Plugin - run: | - cd packages/hardhat-plugin - yarn version --no-git-tag-version --new-version ${{ github.ref_name }} - yarn publish - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Publish logging run: | cd packages/logging @@ -74,18 +66,5 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Publish RPC proxy - run: | - cd packages/rpc-proxy - yarn version --no-git-tag-version --new-version ${{ github.ref_name }} - yarn publish - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Publish Ethers Adapter - run: | - cd packages/ethers-adapter - yarn version --no-git-tag-version --new-version ${{ github.ref_name }} - yarn publish - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + diff --git a/.github/workflows/unit-integration-test.yml b/.github/workflows/unit-integration-test.yml index e41cb2287..918ef510a 100644 --- a/.github/workflows/unit-integration-test.yml +++ b/.github/workflows/unit-integration-test.yml @@ -58,10 +58,7 @@ jobs: core, packages/core/junit.xml network, packages/network/junit.xml errors, packages/errors/junit.xml - logging, packages/logging/junit.xml - hardhat-plugin, packages/hardhat-plugin/junit.xml - ethers-adapter, packages/ethers-adapter/junit.xml - rpc-proxy, packages/rpc-proxy/junit.xml + logging, packages/logging/junit.xml - name: Archive coverage if: matrix.node == 'lts/*' diff --git a/README.md b/README.md index 2663065f5..f41317380 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,7 @@ Welcome to the VeChain SDK repository! Here's a breakdown of our organized struc - `./packages`: A hub for our monorepo packages, each serving a distinct purpose: - `./packages/aws-kms-adapter`: The AWS KMS Adapter provides a secure way to sign transactions using AWS Key Management Service (KMS). This adapter allows you to leverage AWS KMS to manage and protect your private keys, ensuring that sensitive cryptographic operations are performed in a secure environment. - `./packages/core`: The heart of the SDK, housing essential modules for fundamental operations like hashing and cryptography. Dive into the core for the building blocks of your decentralized dreams. - - `./packages/errors`: Delve into the world of error handling with the error package. This module is dedicated to managing and customizing errors within the SDK, ensuring your development experience remains resilient and smooth. - - `./packages/hardhat-plugin`: Seamlessly integrate the VeChain SDK with Hardhat, the Ethereum development environment. This plugin provides a bridge between the VeChain SDK and the Ethereum ecosystem, enabling you to leverage the best of both worlds. + - `./packages/errors`: Delve into the world of error handling with the error package. This module is dedicated to managing and customizing errors within the SDK, ensuring your development experience remains resilient and smooth. - `./packages/logging`: The logging package provides a simple and easy-to-use logging system for the VeChain SDK. This module is dedicated to managing and customizing logs within the SDK, ensuring your development experience remains transparent and insightful. - `./packages/network`: Embark on a journey through the network module, your gateway to all things related to blockchain interaction and transaction dissemination. Here, the VeChain SDK connects you seamlessly to the VeChainThor blockchain. - `./packages/rpc-proxy`: This package is designed to bridge the gap between Thor's RESTful API and Ethereum's JSON-RPC. diff --git a/packages/core/eslint.config.mjs b/packages/core/eslint.config.mjs index 332be6112..07928a2eb 100644 --- a/packages/core/eslint.config.mjs +++ b/packages/core/eslint.config.mjs @@ -9,8 +9,6 @@ export default [ target: "./src", from: [ "../errors", - "../ethers-adapter", - "../hardhat-plugin", "../logging", "../network", "../rpc-proxy", diff --git a/packages/errors/eslint.config.mjs b/packages/errors/eslint.config.mjs index 78910dc4f..24db7edd5 100644 --- a/packages/errors/eslint.config.mjs +++ b/packages/errors/eslint.config.mjs @@ -10,8 +10,6 @@ export default [ from: [ "../core", - "../ethers-adapter", - "../hardhat-plugin", "../logging", "../network", "../rpc-proxy", diff --git a/packages/hardhat-plugin/README.md b/packages/hardhat-plugin/README.md deleted file mode 100644 index cfbbaef6b..000000000 --- a/packages/hardhat-plugin/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# @vechain/sdk-hardhat-plugin - -Welcome to the **hardhat-plugin package** of the VeChain SDK! - -## Introduction - -The VeChain SDK Hardhat plugin bridges the gap between Hardhat and the VeChain SDK, providing developers with a seamless interface. This versatile package is essential for smart contract development on the VeChainThor blockchain. - -## Key Features - -This plugin simplifies the creation, testing, deployment, and interaction with smart contracts. It allows developers to build robust decentralized applications (dApps) and services on VeChainThor. By integrating the VeChain SDK into Hardhat, developers can leverage VeChain's powerful blockchain infrastructure within the familiar Hardhat development environment. - -## Installation and Setup - -### Prerequisites -Before using the VeChain SDK Hardhat plugin, ensure you have Hardhat installed: -``` bash -yarn add --dev hardhat -``` -Initialize your Hardhat project: -``` bash -npx hardhat -``` - -### Adding VeChain Support - - Install the VeChain Hardhat plugin: -``` bash -yarn add @vechain/sdk-hardhat-plugin -``` - - Modify your hardhat.config.ts file as follows: - ``` typescript - import '@vechain/sdk-hardhat-plugin'; - -import { VET_DERIVATION_PATH } from '@vechain/sdk-core'; -import { type HttpNetworkConfig } from 'hardhat/types'; - -const config: HardhatUserConfig = { - solidity: { - compilers: [ - { - version: '0.8.17', // Specify the first Solidity version - settings: { - // Additional compiler settings for this version - optimizer: { - enabled: true, - runs: 200 - }, - evmVersion: 'london' // EVM version (e.g., "byzantium", "constantinople", "petersburg", "istanbul", "berlin", "london") - } - }, - ] - }, - networks: { - vechain_testnet: { - // Testnet - url: 'https://testnet.vechain.org', - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: VET_DERIVATION_PATH, - count: 3, - initialIndex: 0, - passphrase: 'vechainthor' - }, - debug: true, - delegator: undefined, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - timeout: 20000, - httpHeaders: {} - } satisfies HttpNetworkConfig, - } -}; -``` diff --git a/packages/hardhat-plugin/eslint.config.mjs b/packages/hardhat-plugin/eslint.config.mjs deleted file mode 100644 index fc8238543..000000000 --- a/packages/hardhat-plugin/eslint.config.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - rules: { - "import/no-restricted-paths": ["error", { - zones: [{ - target: "./src", - - from: [ - "../core", - "../errors", - "../ethers-adapter", - "../logging", - "../network", - "../rpc-proxy", - ], - - message: "Please import using @vechain/sdk-", - }], - }], - }, - }]; diff --git a/packages/hardhat-plugin/jest.config.js b/packages/hardhat-plugin/jest.config.js deleted file mode 100644 index 85bd8bfb9..000000000 --- a/packages/hardhat-plugin/jest.config.js +++ /dev/null @@ -1,23 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -// Coverage threshold would apply to yarn test, not yarn test:unit -const isUnitTest = process.env.UNIT; - -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - coverageReporters: ['html', 'lcov', 'json'], - runner: 'groups', - reporters: ['default', 'jest-junit'], - workerThreads: false, - coverageThreshold: - isUnitTest !== 'true' - ? { - global: { - branches: 100, - functions: 100, - lines: 100, - statements: 100 - } - } - : undefined -}; diff --git a/packages/hardhat-plugin/package.json b/packages/hardhat-plugin/package.json deleted file mode 100644 index 856d4caae..000000000 --- a/packages/hardhat-plugin/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "@vechain/sdk-hardhat-plugin", - "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", - "homepage": "https://github.com/vechain/vechain-sdk-js", - "repository": { - "type": "git", - "url": "github:vechain/vechain-sdk-js" - }, - "keywords": [ - "VeChain", - "hardhat", - "plugin", - "contract" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "package.json", - "README.md", - "LICENSE" - ], - "scripts": { - "build": "rm -rf ./dist && tsup-node src/index.ts --format cjs,esm --dts", - "lint": "eslint", - "format": "prettier --write src/**/*.ts tests/**/*.ts", - "start-thor-solo": "echo 'Starting thor solo node ...' && docker compose -f ../../docker-compose.thor.yml up -d --wait && echo '\nThor solo node started ...'", - "stop-thor-solo": "echo 'Stopping thor solo node ...' && docker compose -f ../../docker-compose.thor.yml down && echo 'Thor solo node stopped ...'", - "test:unit": "rm -rf ./coverageUnit && UNIT=true jest --coverage --coverageDirectory=coverageUnit --group=unit", - "test:integration": "rm -rf ./coverageIntegration && jest --coverage --coverageDirectory=coverageIntegration --group=integration", - "test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit", - "test:solo": "(yarn start-thor-solo && yarn test && yarn stop-thor-solo) || yarn stop-thor-solo" - }, - "dependencies": { - "@nomicfoundation/hardhat-ethers": "^3.0.8", - "@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.5", - "hardhat": "^2.22.15" - } -} \ No newline at end of file diff --git a/packages/hardhat-plugin/src/helpers/index.ts b/packages/hardhat-plugin/src/helpers/index.ts deleted file mode 100644 index aad50571e..000000000 --- a/packages/hardhat-plugin/src/helpers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './provider-helper'; diff --git a/packages/hardhat-plugin/src/helpers/provider-helper.ts b/packages/hardhat-plugin/src/helpers/provider-helper.ts deleted file mode 100644 index d5eba7e19..000000000 --- a/packages/hardhat-plugin/src/helpers/provider-helper.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { Address, HexUInt, Secp256k1 } from '@vechain/sdk-core'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { - DelegationHandler, - ProviderInternalBaseWallet, - ProviderInternalHDWallet, - type ProviderInternalWallet -} from '@vechain/sdk-network'; -import { - type HardhatNetworkAccountsConfig, - type HttpNetworkAccountsConfig, - type HttpNetworkConfig, - type NetworkConfig -} from 'hardhat/types'; - -/* - * Create a wallet from the hardhat network configuration. - * - * @param networkConfig - The hardhat network configuration. - * @returns The wallet. - * @throws {JSONRPCInternalError} - */ -const createWalletFromHardhatNetworkConfig = ( - networkConfig: NetworkConfig -): ProviderInternalWallet => { - // Get the accounts from the configuration - const accountFromConfig: - | HardhatNetworkAccountsConfig - | HttpNetworkAccountsConfig = networkConfig.accounts; - - // Empty wallet - if (accountFromConfig === undefined) - return new ProviderInternalBaseWallet([], {}); - // Some configuration - else { - // Remote (not supported) - if (accountFromConfig === 'remote') - throw new JSONRPCInternalError( - 'createWalletFromHardhatNetworkConfig()', - 'Remote accounts are not supported in hardhat network configuration.', - { accountFromConfig, networkConfig } - ); - - // Base ProviderInternalWallet - From an array of private keys - if (Array.isArray(accountFromConfig)) { - return new ProviderInternalBaseWallet( - (accountFromConfig as string[]).map((privateKey: string) => { - // Convert the private key to a buffer - const privateKeyBuffer = HexUInt.of( - privateKey.startsWith('0x') - ? privateKey.slice(2) - : privateKey - ).bytes; - - // Derive the public key and address from the private key - return { - privateKey: privateKeyBuffer, - publicKey: Secp256k1.derivePublicKey(privateKeyBuffer), - address: - Address.ofPrivateKey(privateKeyBuffer).toString() - }; - }), - { - delegator: DelegationHandler( - (networkConfig as HttpNetworkConfig).delegator - ).delegatorOrUndefined() - } - ); - } - // HD ProviderInternalWallet - From a mnemonic and hd wallet options - else { - return new ProviderInternalHDWallet( - accountFromConfig.mnemonic.split(' '), - accountFromConfig.count, - accountFromConfig.initialIndex, - accountFromConfig.path, - { - delegator: DelegationHandler( - (networkConfig as HttpNetworkConfig).delegator - ).delegatorOrUndefined() - } - ); - } - } -}; - -export { createWalletFromHardhatNetworkConfig }; diff --git a/packages/hardhat-plugin/src/index.ts b/packages/hardhat-plugin/src/index.ts deleted file mode 100644 index f63f4204c..000000000 --- a/packages/hardhat-plugin/src/index.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { createWalletFromHardhatNetworkConfig } from './helpers'; - -import { extendEnvironment } from 'hardhat/config'; -import { type Artifact, type HttpNetworkConfig } from 'hardhat/types'; -import { HardhatPluginError, lazyObject } from 'hardhat/plugins'; - -import { - deployContract, - getContractAt, - getContractAtFromArtifact, - getContractFactory, - getContractFactoryFromArtifact, - getSigner, - getSigners -} from '@nomicfoundation/hardhat-ethers/internal/helpers'; - -// Custom provider for ethers -import { HardhatVeChainProvider } from '@vechain/sdk-network'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -// Import needed to customize ethers functionality -import { ethers } from 'ethers'; - -// Import needed to extend the hardhat environment -import './type-extensions'; - -import { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider'; -import { contractAdapter, factoryAdapter } from '@vechain/sdk-ethers-adapter'; -import { type FactoryOptions } from '@nomicfoundation/hardhat-ethers/src/types'; -import { VechainSDKError } from '@vechain/sdk-errors'; - -/** - * Extend the environment with provider to be able to use VeChain functions - */ -extendEnvironment((hre) => { - // 1 - Get parameters - - // 1.1 - Get network name - const networkName = hre.network.name; - - // 1.2 - Get network config - const networkConfig: HttpNetworkConfig = hre.config.networks[ - networkName - ] as HttpNetworkConfig; - - // 1.3 - Get debug mode - const debug = networkConfig.debug !== undefined && networkConfig.debug; - - // 1.4 - Get fee delegation mode enabled or not - const enableDelegation = - networkConfig.enableDelegation !== undefined && - networkConfig.enableDelegation; - - // 1.5 - Get the custom RPC Configuration - const rpcConfiguration = networkConfig.rpcConfiguration; - const ethGetTransactionCountMustReturn0 = - rpcConfiguration?.ethGetTransactionCountMustReturn0 !== undefined - ? rpcConfiguration?.ethGetTransactionCountMustReturn0 - : false; - - // 2 - Check if network is vechain - - if (!networkName.includes('vechain')) { - VeChainSDKLogger('warning').log({ - title: 'You are operating on a non-vechain network', - messages: [ - 'Ensure your hardhat config file has a network that:', - '\t1. Is a VeChain valid network (set url and optionally delegator parameter)', - '\t2. Has the name of the network containing "vechain" (e.g. "vechain_mainnet", "vechain_testnet", "vechain_solo", ...)', - '', - 'This is required to use the VeChain provider and its functions.', - 'Note that this is only a warning and you can use hardhat without a VeChain network.', - "BUT it's possible that some functionalities will not be available." - ] - }); - - // @NOTE: This is a warning. If vechain network is not found, we will return to not break the hardhat execution - return; - } - - // 3 - Extend environment with the 'HardhatVeChainProvider' - - console.log('networkConfig', networkConfig.rpcConfiguration); - // 3.1 - Create the provider - const hardhatVeChainProvider = new HardhatVeChainProvider( - createWalletFromHardhatNetworkConfig(networkConfig), - networkConfig.url, - (message: string, parent?: Error) => - new HardhatPluginError( - '@vechain/sdk-hardhat-plugin', - message, - parent - ), - debug, - enableDelegation, - { - ethGetTransactionCountMustReturn0 - } - ); - - // 3.2 - Extend environment - hre.VeChainProvider = lazyObject(() => hardhatVeChainProvider); - - // 3.3 - Set provider for the network - hre.network.provider = hardhatVeChainProvider; - - hre.ethers = lazyObject(() => { - // 4 - Customise ethers functionality - - const vechainNewHardhatProvider = new HardhatEthersProvider( - hardhatVeChainProvider, - hre.network.name - ); - - return { - ...ethers, - deployContract: async (...args: unknown[]) => { - const deployContractBound = deployContract.bind(null, hre); - // @ts-expect-error args types depend on the function signature - return await deployContractBound(...args).then((contract) => - contractAdapter(contract, hardhatVeChainProvider) - ); - }, - - getContractFactory: async (...args: unknown[]) => { - const contractFactoryBound = getContractFactory.bind(null, hre); - // @ts-expect-error args types depend on the function signature - return await contractFactoryBound(...args).then((factory) => - factoryAdapter(factory, hardhatVeChainProvider) - ); - }, - - getContractFactoryFromArtifact: async ( - artifact: Artifact, - signerOrOptions?: ethers.Signer | FactoryOptions - ): Promise> => { - // Define the get contract factory from artifact instance with the correct types - const getContractFactoryFromArtifactInstance = - getContractFactoryFromArtifact; - - // Bind the get contract factory from artifact instance with the hardhat instance - const contractFactoryFromArtifactBound = - getContractFactoryFromArtifactInstance.bind(null, hre); - - // Return the factory adapter - return await contractFactoryFromArtifactBound( - artifact, - signerOrOptions - ).then((factory) => - factoryAdapter(factory, hardhatVeChainProvider) - ); - }, - - getImpersonatedSigner: (_address: string) => { - throw new VechainSDKError( - 'getImpersonatedSigner()', - 'Method not implemented.', - { functionName: 'getImpersonatedSigner' } - ); - }, - - getContractAtFromArtifact: getContractAtFromArtifact.bind( - null, - hre - ), - getContractAt: getContractAt.bind(null, hre), - - // Signer - getSigner: async (address: string) => await getSigner(hre, address), - getSigners: async () => await getSigners(hre), - provider: vechainNewHardhatProvider - }; - }); -}); diff --git a/packages/hardhat-plugin/src/type-extensions.ts b/packages/hardhat-plugin/src/type-extensions.ts deleted file mode 100644 index fdf3211ed..000000000 --- a/packages/hardhat-plugin/src/type-extensions.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - type HardhatVeChainProvider, - type SignTransactionOptions -} from '@vechain/sdk-network'; - -// Ethers types -import { type ethers } from 'ethers'; - -// To extend one of Hardhat's types, you need to import the module where it has been defined, and redeclare it. -import { type HardhatEthersHelpers } from '@nomicfoundation/hardhat-ethers/types'; -import 'hardhat/types/config'; -import 'hardhat/types/runtime'; - -/** - * Hardhat runtime environment extension - * - * - Add `VeChainProvider` to `HardhatRuntimeEnvironment` - */ -declare module 'hardhat/types/runtime' { - interface HardhatRuntimeEnvironment { - /** - * The VeChain provider. - * Useful to have for custom functionality. - */ - VeChainProvider?: HardhatVeChainProvider; - - /** - * The ethers object. - * Useful to customize ethers functionality. - */ - ethers: typeof ethers & HardhatEthersHelpers; - } -} - -/** - * Hardhat config extension - * - * - Add `delegator` to `HttpNetworkConfig` - * - Add `debug` to `HttpNetworkConfig` - * - Add `enableDelegation` to `HttpNetworkConfig` - */ -declare module 'hardhat/types/config' { - export interface HttpNetworkConfig { - /** - * Delegate the transaction to a delegator. - * - * We can give following two optional parameters: - * - delegatorPrivateKey: string - * - delegatorUrl: string - */ - delegator?: SignTransactionOptions; - - /** - * Debug mode enabled or not. - */ - debug?: boolean; - - /** - * Enable or not the fee's delegation of the transaction. - */ - enableDelegation?: boolean; - - /** - * RPC Configuration - */ - rpcConfiguration?: { - ethGetTransactionCountMustReturn0: boolean; - }; - } -} diff --git a/packages/hardhat-plugin/tests/eth_getTransactionCount-default-value-project.unit.test.ts b/packages/hardhat-plugin/tests/eth_getTransactionCount-default-value-project.unit.test.ts deleted file mode 100644 index 6b69c46ad..000000000 --- a/packages/hardhat-plugin/tests/eth_getTransactionCount-default-value-project.unit.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; - -import { resetHardhatContext } from 'hardhat/plugins-testing'; -import { - type HardhatRuntimeEnvironment, - type HttpNetworkConfig -} from 'hardhat/types'; -import { setHardhatContext } from './test-utils'; - -/** - * Simple hardhat project eth_getTransactionCount-default-value-project network configuration defined - * - * @group unit/eth_getTransactionCount-default-value-project - */ -describe('Using eth_getTransactionCount with default value as 0x0', () => { - /** - * Init hardhat runtime environment - */ - let hre: HardhatRuntimeEnvironment; - - beforeEach(async function () { - // Set hardhat context - setHardhatContext('eth_getTransactionCount-default-value-project'); - - // Load hardhat environment - hre = await import('hardhat'); - }); - - afterEach(function () { - resetHardhatContext(); - }); - - /** - * Test suite for eth_getTransactionCount with default 0x0 value - */ - describe('Custom network configuration hardhat', () => { - /** - * Positive test cases for createWalletFromHardhatNetworkConfig function - */ - test('Should be able to get a default value of 0x0 from a project', async () => { - // Network configuration should be defined - expect(hre.config.networks.vechain_testnet).toBeDefined(); - - // Initialize network configuration AND check ethGetTransactionCountDefaultValue parameter - const networkConfig = hre.config.networks - .vechain_testnet as HttpNetworkConfig; - expect( - networkConfig.rpcConfiguration - ?.ethGetTransactionCountMustReturn0 - ).toBe(true); - - // Get the provider - expect(hre.VeChainProvider).toBeDefined(); - const provider = hre.VeChainProvider; - - // Expect 0 as the default value - const request = await provider?.request({ - method: 'eth_getTransactionCount', - params: ['0x0b41c56e19c5151122568873a039fEa090937Fe2', 'latest'] - }); - expect(request).toBe('0x0'); - }); - }); -}); diff --git a/packages/hardhat-plugin/tests/eth_getTransactionCount-no-value-project.unit.test.ts b/packages/hardhat-plugin/tests/eth_getTransactionCount-no-value-project.unit.test.ts deleted file mode 100644 index 382ed4af5..000000000 --- a/packages/hardhat-plugin/tests/eth_getTransactionCount-no-value-project.unit.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; - -import { resetHardhatContext } from 'hardhat/plugins-testing'; -import { - type HardhatRuntimeEnvironment, - type HttpNetworkConfig -} from 'hardhat/types'; -import { setHardhatContext } from './test-utils'; - -/** - * Simple hardhat project eth_getTransactionCount-no-value-project network configuration defined - * - * @group unit/eth_getTransactionCount-no-value-project - */ -describe('Using eth_getTransactionCount with no options specified. So it will return a random number', () => { - /** - * Init hardhat runtime environment - */ - let hre: HardhatRuntimeEnvironment; - - beforeEach(async function () { - // Set hardhat context - setHardhatContext('eth_getTransactionCount-no-value-project'); - - // Load hardhat environment - hre = await import('hardhat'); - }); - - afterEach(function () { - resetHardhatContext(); - }); - - /** - * Test suite for eth_getTransactionCount with random value when no options are specified - */ - describe('Custom network configuration hardhat', () => { - /** - * Should be able to get a random value from a project when no options are specified - */ - test('Should be able to get a random value from a project when no options are specified', async () => { - // Network configuration should be defined - expect(hre.config.networks.vechain_testnet).toBeDefined(); - - // Initialize network configuration AND check ethGetTransactionCountDefaultValue parameter - const networkConfig = hre.config.networks - .vechain_testnet as HttpNetworkConfig; - expect( - networkConfig.rpcConfiguration - ?.ethGetTransactionCountMustReturn0 - ).toBe(undefined); - - // Get the provider - expect(hre.VeChainProvider).toBeDefined(); - const provider = hre.VeChainProvider; - - // Expect 0 as the default value - const request = await provider?.request({ - method: 'eth_getTransactionCount', - params: ['0x0b41c56e19c5151122568873a039fEa090937Fe2', 'latest'] - }); - expect(request).not.toBe('0x0'); - }); - }); -}); diff --git a/packages/hardhat-plugin/tests/eth_getTransactionCount-random-value-project.unit.test.ts b/packages/hardhat-plugin/tests/eth_getTransactionCount-random-value-project.unit.test.ts deleted file mode 100644 index af31b861c..000000000 --- a/packages/hardhat-plugin/tests/eth_getTransactionCount-random-value-project.unit.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; - -import { resetHardhatContext } from 'hardhat/plugins-testing'; -import { - type HardhatRuntimeEnvironment, - type HttpNetworkConfig -} from 'hardhat/types'; -import { setHardhatContext } from './test-utils'; - -/** - * Simple hardhat project eth_getTransactionCount-random-value-project network configuration defined - * - * @group unit/eth_getTransactionCount-random-value-project - */ -describe('Using eth_getTransactionCount with random value (not the default 0x0 value)', () => { - /** - * Init hardhat runtime environment - */ - let hre: HardhatRuntimeEnvironment; - - beforeEach(async function () { - // Set hardhat context - setHardhatContext('eth_getTransactionCount-random-value-project'); - - // Load hardhat environment - hre = await import('hardhat'); - }); - - afterEach(function () { - resetHardhatContext(); - }); - - /** - * Test suite for eth_getTransactionCount with random value - */ - describe('Custom network configuration hardhat', () => { - /** - * Should be able to get random value from eth_getTransactionCount - */ - test('Should be able to get random value from eth_getTransactionCount', async () => { - // Network configuration should be defined - expect(hre.config.networks.vechain_testnet).toBeDefined(); - - // Initialize network configuration AND check ethGetTransactionCountDefaultValue parameter - const networkConfig = hre.config.networks - .vechain_testnet as HttpNetworkConfig; - expect( - networkConfig.rpcConfiguration - ?.ethGetTransactionCountMustReturn0 - ).toBe(false); - - // Get the provider - expect(hre.VeChainProvider).toBeDefined(); - const provider = hre.VeChainProvider; - - // Expect 0 as the default value - const request = await provider?.request({ - method: 'eth_getTransactionCount', - params: ['0x0b41c56e19c5151122568873a039fEa090937Fe2', 'latest'] - }); - expect(request).not.toBe('0x0'); - }); - }); -}); diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-default-value-project/hardhat.config.ts b/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-default-value-project/hardhat.config.ts deleted file mode 100644 index f279a1d50..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-default-value-project/hardhat.config.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Simple hardhat configuration for testing with a VeChain network defined - */ - -// We load the plugin here. -import { type HardhatUserConfig, type HttpNetworkConfig } from 'hardhat/types'; - -import '../../../src/index'; -import { HDKey } from '@vechain/sdk-core'; - -/** - * Simple configuration for testing - */ -const vechainTestNetwork: HttpNetworkConfig = { - // Default network parameters - url: 'https://testnet.vechain.org', - timeout: 20000, - httpHeaders: {}, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: HDKey.VET_DERIVATION_PATH, - count: 3, - initialIndex: 0, - passphrase: 'VeChainThor' - }, - - // Custom parameters - delegator: { - delegatorPrivateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - }, - debug: true, - enableDelegation: true, - - // Custom RPC - rpcConfiguration: { - ethGetTransactionCountMustReturn0: true - } -}; - -/** - * Hardhat configuration - */ -const config: HardhatUserConfig = { - solidity: '0.8.17', - networks: { - vechain_testnet: vechainTestNetwork - }, - - /** - * @note: here we set vechain_testnet as the default network to simulate a command like this: - * - * ```sh - * npx hardhat --network vechain_testnet - * ``` - */ - defaultNetwork: 'vechain_testnet' -}; - -export default config; diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-no-value-project/hardhat.config.ts b/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-no-value-project/hardhat.config.ts deleted file mode 100644 index 236d4b3df..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-no-value-project/hardhat.config.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Simple hardhat configuration for testing with a VeChain network defined - */ - -// We load the plugin here. -import { type HardhatUserConfig, type HttpNetworkConfig } from 'hardhat/types'; - -import '../../../src/index'; -import { HDKey } from '@vechain/sdk-core'; - -/** - * Simple configuration for testing - */ -const vechainTestNetwork: HttpNetworkConfig = { - // Default network parameters - url: 'https://testnet.vechain.org', - timeout: 20000, - httpHeaders: {}, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: HDKey.VET_DERIVATION_PATH, - count: 3, - initialIndex: 0, - passphrase: 'VeChainThor' - }, - - // Custom parameters - delegator: { - delegatorPrivateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - }, - debug: true, - enableDelegation: true - - // Custom RPC - // ... NOT GIVEN ... -}; - -/** - * Hardhat configuration - */ -const config: HardhatUserConfig = { - solidity: '0.8.17', - networks: { - vechain_testnet: vechainTestNetwork - }, - - /** - * @note: here we set vechain_testnet as the default network to simulate a command like this: - * - * ```sh - * npx hardhat --network vechain_testnet - * ``` - */ - defaultNetwork: 'vechain_testnet' -}; - -export default config; diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-random-value-project/hardhat.config.ts b/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-random-value-project/hardhat.config.ts deleted file mode 100644 index 5ed7c3679..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/eth_getTransactionCount-random-value-project/hardhat.config.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Simple hardhat configuration for testing with a VeChain network defined - */ - -// We load the plugin here. -import { type HardhatUserConfig, type HttpNetworkConfig } from 'hardhat/types'; - -import '../../../src/index'; -import { HDKey } from '@vechain/sdk-core'; - -/** - * Simple configuration for testing - */ -const vechainTestNetwork: HttpNetworkConfig = { - // Default network parameters - url: 'https://testnet.vechain.org', - timeout: 20000, - httpHeaders: {}, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: HDKey.VET_DERIVATION_PATH, - count: 3, - initialIndex: 0, - passphrase: 'VeChainThor' - }, - - // Custom parameters - delegator: { - delegatorPrivateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - }, - debug: true, - enableDelegation: true, - - // Custom RPC - rpcConfiguration: { - ethGetTransactionCountMustReturn0: false - } -}; - -/** - * Hardhat configuration - */ -const config: HardhatUserConfig = { - solidity: '0.8.17', - networks: { - vechain_testnet: vechainTestNetwork - }, - - /** - * @note: here we set vechain_testnet as the default network to simulate a command like this: - * - * ```sh - * npx hardhat --network vechain_testnet - * ``` - */ - defaultNetwork: 'vechain_testnet' -}; - -export default config; diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/no-vechain-network-defined-project/hardhat.config.ts b/packages/hardhat-plugin/tests/hardhat-mock-projects/no-vechain-network-defined-project/hardhat.config.ts deleted file mode 100644 index e7176e2b8..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/no-vechain-network-defined-project/hardhat.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Simple project withoutVeChain network defined - */ - -// We load the plugin here. -import { type HardhatUserConfig } from 'hardhat/types'; - -import '../../../src/index'; - -/** - * Hardhat configuration - */ -const config: HardhatUserConfig = { - solidity: '0.8.17', - networks: {} -}; - -export default config; diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/build-info/f80ce3c255b9cd7b327e989536eb216e.json b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/build-info/f80ce3c255b9cd7b327e989536eb216e.json deleted file mode 100644 index ef484c945..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/build-info/f80ce3c255b9cd7b327e989536eb216e.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"f80ce3c255b9cd7b327e989536eb216e","_format":"hh-sol-build-info-1","solcVersion":"0.8.17","solcLongVersion":"0.8.17+commit.8df45f5f","input":{"language":"Solidity","sources":{"contracts/VechainHelloWorld.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.17;\n\n/**\n * A simple contract that says hello\n */\ncontract VechainHelloWorld {\n address payable public owner;\n\n constructor() payable {\n owner = payable(msg.sender);\n }\n\n /**\n * Say hello\n\n * @return The hello message\n */\n function sayHello() public pure returns (string memory) {\n return string(\"Hello world from Vechain!\");\n }\n}\n"},"contracts/VechainHelloWorldWithNonEmptyConstructor.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.17;\n\n/**\n * A simple contract that says hello\n */\ncontract VechainHelloWorldWithNonEmptyConstructor {\n address payable public owner;\n uint8 public simpleParameter;\n\n constructor(uint8 _simpleParameter) payable {\n owner = payable(msg.sender);\n simpleParameter = _simpleParameter;\n }\n\n /**\n * Say hello\n\n * @return The hello message\n */\n function sayHello() public pure returns (string memory) {\n return string(\"Hello world from Vechain!\");\n }\n}\n"}},"settings":{"optimizer":{"enabled":false,"runs":200},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}}}},"output":{"sources":{"contracts/VechainHelloWorld.sol":{"ast":{"absolutePath":"contracts/VechainHelloWorld.sol","exportedSymbols":{"VechainHelloWorld":[29]},"id":30,"license":"UNLICENSED","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","0.8",".17"],"nodeType":"PragmaDirective","src":"39:23:0"},{"abstract":false,"baseContracts":[],"canonicalName":"VechainHelloWorld","contractDependencies":[],"contractKind":"contract","documentation":{"id":2,"nodeType":"StructuredDocumentation","src":"64:44:0","text":" A simple contract that says hello"},"fullyImplemented":true,"id":29,"linearizedBaseContracts":[29],"name":"VechainHelloWorld","nameLocation":"118:17:0","nodeType":"ContractDefinition","nodes":[{"constant":false,"functionSelector":"8da5cb5b","id":4,"mutability":"mutable","name":"owner","nameLocation":"165:5:0","nodeType":"VariableDeclaration","scope":29,"src":"142:28:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":3,"name":"address","nodeType":"ElementaryTypeName","src":"142:15:0","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"visibility":"public"},{"body":{"id":15,"nodeType":"Block","src":"199:44:0","statements":[{"expression":{"id":13,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":7,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":4,"src":"209:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"arguments":[{"expression":{"id":10,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"225:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":11,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"229:6:0","memberName":"sender","nodeType":"MemberAccess","src":"225:10:0","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"id":9,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"217:8:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_payable_$","typeString":"type(address payable)"},"typeName":{"id":8,"name":"address","nodeType":"ElementaryTypeName","src":"217:8:0","stateMutability":"payable","typeDescriptions":{}}},"id":12,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"217:19:0","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"209:27:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":14,"nodeType":"ExpressionStatement","src":"209:27:0"}]},"id":16,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nameLocation":"-1:-1:-1","nodeType":"FunctionDefinition","parameters":{"id":5,"nodeType":"ParameterList","parameters":[],"src":"188:2:0"},"returnParameters":{"id":6,"nodeType":"ParameterList","parameters":[],"src":"199:0:0"},"scope":29,"src":"177:66:0","stateMutability":"payable","virtual":false,"visibility":"public"},{"body":{"id":27,"nodeType":"Block","src":"372:59:0","statements":[{"expression":{"arguments":[{"hexValue":"48656c6c6f20776f726c642066726f6d205665636861696e21","id":24,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"396:27:0","typeDescriptions":{"typeIdentifier":"t_stringliteral_6720fecfbca628de400934f9ef8e780733c6b72878435a93efb0535a9a730dc2","typeString":"literal_string \"Hello world from Vechain!\""},"value":"Hello world from Vechain!"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_stringliteral_6720fecfbca628de400934f9ef8e780733c6b72878435a93efb0535a9a730dc2","typeString":"literal_string \"Hello world from Vechain!\""}],"id":23,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"389:6:0","typeDescriptions":{"typeIdentifier":"t_type$_t_string_storage_ptr_$","typeString":"type(string storage pointer)"},"typeName":{"id":22,"name":"string","nodeType":"ElementaryTypeName","src":"389:6:0","typeDescriptions":{}}},"id":25,"isConstant":false,"isLValue":false,"isPure":true,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"389:35:0","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},"functionReturnParameters":21,"id":26,"nodeType":"Return","src":"382:42:0"}]},"documentation":{"id":17,"nodeType":"StructuredDocumentation","src":"249:62:0","text":" Say hello\n @return The hello message"},"functionSelector":"ef5fb05b","id":28,"implemented":true,"kind":"function","modifiers":[],"name":"sayHello","nameLocation":"325:8:0","nodeType":"FunctionDefinition","parameters":{"id":18,"nodeType":"ParameterList","parameters":[],"src":"333:2:0"},"returnParameters":{"id":21,"nodeType":"ParameterList","parameters":[{"constant":false,"id":20,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":28,"src":"357:13:0","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":19,"name":"string","nodeType":"ElementaryTypeName","src":"357:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"}],"src":"356:15:0"},"scope":29,"src":"316:115:0","stateMutability":"pure","virtual":false,"visibility":"public"}],"scope":30,"src":"109:324:0","usedErrors":[]}],"src":"39:395:0"},"id":0},"contracts/VechainHelloWorldWithNonEmptyConstructor.sol":{"ast":{"absolutePath":"contracts/VechainHelloWorldWithNonEmptyConstructor.sol","exportedSymbols":{"VechainHelloWorldWithNonEmptyConstructor":[67]},"id":68,"license":"UNLICENSED","nodeType":"SourceUnit","nodes":[{"id":31,"literals":["solidity","0.8",".17"],"nodeType":"PragmaDirective","src":"39:23:1"},{"abstract":false,"baseContracts":[],"canonicalName":"VechainHelloWorldWithNonEmptyConstructor","contractDependencies":[],"contractKind":"contract","documentation":{"id":32,"nodeType":"StructuredDocumentation","src":"64:44:1","text":" A simple contract that says hello"},"fullyImplemented":true,"id":67,"linearizedBaseContracts":[67],"name":"VechainHelloWorldWithNonEmptyConstructor","nameLocation":"118:40:1","nodeType":"ContractDefinition","nodes":[{"constant":false,"functionSelector":"8da5cb5b","id":34,"mutability":"mutable","name":"owner","nameLocation":"188:5:1","nodeType":"VariableDeclaration","scope":67,"src":"165:28:1","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":33,"name":"address","nodeType":"ElementaryTypeName","src":"165:15:1","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"visibility":"public"},{"constant":false,"functionSelector":"268774ee","id":36,"mutability":"mutable","name":"simpleParameter","nameLocation":"212:15:1","nodeType":"VariableDeclaration","scope":67,"src":"199:28:1","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":35,"name":"uint8","nodeType":"ElementaryTypeName","src":"199:5:1","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"visibility":"public"},{"body":{"id":53,"nodeType":"Block","src":"278:88:1","statements":[{"expression":{"id":47,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":41,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":34,"src":"288:5:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"arguments":[{"expression":{"id":44,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"304:3:1","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":45,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"308:6:1","memberName":"sender","nodeType":"MemberAccess","src":"304:10:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"id":43,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"296:8:1","typeDescriptions":{"typeIdentifier":"t_type$_t_address_payable_$","typeString":"type(address payable)"},"typeName":{"id":42,"name":"address","nodeType":"ElementaryTypeName","src":"296:8:1","stateMutability":"payable","typeDescriptions":{}}},"id":46,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"296:19:1","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"288:27:1","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":48,"nodeType":"ExpressionStatement","src":"288:27:1"},{"expression":{"id":51,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":49,"name":"simpleParameter","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":36,"src":"325:15:1","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"id":50,"name":"_simpleParameter","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":38,"src":"343:16:1","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"src":"325:34:1","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"id":52,"nodeType":"ExpressionStatement","src":"325:34:1"}]},"id":54,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nameLocation":"-1:-1:-1","nodeType":"FunctionDefinition","parameters":{"id":39,"nodeType":"ParameterList","parameters":[{"constant":false,"id":38,"mutability":"mutable","name":"_simpleParameter","nameLocation":"252:16:1","nodeType":"VariableDeclaration","scope":54,"src":"246:22:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":37,"name":"uint8","nodeType":"ElementaryTypeName","src":"246:5:1","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"visibility":"internal"}],"src":"245:24:1"},"returnParameters":{"id":40,"nodeType":"ParameterList","parameters":[],"src":"278:0:1"},"scope":67,"src":"234:132:1","stateMutability":"payable","virtual":false,"visibility":"public"},{"body":{"id":65,"nodeType":"Block","src":"495:59:1","statements":[{"expression":{"arguments":[{"hexValue":"48656c6c6f20776f726c642066726f6d205665636861696e21","id":62,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"519:27:1","typeDescriptions":{"typeIdentifier":"t_stringliteral_6720fecfbca628de400934f9ef8e780733c6b72878435a93efb0535a9a730dc2","typeString":"literal_string \"Hello world from Vechain!\""},"value":"Hello world from Vechain!"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_stringliteral_6720fecfbca628de400934f9ef8e780733c6b72878435a93efb0535a9a730dc2","typeString":"literal_string \"Hello world from Vechain!\""}],"id":61,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"512:6:1","typeDescriptions":{"typeIdentifier":"t_type$_t_string_storage_ptr_$","typeString":"type(string storage pointer)"},"typeName":{"id":60,"name":"string","nodeType":"ElementaryTypeName","src":"512:6:1","typeDescriptions":{}}},"id":63,"isConstant":false,"isLValue":false,"isPure":true,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"512:35:1","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},"functionReturnParameters":59,"id":64,"nodeType":"Return","src":"505:42:1"}]},"documentation":{"id":55,"nodeType":"StructuredDocumentation","src":"372:62:1","text":" Say hello\n @return The hello message"},"functionSelector":"ef5fb05b","id":66,"implemented":true,"kind":"function","modifiers":[],"name":"sayHello","nameLocation":"448:8:1","nodeType":"FunctionDefinition","parameters":{"id":56,"nodeType":"ParameterList","parameters":[],"src":"456:2:1"},"returnParameters":{"id":59,"nodeType":"ParameterList","parameters":[{"constant":false,"id":58,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":66,"src":"480:13:1","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":57,"name":"string","nodeType":"ElementaryTypeName","src":"480:6:1","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"}],"src":"479:15:1"},"scope":67,"src":"439:115:1","stateMutability":"pure","virtual":false,"visibility":"public"}],"scope":68,"src":"109:447:1","usedErrors":[]}],"src":"39:518:1"},"id":1}},"contracts":{"contracts/VechainHelloWorld.sol":{"VechainHelloWorld":{"abi":[{"inputs":[],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sayHello","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}],"evm":{"bytecode":{"functionDebugData":{"@_16":{"entryPoint":null,"id":16,"parameterSlots":0,"returnSlots":0}},"generatedSources":[],"linkReferences":{},"object":"6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061021c806100536000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b1461003b578063ef5fb05b14610059575b600080fd5b610043610077565b6040516100509190610119565b60405180910390f35b61006161009b565b60405161006e91906101c4565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610103826100d8565b9050919050565b610113816100f8565b82525050565b600060208201905061012e600083018461010a565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561016e578082015181840152602081019050610153565b60008484015250505050565b6000601f19601f8301169050919050565b600061019682610134565b6101a0818561013f565b93506101b0818560208601610150565b6101b98161017a565b840191505092915050565b600060208201905081810360008301526101de818461018b565b90509291505056fea2646970667358221220dca2dbc224eb0de22970d7aa13035d31ed65236b97fb9bde63a13d01d13ec72f64736f6c63430008110033","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x21C DUP1 PUSH2 0x53 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x3B JUMPI DUP1 PUSH4 0xEF5FB05B EQ PUSH2 0x59 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x43 PUSH2 0x77 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x50 SWAP2 SWAP1 PUSH2 0x119 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x61 PUSH2 0x9B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x6E SWAP2 SWAP1 PUSH2 0x1C4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x19 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x48656C6C6F20776F726C642066726F6D205665636861696E2100000000000000 DUP2 MSTORE POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x103 DUP3 PUSH2 0xD8 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x113 DUP2 PUSH2 0xF8 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x12E PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x10A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x16E JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x153 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x196 DUP3 PUSH2 0x134 JUMP JUMPDEST PUSH2 0x1A0 DUP2 DUP6 PUSH2 0x13F JUMP JUMPDEST SWAP4 POP PUSH2 0x1B0 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x150 JUMP JUMPDEST PUSH2 0x1B9 DUP2 PUSH2 0x17A JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1DE DUP2 DUP5 PUSH2 0x18B JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xDC LOG2 0xDB 0xC2 0x24 0xEB 0xD 0xE2 0x29 PUSH17 0xD7AA13035D31ED65236B97FB9BDE63A13D ADD 0xD1 RETURNDATACOPY 0xC7 0x2F PUSH5 0x736F6C6343 STOP ADDMOD GT STOP CALLER ","sourceMap":"109:324:0:-:0;;;225:10;209:5;;:27;;;;;;;;;;;;;;;;;;109:324;;;;;;"},"deployedBytecode":{"functionDebugData":{"@owner_4":{"entryPoint":119,"id":4,"parameterSlots":0,"returnSlots":0},"@sayHello_28":{"entryPoint":155,"id":28,"parameterSlots":0,"returnSlots":1},"abi_encode_t_address_payable_to_t_address_payable_fromStack":{"entryPoint":266,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack":{"entryPoint":395,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_address_payable__to_t_address_payable__fromStack_reversed":{"entryPoint":281,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":452,"id":null,"parameterSlots":2,"returnSlots":1},"array_length_t_string_memory_ptr":{"entryPoint":308,"id":null,"parameterSlots":1,"returnSlots":1},"array_storeLengthForEncoding_t_string_memory_ptr_fromStack":{"entryPoint":319,"id":null,"parameterSlots":2,"returnSlots":1},"cleanup_t_address_payable":{"entryPoint":248,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint160":{"entryPoint":216,"id":null,"parameterSlots":1,"returnSlots":1},"copy_memory_to_memory_with_cleanup":{"entryPoint":336,"id":null,"parameterSlots":3,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":378,"id":null,"parameterSlots":1,"returnSlots":1}},"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:1996:2","statements":[{"body":{"nodeType":"YulBlock","src":"52:81:2","statements":[{"nodeType":"YulAssignment","src":"62:65:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"77:5:2"},{"kind":"number","nodeType":"YulLiteral","src":"84:42:2","type":"","value":"0xffffffffffffffffffffffffffffffffffffffff"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"73:3:2"},"nodeType":"YulFunctionCall","src":"73:54:2"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"62:7:2"}]}]},"name":"cleanup_t_uint160","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"34:5:2","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"44:7:2","type":""}],"src":"7:126:2"},{"body":{"nodeType":"YulBlock","src":"192:51:2","statements":[{"nodeType":"YulAssignment","src":"202:35:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"231:5:2"}],"functionName":{"name":"cleanup_t_uint160","nodeType":"YulIdentifier","src":"213:17:2"},"nodeType":"YulFunctionCall","src":"213:24:2"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"202:7:2"}]}]},"name":"cleanup_t_address_payable","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"174:5:2","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"184:7:2","type":""}],"src":"139:104:2"},{"body":{"nodeType":"YulBlock","src":"330:61:2","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"347:3:2"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"378:5:2"}],"functionName":{"name":"cleanup_t_address_payable","nodeType":"YulIdentifier","src":"352:25:2"},"nodeType":"YulFunctionCall","src":"352:32:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"340:6:2"},"nodeType":"YulFunctionCall","src":"340:45:2"},"nodeType":"YulExpressionStatement","src":"340:45:2"}]},"name":"abi_encode_t_address_payable_to_t_address_payable_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"318:5:2","type":""},{"name":"pos","nodeType":"YulTypedName","src":"325:3:2","type":""}],"src":"249:142:2"},{"body":{"nodeType":"YulBlock","src":"511:140:2","statements":[{"nodeType":"YulAssignment","src":"521:26:2","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"533:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"544:2:2","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"529:3:2"},"nodeType":"YulFunctionCall","src":"529:18:2"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"521:4:2"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"617:6:2"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"630:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"641:1:2","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"626:3:2"},"nodeType":"YulFunctionCall","src":"626:17:2"}],"functionName":{"name":"abi_encode_t_address_payable_to_t_address_payable_fromStack","nodeType":"YulIdentifier","src":"557:59:2"},"nodeType":"YulFunctionCall","src":"557:87:2"},"nodeType":"YulExpressionStatement","src":"557:87:2"}]},"name":"abi_encode_tuple_t_address_payable__to_t_address_payable__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"483:9:2","type":""},{"name":"value0","nodeType":"YulTypedName","src":"495:6:2","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"506:4:2","type":""}],"src":"397:254:2"},{"body":{"nodeType":"YulBlock","src":"716:40:2","statements":[{"nodeType":"YulAssignment","src":"727:22:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"743:5:2"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"737:5:2"},"nodeType":"YulFunctionCall","src":"737:12:2"},"variableNames":[{"name":"length","nodeType":"YulIdentifier","src":"727:6:2"}]}]},"name":"array_length_t_string_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"699:5:2","type":""}],"returnVariables":[{"name":"length","nodeType":"YulTypedName","src":"709:6:2","type":""}],"src":"657:99:2"},{"body":{"nodeType":"YulBlock","src":"858:73:2","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"875:3:2"},{"name":"length","nodeType":"YulIdentifier","src":"880:6:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"868:6:2"},"nodeType":"YulFunctionCall","src":"868:19:2"},"nodeType":"YulExpressionStatement","src":"868:19:2"},{"nodeType":"YulAssignment","src":"896:29:2","value":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"915:3:2"},{"kind":"number","nodeType":"YulLiteral","src":"920:4:2","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"911:3:2"},"nodeType":"YulFunctionCall","src":"911:14:2"},"variableNames":[{"name":"updated_pos","nodeType":"YulIdentifier","src":"896:11:2"}]}]},"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nodeType":"YulTypedName","src":"830:3:2","type":""},{"name":"length","nodeType":"YulTypedName","src":"835:6:2","type":""}],"returnVariables":[{"name":"updated_pos","nodeType":"YulTypedName","src":"846:11:2","type":""}],"src":"762:169:2"},{"body":{"nodeType":"YulBlock","src":"999:184:2","statements":[{"nodeType":"YulVariableDeclaration","src":"1009:10:2","value":{"kind":"number","nodeType":"YulLiteral","src":"1018:1:2","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"1013:1:2","type":""}]},{"body":{"nodeType":"YulBlock","src":"1078:63:2","statements":[{"expression":{"arguments":[{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1103:3:2"},{"name":"i","nodeType":"YulIdentifier","src":"1108:1:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1099:3:2"},"nodeType":"YulFunctionCall","src":"1099:11:2"},{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"1122:3:2"},{"name":"i","nodeType":"YulIdentifier","src":"1127:1:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1118:3:2"},"nodeType":"YulFunctionCall","src":"1118:11:2"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"1112:5:2"},"nodeType":"YulFunctionCall","src":"1112:18:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1092:6:2"},"nodeType":"YulFunctionCall","src":"1092:39:2"},"nodeType":"YulExpressionStatement","src":"1092:39:2"}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"1039:1:2"},{"name":"length","nodeType":"YulIdentifier","src":"1042:6:2"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"1036:2:2"},"nodeType":"YulFunctionCall","src":"1036:13:2"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"1050:19:2","statements":[{"nodeType":"YulAssignment","src":"1052:15:2","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"1061:1:2"},{"kind":"number","nodeType":"YulLiteral","src":"1064:2:2","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1057:3:2"},"nodeType":"YulFunctionCall","src":"1057:10:2"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"1052:1:2"}]}]},"pre":{"nodeType":"YulBlock","src":"1032:3:2","statements":[]},"src":"1028:113:2"},{"expression":{"arguments":[{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1161:3:2"},{"name":"length","nodeType":"YulIdentifier","src":"1166:6:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1157:3:2"},"nodeType":"YulFunctionCall","src":"1157:16:2"},{"kind":"number","nodeType":"YulLiteral","src":"1175:1:2","type":"","value":"0"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1150:6:2"},"nodeType":"YulFunctionCall","src":"1150:27:2"},"nodeType":"YulExpressionStatement","src":"1150:27:2"}]},"name":"copy_memory_to_memory_with_cleanup","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nodeType":"YulTypedName","src":"981:3:2","type":""},{"name":"dst","nodeType":"YulTypedName","src":"986:3:2","type":""},{"name":"length","nodeType":"YulTypedName","src":"991:6:2","type":""}],"src":"937:246:2"},{"body":{"nodeType":"YulBlock","src":"1237:54:2","statements":[{"nodeType":"YulAssignment","src":"1247:38:2","value":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1265:5:2"},{"kind":"number","nodeType":"YulLiteral","src":"1272:2:2","type":"","value":"31"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1261:3:2"},"nodeType":"YulFunctionCall","src":"1261:14:2"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1281:2:2","type":"","value":"31"}],"functionName":{"name":"not","nodeType":"YulIdentifier","src":"1277:3:2"},"nodeType":"YulFunctionCall","src":"1277:7:2"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"1257:3:2"},"nodeType":"YulFunctionCall","src":"1257:28:2"},"variableNames":[{"name":"result","nodeType":"YulIdentifier","src":"1247:6:2"}]}]},"name":"round_up_to_mul_of_32","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1220:5:2","type":""}],"returnVariables":[{"name":"result","nodeType":"YulTypedName","src":"1230:6:2","type":""}],"src":"1189:102:2"},{"body":{"nodeType":"YulBlock","src":"1389:285:2","statements":[{"nodeType":"YulVariableDeclaration","src":"1399:53:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1446:5:2"}],"functionName":{"name":"array_length_t_string_memory_ptr","nodeType":"YulIdentifier","src":"1413:32:2"},"nodeType":"YulFunctionCall","src":"1413:39:2"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"1403:6:2","type":""}]},{"nodeType":"YulAssignment","src":"1461:78:2","value":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1527:3:2"},{"name":"length","nodeType":"YulIdentifier","src":"1532:6:2"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nodeType":"YulIdentifier","src":"1468:58:2"},"nodeType":"YulFunctionCall","src":"1468:71:2"},"variableNames":[{"name":"pos","nodeType":"YulIdentifier","src":"1461:3:2"}]},{"expression":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1587:5:2"},{"kind":"number","nodeType":"YulLiteral","src":"1594:4:2","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1583:3:2"},"nodeType":"YulFunctionCall","src":"1583:16:2"},{"name":"pos","nodeType":"YulIdentifier","src":"1601:3:2"},{"name":"length","nodeType":"YulIdentifier","src":"1606:6:2"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nodeType":"YulIdentifier","src":"1548:34:2"},"nodeType":"YulFunctionCall","src":"1548:65:2"},"nodeType":"YulExpressionStatement","src":"1548:65:2"},{"nodeType":"YulAssignment","src":"1622:46:2","value":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1633:3:2"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"1660:6:2"}],"functionName":{"name":"round_up_to_mul_of_32","nodeType":"YulIdentifier","src":"1638:21:2"},"nodeType":"YulFunctionCall","src":"1638:29:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1629:3:2"},"nodeType":"YulFunctionCall","src":"1629:39:2"},"variableNames":[{"name":"end","nodeType":"YulIdentifier","src":"1622:3:2"}]}]},"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1370:5:2","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1377:3:2","type":""}],"returnVariables":[{"name":"end","nodeType":"YulTypedName","src":"1385:3:2","type":""}],"src":"1297:377:2"},{"body":{"nodeType":"YulBlock","src":"1798:195:2","statements":[{"nodeType":"YulAssignment","src":"1808:26:2","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1820:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"1831:2:2","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1816:3:2"},"nodeType":"YulFunctionCall","src":"1816:18:2"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1808:4:2"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1855:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"1866:1:2","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1851:3:2"},"nodeType":"YulFunctionCall","src":"1851:17:2"},{"arguments":[{"name":"tail","nodeType":"YulIdentifier","src":"1874:4:2"},{"name":"headStart","nodeType":"YulIdentifier","src":"1880:9:2"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"1870:3:2"},"nodeType":"YulFunctionCall","src":"1870:20:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1844:6:2"},"nodeType":"YulFunctionCall","src":"1844:47:2"},"nodeType":"YulExpressionStatement","src":"1844:47:2"},{"nodeType":"YulAssignment","src":"1900:86:2","value":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"1972:6:2"},{"name":"tail","nodeType":"YulIdentifier","src":"1981:4:2"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nodeType":"YulIdentifier","src":"1908:63:2"},"nodeType":"YulFunctionCall","src":"1908:78:2"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1900:4:2"}]}]},"name":"abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1770:9:2","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1782:6:2","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1793:4:2","type":""}],"src":"1680:313:2"}]},"contents":"{\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address_payable(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function abi_encode_t_address_payable_to_t_address_payable_fromStack(value, pos) {\n mstore(pos, cleanup_t_address_payable(value))\n }\n\n function abi_encode_tuple_t_address_payable__to_t_address_payable__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_address_payable_to_t_address_payable_fromStack(value0, add(headStart, 0))\n\n }\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function copy_memory_to_memory_with_cleanup(src, dst, length) {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n mstore(add(dst, length), 0)\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)\n copy_memory_to_memory_with_cleanup(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail)\n\n }\n\n}\n","id":2,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b1461003b578063ef5fb05b14610059575b600080fd5b610043610077565b6040516100509190610119565b60405180910390f35b61006161009b565b60405161006e91906101c4565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610103826100d8565b9050919050565b610113816100f8565b82525050565b600060208201905061012e600083018461010a565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561016e578082015181840152602081019050610153565b60008484015250505050565b6000601f19601f8301169050919050565b600061019682610134565b6101a0818561013f565b93506101b0818560208601610150565b6101b98161017a565b840191505092915050565b600060208201905081810360008301526101de818461018b565b90509291505056fea2646970667358221220dca2dbc224eb0de22970d7aa13035d31ed65236b97fb9bde63a13d01d13ec72f64736f6c63430008110033","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x3B JUMPI DUP1 PUSH4 0xEF5FB05B EQ PUSH2 0x59 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x43 PUSH2 0x77 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x50 SWAP2 SWAP1 PUSH2 0x119 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x61 PUSH2 0x9B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x6E SWAP2 SWAP1 PUSH2 0x1C4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x19 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x48656C6C6F20776F726C642066726F6D205665636861696E2100000000000000 DUP2 MSTORE POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x103 DUP3 PUSH2 0xD8 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x113 DUP2 PUSH2 0xF8 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x12E PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x10A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x16E JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x153 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x196 DUP3 PUSH2 0x134 JUMP JUMPDEST PUSH2 0x1A0 DUP2 DUP6 PUSH2 0x13F JUMP JUMPDEST SWAP4 POP PUSH2 0x1B0 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x150 JUMP JUMPDEST PUSH2 0x1B9 DUP2 PUSH2 0x17A JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1DE DUP2 DUP5 PUSH2 0x18B JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xDC LOG2 0xDB 0xC2 0x24 0xEB 0xD 0xE2 0x29 PUSH17 0xD7AA13035D31ED65236B97FB9BDE63A13D ADD 0xD1 RETURNDATACOPY 0xC7 0x2F PUSH5 0x736F6C6343 STOP ADDMOD GT STOP CALLER ","sourceMap":"109:324:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;142:28;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;316:115;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;142:28;;;;;;;;;;;;:::o;316:115::-;357:13;389:35;;;;;;;;;;;;;;;;;382:42;;316:115;:::o;7:126:2:-;44:7;84:42;77:5;73:54;62:65;;7:126;;;:::o;139:104::-;184:7;213:24;231:5;213:24;:::i;:::-;202:35;;139:104;;;:::o;249:142::-;352:32;378:5;352:32;:::i;:::-;347:3;340:45;249:142;;:::o;397:254::-;506:4;544:2;533:9;529:18;521:26;;557:87;641:1;630:9;626:17;617:6;557:87;:::i;:::-;397:254;;;;:::o;657:99::-;709:6;743:5;737:12;727:22;;657:99;;;:::o;762:169::-;846:11;880:6;875:3;868:19;920:4;915:3;911:14;896:29;;762:169;;;;:::o;937:246::-;1018:1;1028:113;1042:6;1039:1;1036:13;1028:113;;;1127:1;1122:3;1118:11;1112:18;1108:1;1103:3;1099:11;1092:39;1064:2;1061:1;1057:10;1052:15;;1028:113;;;1175:1;1166:6;1161:3;1157:16;1150:27;999:184;937:246;;;:::o;1189:102::-;1230:6;1281:2;1277:7;1272:2;1265:5;1261:14;1257:28;1247:38;;1189:102;;;:::o;1297:377::-;1385:3;1413:39;1446:5;1413:39;:::i;:::-;1468:71;1532:6;1527:3;1468:71;:::i;:::-;1461:78;;1548:65;1606:6;1601:3;1594:4;1587:5;1583:16;1548:65;:::i;:::-;1638:29;1660:6;1638:29;:::i;:::-;1633:3;1629:39;1622:46;;1389:285;1297:377;;;;:::o;1680:313::-;1793:4;1831:2;1820:9;1816:18;1808:26;;1880:9;1874:4;1870:20;1866:1;1855:9;1851:17;1844:47;1908:78;1981:4;1972:6;1908:78;:::i;:::-;1900:86;;1680:313;;;;:::o"},"methodIdentifiers":{"owner()":"8da5cb5b","sayHello()":"ef5fb05b"}},"metadata":"{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sayHello\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"sayHello()\":{\"returns\":{\"_0\":\"The hello message\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"sayHello()\":{\"notice\":\"Say hello\"}},\"notice\":\"A simple contract that says hello\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/VechainHelloWorld.sol\":\"VechainHelloWorld\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/VechainHelloWorld.sol\":{\"keccak256\":\"0x9a8023e99846c369d4916c568448fad43a604dad61fb710e753a620fa8259201\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://f49a39c0bfbdaf9faaf58eef973a6da40d5f9ea81f51e519ee57937eb565e37b\",\"dweb:/ipfs/QmRWzfniGPwcYm6KFrtszpffgfUV8oLQmzciDdxrUDktp3\"]}},\"version\":1}"}},"contracts/VechainHelloWorldWithNonEmptyConstructor.sol":{"VechainHelloWorldWithNonEmptyConstructor":{"abi":[{"inputs":[{"internalType":"uint8","name":"_simpleParameter","type":"uint8"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sayHello","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"simpleParameter","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}],"evm":{"bytecode":{"functionDebugData":{"@_54":{"entryPoint":null,"id":54,"parameterSlots":1,"returnSlots":0},"abi_decode_t_uint8_fromMemory":{"entryPoint":175,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_uint8_fromMemory":{"entryPoint":196,"id":null,"parameterSlots":2,"returnSlots":1},"allocate_unbounded":{"entryPoint":null,"id":null,"parameterSlots":0,"returnSlots":1},"cleanup_t_uint8":{"entryPoint":139,"id":null,"parameterSlots":1,"returnSlots":1},"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db":{"entryPoint":null,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b":{"entryPoint":134,"id":null,"parameterSlots":0,"returnSlots":0},"validator_revert_t_uint8":{"entryPoint":152,"id":null,"parameterSlots":1,"returnSlots":0}},"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:1045:2","statements":[{"body":{"nodeType":"YulBlock","src":"47:35:2","statements":[{"nodeType":"YulAssignment","src":"57:19:2","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"73:2:2","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"67:5:2"},"nodeType":"YulFunctionCall","src":"67:9:2"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"57:6:2"}]}]},"name":"allocate_unbounded","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"40:6:2","type":""}],"src":"7:75:2"},{"body":{"nodeType":"YulBlock","src":"177:28:2","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"194:1:2","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"197:1:2","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"187:6:2"},"nodeType":"YulFunctionCall","src":"187:12:2"},"nodeType":"YulExpressionStatement","src":"187:12:2"}]},"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nodeType":"YulFunctionDefinition","src":"88:117:2"},{"body":{"nodeType":"YulBlock","src":"300:28:2","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"317:1:2","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"320:1:2","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"310:6:2"},"nodeType":"YulFunctionCall","src":"310:12:2"},"nodeType":"YulExpressionStatement","src":"310:12:2"}]},"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nodeType":"YulFunctionDefinition","src":"211:117:2"},{"body":{"nodeType":"YulBlock","src":"377:43:2","statements":[{"nodeType":"YulAssignment","src":"387:27:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"402:5:2"},{"kind":"number","nodeType":"YulLiteral","src":"409:4:2","type":"","value":"0xff"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"398:3:2"},"nodeType":"YulFunctionCall","src":"398:16:2"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"387:7:2"}]}]},"name":"cleanup_t_uint8","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"359:5:2","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"369:7:2","type":""}],"src":"334:86:2"},{"body":{"nodeType":"YulBlock","src":"467:77:2","statements":[{"body":{"nodeType":"YulBlock","src":"522:16:2","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"531:1:2","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"534:1:2","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"524:6:2"},"nodeType":"YulFunctionCall","src":"524:12:2"},"nodeType":"YulExpressionStatement","src":"524:12:2"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"490:5:2"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"513:5:2"}],"functionName":{"name":"cleanup_t_uint8","nodeType":"YulIdentifier","src":"497:15:2"},"nodeType":"YulFunctionCall","src":"497:22:2"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"487:2:2"},"nodeType":"YulFunctionCall","src":"487:33:2"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"480:6:2"},"nodeType":"YulFunctionCall","src":"480:41:2"},"nodeType":"YulIf","src":"477:61:2"}]},"name":"validator_revert_t_uint8","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"460:5:2","type":""}],"src":"426:118:2"},{"body":{"nodeType":"YulBlock","src":"611:78:2","statements":[{"nodeType":"YulAssignment","src":"621:22:2","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"636:6:2"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"630:5:2"},"nodeType":"YulFunctionCall","src":"630:13:2"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"621:5:2"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"677:5:2"}],"functionName":{"name":"validator_revert_t_uint8","nodeType":"YulIdentifier","src":"652:24:2"},"nodeType":"YulFunctionCall","src":"652:31:2"},"nodeType":"YulExpressionStatement","src":"652:31:2"}]},"name":"abi_decode_t_uint8_fromMemory","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"589:6:2","type":""},{"name":"end","nodeType":"YulTypedName","src":"597:3:2","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"605:5:2","type":""}],"src":"550:139:2"},{"body":{"nodeType":"YulBlock","src":"770:272:2","statements":[{"body":{"nodeType":"YulBlock","src":"816:83:2","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nodeType":"YulIdentifier","src":"818:77:2"},"nodeType":"YulFunctionCall","src":"818:79:2"},"nodeType":"YulExpressionStatement","src":"818:79:2"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"791:7:2"},{"name":"headStart","nodeType":"YulIdentifier","src":"800:9:2"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"787:3:2"},"nodeType":"YulFunctionCall","src":"787:23:2"},{"kind":"number","nodeType":"YulLiteral","src":"812:2:2","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"783:3:2"},"nodeType":"YulFunctionCall","src":"783:32:2"},"nodeType":"YulIf","src":"780:119:2"},{"nodeType":"YulBlock","src":"909:126:2","statements":[{"nodeType":"YulVariableDeclaration","src":"924:15:2","value":{"kind":"number","nodeType":"YulLiteral","src":"938:1:2","type":"","value":"0"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"928:6:2","type":""}]},{"nodeType":"YulAssignment","src":"953:72:2","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"997:9:2"},{"name":"offset","nodeType":"YulIdentifier","src":"1008:6:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"993:3:2"},"nodeType":"YulFunctionCall","src":"993:22:2"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1017:7:2"}],"functionName":{"name":"abi_decode_t_uint8_fromMemory","nodeType":"YulIdentifier","src":"963:29:2"},"nodeType":"YulFunctionCall","src":"963:62:2"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"953:6:2"}]}]}]},"name":"abi_decode_tuple_t_uint8_fromMemory","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"740:9:2","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"751:7:2","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"763:6:2","type":""}],"src":"695:347:2"}]},"contents":"{\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function cleanup_t_uint8(value) -> cleaned {\n cleaned := and(value, 0xff)\n }\n\n function validator_revert_t_uint8(value) {\n if iszero(eq(value, cleanup_t_uint8(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_uint8_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_uint8(value)\n }\n\n function abi_decode_tuple_t_uint8_fromMemory(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_uint8_fromMemory(add(headStart, offset), dataEnd)\n }\n\n }\n\n}\n","id":2,"language":"Yul","name":"#utility.yul"}],"linkReferences":{},"object":"608060405260405161038f38038061038f833981810160405281019061002591906100c4565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600060146101000a81548160ff021916908360ff160217905550506100f1565b600080fd5b600060ff82169050919050565b6100a18161008b565b81146100ac57600080fd5b50565b6000815190506100be81610098565b92915050565b6000602082840312156100da576100d9610086565b5b60006100e8848285016100af565b91505092915050565b61028f806101006000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063268774ee146100465780638da5cb5b14610064578063ef5fb05b14610082575b600080fd5b61004e6100a0565b60405161005b9190610130565b60405180910390f35b61006c6100b3565b604051610079919061018c565b60405180910390f35b61008a6100d7565b6040516100979190610237565b60405180910390f35b600060149054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600060ff82169050919050565b61012a81610114565b82525050565b60006020820190506101456000830184610121565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101768261014b565b9050919050565b6101868161016b565b82525050565b60006020820190506101a1600083018461017d565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156101e15780820151818401526020810190506101c6565b60008484015250505050565b6000601f19601f8301169050919050565b6000610209826101a7565b61021381856101b2565b93506102238185602086016101c3565b61022c816101ed565b840191505092915050565b6000602082019050818103600083015261025181846101fe565b90509291505056fea2646970667358221220a8d9cb0429fef46fb1c7c9a58e4dfac76fe050709cf08e59aca68614cd6d6c9a64736f6c63430008110033","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD PUSH2 0x38F CODESIZE SUB DUP1 PUSH2 0x38F DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE DUP2 ADD SWAP1 PUSH2 0x25 SWAP2 SWAP1 PUSH2 0xC4 JUMP JUMPDEST CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP1 PUSH1 0x0 PUSH1 0x14 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 PUSH1 0xFF AND MUL OR SWAP1 SSTORE POP POP PUSH2 0xF1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0xFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xA1 DUP2 PUSH2 0x8B JUMP JUMPDEST DUP2 EQ PUSH2 0xAC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0xBE DUP2 PUSH2 0x98 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xDA JUMPI PUSH2 0xD9 PUSH2 0x86 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xE8 DUP5 DUP3 DUP6 ADD PUSH2 0xAF JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x28F DUP1 PUSH2 0x100 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x41 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x268774EE EQ PUSH2 0x46 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x64 JUMPI DUP1 PUSH4 0xEF5FB05B EQ PUSH2 0x82 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E PUSH2 0xA0 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5B SWAP2 SWAP1 PUSH2 0x130 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x6C PUSH2 0xB3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x79 SWAP2 SWAP1 PUSH2 0x18C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x8A PUSH2 0xD7 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x97 SWAP2 SWAP1 PUSH2 0x237 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH1 0x14 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x19 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x48656C6C6F20776F726C642066726F6D205665636861696E2100000000000000 DUP2 MSTORE POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0xFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x12A DUP2 PUSH2 0x114 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x145 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x121 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x176 DUP3 PUSH2 0x14B JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x186 DUP2 PUSH2 0x16B JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1A1 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x17D JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1E1 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x1C6 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x209 DUP3 PUSH2 0x1A7 JUMP JUMPDEST PUSH2 0x213 DUP2 DUP6 PUSH2 0x1B2 JUMP JUMPDEST SWAP4 POP PUSH2 0x223 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1C3 JUMP JUMPDEST PUSH2 0x22C DUP2 PUSH2 0x1ED JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x251 DUP2 DUP5 PUSH2 0x1FE JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xA8 0xD9 0xCB DIV 0x29 INVALID DELEGATECALL PUSH16 0xB1C7C9A58E4DFAC76FE050709CF08E59 0xAC 0xA6 DUP7 EQ 0xCD PUSH14 0x6C9A64736F6C6343000811003300 ","sourceMap":"109:447:1:-:0;;;234:132;;;;;;;;;;;;;;;;;;;;;:::i;:::-;304:10;288:5;;:27;;;;;;;;;;;;;;;;;;343:16;325:15;;:34;;;;;;;;;;;;;;;;;;234:132;109:447;;88:117:2;197:1;194;187:12;334:86;369:7;409:4;402:5;398:16;387:27;;334:86;;;:::o;426:118::-;497:22;513:5;497:22;:::i;:::-;490:5;487:33;477:61;;534:1;531;524:12;477:61;426:118;:::o;550:139::-;605:5;636:6;630:13;621:22;;652:31;677:5;652:31;:::i;:::-;550:139;;;;:::o;695:347::-;763:6;812:2;800:9;791:7;787:23;783:32;780:119;;;818:79;;:::i;:::-;780:119;938:1;963:62;1017:7;1008:6;997:9;993:22;963:62;:::i;:::-;953:72;;909:126;695:347;;;;:::o;109:447:1:-;;;;;;;"},"deployedBytecode":{"functionDebugData":{"@owner_34":{"entryPoint":179,"id":34,"parameterSlots":0,"returnSlots":0},"@sayHello_66":{"entryPoint":215,"id":66,"parameterSlots":0,"returnSlots":1},"@simpleParameter_36":{"entryPoint":160,"id":36,"parameterSlots":0,"returnSlots":0},"abi_encode_t_address_payable_to_t_address_payable_fromStack":{"entryPoint":381,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack":{"entryPoint":510,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_uint8_to_t_uint8_fromStack":{"entryPoint":289,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_tuple_t_address_payable__to_t_address_payable__fromStack_reversed":{"entryPoint":396,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":567,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_uint8__to_t_uint8__fromStack_reversed":{"entryPoint":304,"id":null,"parameterSlots":2,"returnSlots":1},"array_length_t_string_memory_ptr":{"entryPoint":423,"id":null,"parameterSlots":1,"returnSlots":1},"array_storeLengthForEncoding_t_string_memory_ptr_fromStack":{"entryPoint":434,"id":null,"parameterSlots":2,"returnSlots":1},"cleanup_t_address_payable":{"entryPoint":363,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint160":{"entryPoint":331,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint8":{"entryPoint":276,"id":null,"parameterSlots":1,"returnSlots":1},"copy_memory_to_memory_with_cleanup":{"entryPoint":451,"id":null,"parameterSlots":3,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":493,"id":null,"parameterSlots":1,"returnSlots":1}},"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:2426:2","statements":[{"body":{"nodeType":"YulBlock","src":"50:43:2","statements":[{"nodeType":"YulAssignment","src":"60:27:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"75:5:2"},{"kind":"number","nodeType":"YulLiteral","src":"82:4:2","type":"","value":"0xff"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"71:3:2"},"nodeType":"YulFunctionCall","src":"71:16:2"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"60:7:2"}]}]},"name":"cleanup_t_uint8","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"32:5:2","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"42:7:2","type":""}],"src":"7:86:2"},{"body":{"nodeType":"YulBlock","src":"160:51:2","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"177:3:2"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"198:5:2"}],"functionName":{"name":"cleanup_t_uint8","nodeType":"YulIdentifier","src":"182:15:2"},"nodeType":"YulFunctionCall","src":"182:22:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"170:6:2"},"nodeType":"YulFunctionCall","src":"170:35:2"},"nodeType":"YulExpressionStatement","src":"170:35:2"}]},"name":"abi_encode_t_uint8_to_t_uint8_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"148:5:2","type":""},{"name":"pos","nodeType":"YulTypedName","src":"155:3:2","type":""}],"src":"99:112:2"},{"body":{"nodeType":"YulBlock","src":"311:120:2","statements":[{"nodeType":"YulAssignment","src":"321:26:2","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"333:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"344:2:2","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"329:3:2"},"nodeType":"YulFunctionCall","src":"329:18:2"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"321:4:2"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"397:6:2"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"410:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"421:1:2","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"406:3:2"},"nodeType":"YulFunctionCall","src":"406:17:2"}],"functionName":{"name":"abi_encode_t_uint8_to_t_uint8_fromStack","nodeType":"YulIdentifier","src":"357:39:2"},"nodeType":"YulFunctionCall","src":"357:67:2"},"nodeType":"YulExpressionStatement","src":"357:67:2"}]},"name":"abi_encode_tuple_t_uint8__to_t_uint8__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"283:9:2","type":""},{"name":"value0","nodeType":"YulTypedName","src":"295:6:2","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"306:4:2","type":""}],"src":"217:214:2"},{"body":{"nodeType":"YulBlock","src":"482:81:2","statements":[{"nodeType":"YulAssignment","src":"492:65:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"507:5:2"},{"kind":"number","nodeType":"YulLiteral","src":"514:42:2","type":"","value":"0xffffffffffffffffffffffffffffffffffffffff"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"503:3:2"},"nodeType":"YulFunctionCall","src":"503:54:2"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"492:7:2"}]}]},"name":"cleanup_t_uint160","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"464:5:2","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"474:7:2","type":""}],"src":"437:126:2"},{"body":{"nodeType":"YulBlock","src":"622:51:2","statements":[{"nodeType":"YulAssignment","src":"632:35:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"661:5:2"}],"functionName":{"name":"cleanup_t_uint160","nodeType":"YulIdentifier","src":"643:17:2"},"nodeType":"YulFunctionCall","src":"643:24:2"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"632:7:2"}]}]},"name":"cleanup_t_address_payable","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"604:5:2","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"614:7:2","type":""}],"src":"569:104:2"},{"body":{"nodeType":"YulBlock","src":"760:61:2","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"777:3:2"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"808:5:2"}],"functionName":{"name":"cleanup_t_address_payable","nodeType":"YulIdentifier","src":"782:25:2"},"nodeType":"YulFunctionCall","src":"782:32:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"770:6:2"},"nodeType":"YulFunctionCall","src":"770:45:2"},"nodeType":"YulExpressionStatement","src":"770:45:2"}]},"name":"abi_encode_t_address_payable_to_t_address_payable_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"748:5:2","type":""},{"name":"pos","nodeType":"YulTypedName","src":"755:3:2","type":""}],"src":"679:142:2"},{"body":{"nodeType":"YulBlock","src":"941:140:2","statements":[{"nodeType":"YulAssignment","src":"951:26:2","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"963:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"974:2:2","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"959:3:2"},"nodeType":"YulFunctionCall","src":"959:18:2"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"951:4:2"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"1047:6:2"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1060:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"1071:1:2","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1056:3:2"},"nodeType":"YulFunctionCall","src":"1056:17:2"}],"functionName":{"name":"abi_encode_t_address_payable_to_t_address_payable_fromStack","nodeType":"YulIdentifier","src":"987:59:2"},"nodeType":"YulFunctionCall","src":"987:87:2"},"nodeType":"YulExpressionStatement","src":"987:87:2"}]},"name":"abi_encode_tuple_t_address_payable__to_t_address_payable__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"913:9:2","type":""},{"name":"value0","nodeType":"YulTypedName","src":"925:6:2","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"936:4:2","type":""}],"src":"827:254:2"},{"body":{"nodeType":"YulBlock","src":"1146:40:2","statements":[{"nodeType":"YulAssignment","src":"1157:22:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1173:5:2"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"1167:5:2"},"nodeType":"YulFunctionCall","src":"1167:12:2"},"variableNames":[{"name":"length","nodeType":"YulIdentifier","src":"1157:6:2"}]}]},"name":"array_length_t_string_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1129:5:2","type":""}],"returnVariables":[{"name":"length","nodeType":"YulTypedName","src":"1139:6:2","type":""}],"src":"1087:99:2"},{"body":{"nodeType":"YulBlock","src":"1288:73:2","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1305:3:2"},{"name":"length","nodeType":"YulIdentifier","src":"1310:6:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1298:6:2"},"nodeType":"YulFunctionCall","src":"1298:19:2"},"nodeType":"YulExpressionStatement","src":"1298:19:2"},{"nodeType":"YulAssignment","src":"1326:29:2","value":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1345:3:2"},{"kind":"number","nodeType":"YulLiteral","src":"1350:4:2","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1341:3:2"},"nodeType":"YulFunctionCall","src":"1341:14:2"},"variableNames":[{"name":"updated_pos","nodeType":"YulIdentifier","src":"1326:11:2"}]}]},"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nodeType":"YulTypedName","src":"1260:3:2","type":""},{"name":"length","nodeType":"YulTypedName","src":"1265:6:2","type":""}],"returnVariables":[{"name":"updated_pos","nodeType":"YulTypedName","src":"1276:11:2","type":""}],"src":"1192:169:2"},{"body":{"nodeType":"YulBlock","src":"1429:184:2","statements":[{"nodeType":"YulVariableDeclaration","src":"1439:10:2","value":{"kind":"number","nodeType":"YulLiteral","src":"1448:1:2","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"1443:1:2","type":""}]},{"body":{"nodeType":"YulBlock","src":"1508:63:2","statements":[{"expression":{"arguments":[{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1533:3:2"},{"name":"i","nodeType":"YulIdentifier","src":"1538:1:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1529:3:2"},"nodeType":"YulFunctionCall","src":"1529:11:2"},{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"1552:3:2"},{"name":"i","nodeType":"YulIdentifier","src":"1557:1:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1548:3:2"},"nodeType":"YulFunctionCall","src":"1548:11:2"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"1542:5:2"},"nodeType":"YulFunctionCall","src":"1542:18:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1522:6:2"},"nodeType":"YulFunctionCall","src":"1522:39:2"},"nodeType":"YulExpressionStatement","src":"1522:39:2"}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"1469:1:2"},{"name":"length","nodeType":"YulIdentifier","src":"1472:6:2"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"1466:2:2"},"nodeType":"YulFunctionCall","src":"1466:13:2"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"1480:19:2","statements":[{"nodeType":"YulAssignment","src":"1482:15:2","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"1491:1:2"},{"kind":"number","nodeType":"YulLiteral","src":"1494:2:2","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1487:3:2"},"nodeType":"YulFunctionCall","src":"1487:10:2"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"1482:1:2"}]}]},"pre":{"nodeType":"YulBlock","src":"1462:3:2","statements":[]},"src":"1458:113:2"},{"expression":{"arguments":[{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1591:3:2"},{"name":"length","nodeType":"YulIdentifier","src":"1596:6:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1587:3:2"},"nodeType":"YulFunctionCall","src":"1587:16:2"},{"kind":"number","nodeType":"YulLiteral","src":"1605:1:2","type":"","value":"0"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1580:6:2"},"nodeType":"YulFunctionCall","src":"1580:27:2"},"nodeType":"YulExpressionStatement","src":"1580:27:2"}]},"name":"copy_memory_to_memory_with_cleanup","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nodeType":"YulTypedName","src":"1411:3:2","type":""},{"name":"dst","nodeType":"YulTypedName","src":"1416:3:2","type":""},{"name":"length","nodeType":"YulTypedName","src":"1421:6:2","type":""}],"src":"1367:246:2"},{"body":{"nodeType":"YulBlock","src":"1667:54:2","statements":[{"nodeType":"YulAssignment","src":"1677:38:2","value":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1695:5:2"},{"kind":"number","nodeType":"YulLiteral","src":"1702:2:2","type":"","value":"31"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1691:3:2"},"nodeType":"YulFunctionCall","src":"1691:14:2"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1711:2:2","type":"","value":"31"}],"functionName":{"name":"not","nodeType":"YulIdentifier","src":"1707:3:2"},"nodeType":"YulFunctionCall","src":"1707:7:2"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"1687:3:2"},"nodeType":"YulFunctionCall","src":"1687:28:2"},"variableNames":[{"name":"result","nodeType":"YulIdentifier","src":"1677:6:2"}]}]},"name":"round_up_to_mul_of_32","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1650:5:2","type":""}],"returnVariables":[{"name":"result","nodeType":"YulTypedName","src":"1660:6:2","type":""}],"src":"1619:102:2"},{"body":{"nodeType":"YulBlock","src":"1819:285:2","statements":[{"nodeType":"YulVariableDeclaration","src":"1829:53:2","value":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1876:5:2"}],"functionName":{"name":"array_length_t_string_memory_ptr","nodeType":"YulIdentifier","src":"1843:32:2"},"nodeType":"YulFunctionCall","src":"1843:39:2"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"1833:6:2","type":""}]},{"nodeType":"YulAssignment","src":"1891:78:2","value":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1957:3:2"},{"name":"length","nodeType":"YulIdentifier","src":"1962:6:2"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nodeType":"YulIdentifier","src":"1898:58:2"},"nodeType":"YulFunctionCall","src":"1898:71:2"},"variableNames":[{"name":"pos","nodeType":"YulIdentifier","src":"1891:3:2"}]},{"expression":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2017:5:2"},{"kind":"number","nodeType":"YulLiteral","src":"2024:4:2","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2013:3:2"},"nodeType":"YulFunctionCall","src":"2013:16:2"},{"name":"pos","nodeType":"YulIdentifier","src":"2031:3:2"},{"name":"length","nodeType":"YulIdentifier","src":"2036:6:2"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nodeType":"YulIdentifier","src":"1978:34:2"},"nodeType":"YulFunctionCall","src":"1978:65:2"},"nodeType":"YulExpressionStatement","src":"1978:65:2"},{"nodeType":"YulAssignment","src":"2052:46:2","value":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"2063:3:2"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2090:6:2"}],"functionName":{"name":"round_up_to_mul_of_32","nodeType":"YulIdentifier","src":"2068:21:2"},"nodeType":"YulFunctionCall","src":"2068:29:2"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2059:3:2"},"nodeType":"YulFunctionCall","src":"2059:39:2"},"variableNames":[{"name":"end","nodeType":"YulIdentifier","src":"2052:3:2"}]}]},"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1800:5:2","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1807:3:2","type":""}],"returnVariables":[{"name":"end","nodeType":"YulTypedName","src":"1815:3:2","type":""}],"src":"1727:377:2"},{"body":{"nodeType":"YulBlock","src":"2228:195:2","statements":[{"nodeType":"YulAssignment","src":"2238:26:2","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"2250:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"2261:2:2","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2246:3:2"},"nodeType":"YulFunctionCall","src":"2246:18:2"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"2238:4:2"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"2285:9:2"},{"kind":"number","nodeType":"YulLiteral","src":"2296:1:2","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2281:3:2"},"nodeType":"YulFunctionCall","src":"2281:17:2"},{"arguments":[{"name":"tail","nodeType":"YulIdentifier","src":"2304:4:2"},{"name":"headStart","nodeType":"YulIdentifier","src":"2310:9:2"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"2300:3:2"},"nodeType":"YulFunctionCall","src":"2300:20:2"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2274:6:2"},"nodeType":"YulFunctionCall","src":"2274:47:2"},"nodeType":"YulExpressionStatement","src":"2274:47:2"},{"nodeType":"YulAssignment","src":"2330:86:2","value":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"2402:6:2"},{"name":"tail","nodeType":"YulIdentifier","src":"2411:4:2"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nodeType":"YulIdentifier","src":"2338:63:2"},"nodeType":"YulFunctionCall","src":"2338:78:2"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"2330:4:2"}]}]},"name":"abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"2200:9:2","type":""},{"name":"value0","nodeType":"YulTypedName","src":"2212:6:2","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"2223:4:2","type":""}],"src":"2110:313:2"}]},"contents":"{\n\n function cleanup_t_uint8(value) -> cleaned {\n cleaned := and(value, 0xff)\n }\n\n function abi_encode_t_uint8_to_t_uint8_fromStack(value, pos) {\n mstore(pos, cleanup_t_uint8(value))\n }\n\n function abi_encode_tuple_t_uint8__to_t_uint8__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_uint8_to_t_uint8_fromStack(value0, add(headStart, 0))\n\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address_payable(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function abi_encode_t_address_payable_to_t_address_payable_fromStack(value, pos) {\n mstore(pos, cleanup_t_address_payable(value))\n }\n\n function abi_encode_tuple_t_address_payable__to_t_address_payable__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_address_payable_to_t_address_payable_fromStack(value0, add(headStart, 0))\n\n }\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function copy_memory_to_memory_with_cleanup(src, dst, length) {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n mstore(add(dst, length), 0)\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)\n copy_memory_to_memory_with_cleanup(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail)\n\n }\n\n}\n","id":2,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"608060405234801561001057600080fd5b50600436106100415760003560e01c8063268774ee146100465780638da5cb5b14610064578063ef5fb05b14610082575b600080fd5b61004e6100a0565b60405161005b9190610130565b60405180910390f35b61006c6100b3565b604051610079919061018c565b60405180910390f35b61008a6100d7565b6040516100979190610237565b60405180910390f35b600060149054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600060ff82169050919050565b61012a81610114565b82525050565b60006020820190506101456000830184610121565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101768261014b565b9050919050565b6101868161016b565b82525050565b60006020820190506101a1600083018461017d565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156101e15780820151818401526020810190506101c6565b60008484015250505050565b6000601f19601f8301169050919050565b6000610209826101a7565b61021381856101b2565b93506102238185602086016101c3565b61022c816101ed565b840191505092915050565b6000602082019050818103600083015261025181846101fe565b90509291505056fea2646970667358221220a8d9cb0429fef46fb1c7c9a58e4dfac76fe050709cf08e59aca68614cd6d6c9a64736f6c63430008110033","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x41 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x268774EE EQ PUSH2 0x46 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x64 JUMPI DUP1 PUSH4 0xEF5FB05B EQ PUSH2 0x82 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E PUSH2 0xA0 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5B SWAP2 SWAP1 PUSH2 0x130 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x6C PUSH2 0xB3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x79 SWAP2 SWAP1 PUSH2 0x18C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x8A PUSH2 0xD7 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x97 SWAP2 SWAP1 PUSH2 0x237 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH1 0x14 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x19 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x48656C6C6F20776F726C642066726F6D205665636861696E2100000000000000 DUP2 MSTORE POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0xFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x12A DUP2 PUSH2 0x114 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x145 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x121 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x176 DUP3 PUSH2 0x14B JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x186 DUP2 PUSH2 0x16B JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1A1 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x17D JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1E1 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x1C6 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x209 DUP3 PUSH2 0x1A7 JUMP JUMPDEST PUSH2 0x213 DUP2 DUP6 PUSH2 0x1B2 JUMP JUMPDEST SWAP4 POP PUSH2 0x223 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1C3 JUMP JUMPDEST PUSH2 0x22C DUP2 PUSH2 0x1ED JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x251 DUP2 DUP5 PUSH2 0x1FE JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xA8 0xD9 0xCB DIV 0x29 INVALID DELEGATECALL PUSH16 0xB1C7C9A58E4DFAC76FE050709CF08E59 0xAC 0xA6 DUP7 EQ 0xCD PUSH14 0x6C9A64736F6C6343000811003300 ","sourceMap":"109:447:1:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;199:28;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;165;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;439:115;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;199:28;;;;;;;;;;;;;:::o;165:::-;;;;;;;;;;;;:::o;439:115::-;480:13;512:35;;;;;;;;;;;;;;;;;505:42;;439:115;:::o;7:86:2:-;42:7;82:4;75:5;71:16;60:27;;7:86;;;:::o;99:112::-;182:22;198:5;182:22;:::i;:::-;177:3;170:35;99:112;;:::o;217:214::-;306:4;344:2;333:9;329:18;321:26;;357:67;421:1;410:9;406:17;397:6;357:67;:::i;:::-;217:214;;;;:::o;437:126::-;474:7;514:42;507:5;503:54;492:65;;437:126;;;:::o;569:104::-;614:7;643:24;661:5;643:24;:::i;:::-;632:35;;569:104;;;:::o;679:142::-;782:32;808:5;782:32;:::i;:::-;777:3;770:45;679:142;;:::o;827:254::-;936:4;974:2;963:9;959:18;951:26;;987:87;1071:1;1060:9;1056:17;1047:6;987:87;:::i;:::-;827:254;;;;:::o;1087:99::-;1139:6;1173:5;1167:12;1157:22;;1087:99;;;:::o;1192:169::-;1276:11;1310:6;1305:3;1298:19;1350:4;1345:3;1341:14;1326:29;;1192:169;;;;:::o;1367:246::-;1448:1;1458:113;1472:6;1469:1;1466:13;1458:113;;;1557:1;1552:3;1548:11;1542:18;1538:1;1533:3;1529:11;1522:39;1494:2;1491:1;1487:10;1482:15;;1458:113;;;1605:1;1596:6;1591:3;1587:16;1580:27;1429:184;1367:246;;;:::o;1619:102::-;1660:6;1711:2;1707:7;1702:2;1695:5;1691:14;1687:28;1677:38;;1619:102;;;:::o;1727:377::-;1815:3;1843:39;1876:5;1843:39;:::i;:::-;1898:71;1962:6;1957:3;1898:71;:::i;:::-;1891:78;;1978:65;2036:6;2031:3;2024:4;2017:5;2013:16;1978:65;:::i;:::-;2068:29;2090:6;2068:29;:::i;:::-;2063:3;2059:39;2052:46;;1819:285;1727:377;;;;:::o;2110:313::-;2223:4;2261:2;2250:9;2246:18;2238:26;;2310:9;2304:4;2300:20;2296:1;2285:9;2281:17;2274:47;2338:78;2411:4;2402:6;2338:78;:::i;:::-;2330:86;;2110:313;;;;:::o"},"methodIdentifiers":{"owner()":"8da5cb5b","sayHello()":"ef5fb05b","simpleParameter()":"268774ee"}},"metadata":"{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"_simpleParameter\",\"type\":\"uint8\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sayHello\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"simpleParameter\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"sayHello()\":{\"returns\":{\"_0\":\"The hello message\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"sayHello()\":{\"notice\":\"Say hello\"}},\"notice\":\"A simple contract that says hello\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/VechainHelloWorldWithNonEmptyConstructor.sol\":\"VechainHelloWorldWithNonEmptyConstructor\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/VechainHelloWorldWithNonEmptyConstructor.sol\":{\"keccak256\":\"0xe6c10f370a4abe57a0bbb1091145f418407017c6754fa9936e8b9888231fc769\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://59816bbb61de4e04ea9cd1a4b2106ccbec223e6d29e52771e65f3878105ad3cf\",\"dweb:/ipfs/QmbqvxRD6fDsbyo3p2nsYLzZiMoYCuZGmhYViT4LNwmDdX\"]}},\"version\":1}"}}}}} \ No newline at end of file diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorld.sol/VechainHelloWorld.dbg.json b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorld.sol/VechainHelloWorld.dbg.json deleted file mode 100644 index 6bec3ce84..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorld.sol/VechainHelloWorld.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/f80ce3c255b9cd7b327e989536eb216e.json" -} diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorld.sol/VechainHelloWorld.json b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorld.sol/VechainHelloWorld.json deleted file mode 100644 index d75a3cff3..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorld.sol/VechainHelloWorld.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "VechainHelloWorld", - "sourceName": "contracts/VechainHelloWorld.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "payable", - "type": "constructor" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "sayHello", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - } - ], - "bytecode": "0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061021c806100536000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b1461003b578063ef5fb05b14610059575b600080fd5b610043610077565b6040516100509190610119565b60405180910390f35b61006161009b565b60405161006e91906101c4565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610103826100d8565b9050919050565b610113816100f8565b82525050565b600060208201905061012e600083018461010a565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561016e578082015181840152602081019050610153565b60008484015250505050565b6000601f19601f8301169050919050565b600061019682610134565b6101a0818561013f565b93506101b0818560208601610150565b6101b98161017a565b840191505092915050565b600060208201905081810360008301526101de818461018b565b90509291505056fea2646970667358221220dca2dbc224eb0de22970d7aa13035d31ed65236b97fb9bde63a13d01d13ec72f64736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b1461003b578063ef5fb05b14610059575b600080fd5b610043610077565b6040516100509190610119565b60405180910390f35b61006161009b565b60405161006e91906101c4565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610103826100d8565b9050919050565b610113816100f8565b82525050565b600060208201905061012e600083018461010a565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561016e578082015181840152602081019050610153565b60008484015250505050565b6000601f19601f8301169050919050565b600061019682610134565b6101a0818561013f565b93506101b0818560208601610150565b6101b98161017a565b840191505092915050565b600060208201905081810360008301526101de818461018b565b90509291505056fea2646970667358221220dca2dbc224eb0de22970d7aa13035d31ed65236b97fb9bde63a13d01d13ec72f64736f6c63430008110033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorldWithNonEmptyConstructor.sol/VechainHelloWorldWithNonEmptyConstructor.dbg.json b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorldWithNonEmptyConstructor.sol/VechainHelloWorldWithNonEmptyConstructor.dbg.json deleted file mode 100644 index 6bec3ce84..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorldWithNonEmptyConstructor.sol/VechainHelloWorldWithNonEmptyConstructor.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/f80ce3c255b9cd7b327e989536eb216e.json" -} diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorldWithNonEmptyConstructor.sol/VechainHelloWorldWithNonEmptyConstructor.json b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorldWithNonEmptyConstructor.sol/VechainHelloWorldWithNonEmptyConstructor.json deleted file mode 100644 index 48fa0b46f..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/artifacts/contracts/VechainHelloWorldWithNonEmptyConstructor.sol/VechainHelloWorldWithNonEmptyConstructor.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "VechainHelloWorldWithNonEmptyConstructor", - "sourceName": "contracts/VechainHelloWorldWithNonEmptyConstructor.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "uint8", - "name": "_simpleParameter", - "type": "uint8" - } - ], - "stateMutability": "payable", - "type": "constructor" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "sayHello", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "simpleParameter", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x608060405260405161038f38038061038f833981810160405281019061002591906100c4565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600060146101000a81548160ff021916908360ff160217905550506100f1565b600080fd5b600060ff82169050919050565b6100a18161008b565b81146100ac57600080fd5b50565b6000815190506100be81610098565b92915050565b6000602082840312156100da576100d9610086565b5b60006100e8848285016100af565b91505092915050565b61028f806101006000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063268774ee146100465780638da5cb5b14610064578063ef5fb05b14610082575b600080fd5b61004e6100a0565b60405161005b9190610130565b60405180910390f35b61006c6100b3565b604051610079919061018c565b60405180910390f35b61008a6100d7565b6040516100979190610237565b60405180910390f35b600060149054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600060ff82169050919050565b61012a81610114565b82525050565b60006020820190506101456000830184610121565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101768261014b565b9050919050565b6101868161016b565b82525050565b60006020820190506101a1600083018461017d565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156101e15780820151818401526020810190506101c6565b60008484015250505050565b6000601f19601f8301169050919050565b6000610209826101a7565b61021381856101b2565b93506102238185602086016101c3565b61022c816101ed565b840191505092915050565b6000602082019050818103600083015261025181846101fe565b90509291505056fea2646970667358221220a8d9cb0429fef46fb1c7c9a58e4dfac76fe050709cf08e59aca68614cd6d6c9a64736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063268774ee146100465780638da5cb5b14610064578063ef5fb05b14610082575b600080fd5b61004e6100a0565b60405161005b9190610130565b60405180910390f35b61006c6100b3565b604051610079919061018c565b60405180910390f35b61008a6100d7565b6040516100979190610237565b60405180910390f35b600060149054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600060ff82169050919050565b61012a81610114565b82525050565b60006020820190506101456000830184610121565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101768261014b565b9050919050565b6101868161016b565b82525050565b60006020820190506101a1600083018461017d565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156101e15780820151818401526020810190506101c6565b60008484015250505050565b6000601f19601f8301169050919050565b6000610209826101a7565b61021381856101b2565b93506102238185602086016101c3565b61022c816101ed565b840191505092915050565b6000602082019050818103600083015261025181846101fe565b90509291505056fea2646970667358221220a8d9cb0429fef46fb1c7c9a58e4dfac76fe050709cf08e59aca68614cd6d6c9a64736f6c63430008110033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/VechainHelloWorld.sol b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/VechainHelloWorld.sol deleted file mode 100644 index 886a4ed9f..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/VechainHelloWorld.sol +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.17; - -/** - * A simple contract that says hello - */ -contract VechainHelloWorld { - address payable public owner; - - constructor() payable { - owner = payable(msg.sender); - } - - /** - * Say hello - - * @return The hello message - */ - function sayHello() public pure returns (string memory) { - return string("Hello world from Vechain!"); - } -} diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/VechainHelloWorldWithNonEmptyConstructor.sol b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/VechainHelloWorldWithNonEmptyConstructor.sol deleted file mode 100644 index 00d9ab70e..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/VechainHelloWorldWithNonEmptyConstructor.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.17; - -/** - * A simple contract that says hello - */ -contract VechainHelloWorldWithNonEmptyConstructor { - address payable public owner; - uint8 public simpleParameter; - - constructor(uint8 _simpleParameter) payable { - owner = payable(msg.sender); - simpleParameter = _simpleParameter; - } - - /** - * Say hello - - * @return The hello message - */ - function sayHello() public pure returns (string memory) { - return string("Hello world from Vechain!"); - } -} diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/erc20Contract.sol b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/erc20Contract.sol deleted file mode 100644 index 568713f71..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/erc20Contract.sol +++ /dev/null @@ -1,11 +0,0 @@ -// contracts/GLDToken.sol -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; - -contract GLDToken is ERC20 { - constructor(uint256 initialSupply) ERC20("Gold", "GLD") { - _mint(msg.sender, initialSupply); - } -} \ No newline at end of file diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/erc721Contract.sol b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/erc721Contract.sol deleted file mode 100644 index a70262f9b..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/contracts/erc721Contract.sol +++ /dev/null @@ -1,24 +0,0 @@ -// contracts/GameItem.sol -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import {ERC721URIStorage} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; -import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; - - -contract GameItem is ERC721URIStorage { - uint256 private _nextTokenId; - - constructor() ERC721("GameItem", "ITM") {} - - function awardItem(address player, string memory tokenURI) - public - returns (uint256) - { - uint256 tokenId = _nextTokenId++; - _mint(player, tokenId); - _setTokenURI(tokenId, tokenURI); - - return tokenId; - } -} \ No newline at end of file diff --git a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/hardhat.config.ts b/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/hardhat.config.ts deleted file mode 100644 index e5aca1afb..000000000 --- a/packages/hardhat-plugin/tests/hardhat-mock-projects/simple-vechain-hardhat-project/hardhat.config.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Simple hardhat configuration for testing with a VeChain network defined - */ - -// We load the plugin here. -import { type HardhatUserConfig, type HttpNetworkConfig } from 'hardhat/types'; - -import '../../../src/index'; -import { HDKey } from '@vechain/sdk-core'; - -/** - * Simple configuration for testing - */ -const vechainTestNetwork: HttpNetworkConfig = { - // Default network parameters - url: 'https://testnet.vechain.org', - timeout: 20000, - httpHeaders: {}, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: HDKey.VET_DERIVATION_PATH, - count: 3, - initialIndex: 0, - passphrase: 'VeChainThor' - }, - - // Custom parameters - delegator: { - delegatorPrivateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - }, - debug: true, - enableDelegation: true -}; - -/** - * Thor solo network configuration - */ -const vechainSoloNetwork = { - // Thor solo network - url: 'http://localhost:8669', - accounts: [ - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], - debug: false, - delegator: undefined, - enableDelegation: false, - gas: 'auto', - gasPrice: 'auto', - gasMultiplier: 1, - timeout: 20000, - httpHeaders: {} -} satisfies HttpNetworkConfig; - -/** - * Hardhat configuration - */ -const config: HardhatUserConfig = { - solidity: '0.8.17', - networks: { - vechain_solo: vechainSoloNetwork, - vechain_testnet: vechainTestNetwork - }, - - /** - * @note: here we set vechain_testnet as the default network to simulate a command like this: - * - * ```sh - * npx hardhat --network vechain_testnet - * ``` - */ - defaultNetwork: 'vechain_solo' -}; - -export default config; diff --git a/packages/hardhat-plugin/tests/helpers/fixture.ts b/packages/hardhat-plugin/tests/helpers/fixture.ts deleted file mode 100644 index fbfb741d7..000000000 --- a/packages/hardhat-plugin/tests/helpers/fixture.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { HDKey } from '@vechain/sdk-core'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * Positive test cases for createWalletFromHardhatNetworkConfig function - */ -const createWalletFromHardhatNetworkConfigPositiveCasesFixture = [ - { - test: 'Should return an empty wallet', - networkConfig: { - url: 'https://testnet.vechain.org', - chainId: 74 - }, - expectedAddresses: [] - }, - { - test: 'Should return a wallet from an Array of private keys - no delegator', - networkConfig: { - url: 'https://testnet.vechain.org', - chainId: 74, - accounts: [ - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa157' - ] - }, - expectedAddresses: [ - '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - '0x768Ca51b9C9C2b520c845EBea9DDfaA54513b595' - ] - }, - { - test: 'Should return a wallet from an Array of private keys - with delegator', - networkConfig: { - url: 'https://testnet.vechain.org', - chainId: 74, - accounts: [ - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa157' - ], - delegator: { - delegatorPrivateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5', - delegatorUrl: 'https://sponsor-testnet.vechain.energy/by/269' - } - }, - expectedAddresses: [ - '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - '0x768Ca51b9C9C2b520c845EBea9DDfaA54513b595' - ] - }, - { - test: 'Should return a wallet from an Array of private keys (with 0x prefix) - no delegator', - networkConfig: { - url: 'https://testnet.vechain.org', - chainId: 74, - accounts: [ - '0x7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - '0x7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa157' - ] - }, - expectedAddresses: [ - '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - '0x768Ca51b9C9C2b520c845EBea9DDfaA54513b595' - ] - }, - { - test: 'Should return a wallet from an Array of private keys (with 0x prefix) - with delegator', - networkConfig: { - url: 'https://testnet.vechain.org', - chainId: 74, - accounts: [ - '0x7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - '0x7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa157' - ], - delegator: { - delegatorPrivateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5', - delegatorUrl: 'https://sponsor-testnet.vechain.energy/by/269' - } - }, - expectedAddresses: [ - '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - '0x768Ca51b9C9C2b520c845EBea9DDfaA54513b595' - ] - }, - { - test: 'Should return a wallet from an HDNode wallet - no delegator', - networkConfig: { - url: 'https://testnet.vechain.org', - chainId: 74, - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: HDKey.VET_DERIVATION_PATH, - count: 2, - initialIndex: 0 - } - }, - expectedAddresses: [ - '0x783DE01F06b4F2a068A7b3Bb6ff3db821A08f8c1', - '0x2406180BCa83983d40191Febc6d939C62152B71b' - ] - }, - { - test: 'Should return a wallet from an HDNode wallet - with delegator', - networkConfig: { - url: 'https://testnet.vechain.org', - chainId: 74, - accounts: { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: HDKey.VET_DERIVATION_PATH, - count: 2, - initialIndex: 0 - }, - delegator: { - delegatorPrivateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5', - delegatorUrl: 'https://sponsor-testnet.vechain.energy/by/269' - } - }, - expectedAddresses: [ - '0x783DE01F06b4F2a068A7b3Bb6ff3db821A08f8c1', - '0x2406180BCa83983d40191Febc6d939C62152B71b' - ] - } -]; - -/** - * Negative test cases for createWalletFromHardhatNetworkConfig function - */ -const createWalletFromHardhatNetworkConfigNegativeCasesFixture = [ - { - test: 'Should throw an error when the accounts are remote', - networkConfig: { - url: 'https://testnet.vechain.org', - chainId: 74, - accounts: 'remote' - }, - expectedError: JSONRPCInternalError - } -]; - -export { - createWalletFromHardhatNetworkConfigNegativeCasesFixture, - createWalletFromHardhatNetworkConfigPositiveCasesFixture -}; diff --git a/packages/hardhat-plugin/tests/helpers/provider-helpers.unit.test.ts b/packages/hardhat-plugin/tests/helpers/provider-helpers.unit.test.ts deleted file mode 100644 index 146cdbf2a..000000000 --- a/packages/hardhat-plugin/tests/helpers/provider-helpers.unit.test.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { - createWalletFromHardhatNetworkConfigNegativeCasesFixture, - createWalletFromHardhatNetworkConfigPositiveCasesFixture -} from './fixture'; - -import { type HttpNetworkConfig } from 'hardhat/types'; -import { createWalletFromHardhatNetworkConfig } from '../../src/helpers'; - -/** - * Provider hardhat helpers test suite - * - * @group unit/hardhat-helpers - */ -describe('Provider Hardhat Helpers', () => { - /** - * Test suite for createWalletFromHardhatNetworkConfig - */ - describe('createWalletFromHardhatNetworkConfig', () => { - /** - * Positive test cases for createWalletFromHardhatNetworkConfig function - */ - createWalletFromHardhatNetworkConfigPositiveCasesFixture.forEach( - (fixture) => { - test(fixture.test, async () => { - const wallet = createWalletFromHardhatNetworkConfig( - fixture.networkConfig as HttpNetworkConfig - ); - const addresses = await wallet.getAddresses(); - const delegator = await wallet.getDelegator(); - - expect(addresses).toEqual(fixture.expectedAddresses); - expect(delegator).toEqual( - fixture.networkConfig.delegator ?? null - ); - }); - } - ); - }); - - /** - * Negative test cases for createWalletFromHardhatNetworkConfig function - */ - createWalletFromHardhatNetworkConfigNegativeCasesFixture.forEach( - (fixture) => { - test(fixture.test, () => { - expect(() => - createWalletFromHardhatNetworkConfig( - fixture.networkConfig as HttpNetworkConfig - ) - ).toThrowError(fixture.expectedError); - }); - } - ); -}); diff --git a/packages/hardhat-plugin/tests/no-vechain-network-defined-project.unit.test.ts b/packages/hardhat-plugin/tests/no-vechain-network-defined-project.unit.test.ts deleted file mode 100644 index d2e8a15b3..000000000 --- a/packages/hardhat-plugin/tests/no-vechain-network-defined-project.unit.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; - -import { resetHardhatContext } from 'hardhat/plugins-testing'; -import { type HardhatRuntimeEnvironment } from 'hardhat/types'; -import { setHardhatContext } from './test-utils'; - -/** - * Simple hardhat project withoutVeChain network configuration defined - * - * @group unit/no-vechain-network-defined-project - */ -describe('Custom network configuration hardhat withoutVeChain network defined', () => { - /** - * Init hardhat runtime environment - */ - let hre: HardhatRuntimeEnvironment; - - beforeEach(async function () { - // Set hardhat context - setHardhatContext('no-vechain-network-defined-project'); - - // Load hardhat environment - hre = await import('hardhat'); - }); - - afterEach(function () { - resetHardhatContext(); - }); - - /** - * Test suite for createWalletFromHardhatNetworkConfig - */ - describe('Custom network configuration hardhat', () => { - /** - * Positive test cases for createWalletFromHardhatNetworkConfig function - */ - test('Should be able to get custom configuration from a project', () => { - // Default network (hardhat) should be undefined - expect(hre.config.networks.hardhat).toBeDefined(); - }); - }); -}); diff --git a/packages/hardhat-plugin/tests/simple-vechain-hardhat-project.solo.test.ts b/packages/hardhat-plugin/tests/simple-vechain-hardhat-project.solo.test.ts deleted file mode 100644 index f45847941..000000000 --- a/packages/hardhat-plugin/tests/simple-vechain-hardhat-project.solo.test.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; - -import { HardhatPluginError } from 'hardhat/plugins'; -import { resetHardhatContext } from 'hardhat/plugins-testing'; -import { - type HardhatRuntimeEnvironment, - type HttpNetworkConfig -} from 'hardhat/types'; -import { setHardhatContext } from './test-utils'; - -/** - * Tests for hardhat plugin with custom network configuration. - * - * @NOTE: This test suite runs on the solo network because it requires sending transactions. - * - * @group integration/hardhat-plugin - */ -describe('Custom network configuration hardhat - testnet', () => { - /** - * Init hardhat runtime environment - */ - let hre: HardhatRuntimeEnvironment; - - beforeEach(async function () { - // Set hardhat context - setHardhatContext('simple-vechain-hardhat-project'); - - // Load hardhat environment - hre = await import('hardhat'); - }); - - afterEach(function () { - resetHardhatContext(); - }); - - /** - * Test suite for createWalletFromHardhatNetworkConfig - */ - describe('Custom network configuration hardhat', () => { - /** - * Positive test cases for createWalletFromHardhatNetworkConfig function - */ - test('Should be able to get custom configuration from a project', () => { - expect(hre.config.networks.vechain_testnet).toBeDefined(); - expect( - (hre.config.networks.vechain_testnet as HttpNetworkConfig) - .delegator - ).toBeDefined(); - expect( - (hre.config.networks.vechain_testnet as HttpNetworkConfig).debug - ).toBeDefined(); - expect(hre.VeChainProvider).toBeDefined(); - expect(hre.VeChainProvider?.send('eth_accounts', [])).toBeDefined(); - }); - }); - - /** - * Negative test cases for the provider. It must throw an error - */ - describe('Custom network configuration hardhat', () => { - /** - * Negative test cases for the provider. It must throw an error - */ - test('Should throw an error when a send call goes wrong', async () => { - await expect( - hre.VeChainProvider?.send('WRONG_ENDPOINT', []) - ).rejects.toThrowError(HardhatPluginError); - }); - }); - - describe('Invoke hardhat functions', () => { - /** - * Test suite for getSigner - */ - test('Get signer', async () => { - const signer = (await hre.ethers.getSigners())[0]; - expect(signer).toBeDefined(); - - const impersonatedSigner = await hre.ethers.getSigner( - '0x3db469a79593dcc67f07DE1869d6682fC1eaf535' - ); - - expect(impersonatedSigner).toBeDefined(); - }, 10000); - - /** - * Test suite for getImpersonatedSigner - */ - test('Get impersonated signer', async () => { - const signer = (await hre.ethers.getSigners())[0]; - expect(signer).toBeDefined(); - - await expect( - async () => - await hre.ethers.getImpersonatedSigner( - '0x3db469a79593dcc67f07DE1869d6682fC1eaf535' - ) - ).rejects.toThrowError(); - }, 10000); - - /** - * Test suite for the deployment of the hello world contract - */ - test('Should deploy the hello world contract', async () => { - const signer = (await hre.ethers.getSigners())[0]; - - const helloWorldContract = await hre.ethers.deployContract( - 'VechainHelloWorld', - signer - ); - - expect(helloWorldContract).toBeDefined(); - - expect(await helloWorldContract.sayHello()).toBe( - 'Hello world from Vechain!' - ); - }, 10000); - - /** - * Test suite for invoking the hello world contract - */ - test('Should invoke the hello world contract', async () => { - const signer = (await hre.ethers.getSigners())[0]; - - const helloWorldContract = await ( - await hre.ethers.getContractFactory('VechainHelloWorld', signer) - ).deploy(); - - expect(helloWorldContract).toBeDefined(); - - expect(await helloWorldContract.sayHello()).toBe( - 'Hello world from Vechain!' - ); - }, 10000); - - /** - * Test suite for getContractFactoryFromArtifact - */ - test('Should invoke the hello world contract using getContractFactoryFromArtifact', async () => { - const signer = (await hre.ethers.getSigners())[0]; - - const helloWorldContractArtifact = - await hre.artifacts.readArtifact('VechainHelloWorld'); - - const helloWorldContract = await ( - await hre.ethers.getContractFactoryFromArtifact( - helloWorldContractArtifact, - signer - ) - ).deploy(); - - expect(helloWorldContract).toBeDefined(); - - expect(await helloWorldContract.sayHello()).toBe( - 'Hello world from Vechain!' - ); - }, 10000); - }); -}); diff --git a/packages/hardhat-plugin/tests/test-utils.ts b/packages/hardhat-plugin/tests/test-utils.ts deleted file mode 100644 index 7f84f8273..000000000 --- a/packages/hardhat-plugin/tests/test-utils.ts +++ /dev/null @@ -1,18 +0,0 @@ -import path from 'path'; - -/** - * Set hardhat context function. - * - * This function is used to set the hardhat context for the tests. - * Basically, every test will be an isolated hardhat environment (a hardhat project). - * - * @param hardhatProjectName - The name of the hardhat project to set the context - */ -const setHardhatContext = (hardhatProjectName: string): void => { - // Init node environment directory - process.chdir( - path.join(__dirname, 'hardhat-mock-projects', hardhatProjectName) - ); -}; - -export { setHardhatContext }; diff --git a/packages/hardhat-plugin/tsconfig.json b/packages/hardhat-plugin/tsconfig.json deleted file mode 100644 index b523f6a50..000000000 --- a/packages/hardhat-plugin/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - }, - "include": [ - "./src/**/*.ts", - "./tests/**/*.ts" - ] -} \ No newline at end of file diff --git a/packages/hardhat-plugin/typedoc.json b/packages/hardhat-plugin/typedoc.json deleted file mode 100644 index b16806beb..000000000 --- a/packages/hardhat-plugin/typedoc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": ["../../typedoc.base.json"], - "entryPoints": ["src/index.ts"] -} \ No newline at end of file diff --git a/packages/logging/eslint.config.mjs b/packages/logging/eslint.config.mjs index d555f2cae..740a9c8c1 100644 --- a/packages/logging/eslint.config.mjs +++ b/packages/logging/eslint.config.mjs @@ -11,8 +11,6 @@ export default [ from: [ "../core", "../errors", - "../ethers-adapter", - "../hardhat-plugin", "../network", "../rpc-proxy", ], diff --git a/packages/network/eslint.config.mjs b/packages/network/eslint.config.mjs index 491344dfd..36764d2cc 100644 --- a/packages/network/eslint.config.mjs +++ b/packages/network/eslint.config.mjs @@ -11,8 +11,6 @@ export default [ from: [ "../core", "../errors", - "../ethers-adapter", - "../hardhat-plugin", "../logging", "../rpc-proxy", ], diff --git a/packages/rpc-proxy/eslint.config.mjs b/packages/rpc-proxy/eslint.config.mjs index 612021f33..02fff951e 100644 --- a/packages/rpc-proxy/eslint.config.mjs +++ b/packages/rpc-proxy/eslint.config.mjs @@ -11,8 +11,6 @@ export default [ from: [ "../core", "../errors", - "../ethers-adapter", - "../hardhat-plugin", "../logging", "../network", ], diff --git a/yarn.lock b/yarn.lock index 382ec1cb3..c0943f300 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2355,14 +2355,6 @@ "@nomicfoundation/ethereumjs-rlp" "5.0.4" ethereum-cryptography "0.1.3" -"@nomicfoundation/hardhat-ethers@^3.0.8": - version "3.0.8" - resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.8.tgz#af078f566373abeb77e11cbe69fe3dd47f8bfc27" - integrity sha512-zhOZ4hdRORls31DTOqg+GmEZM0ujly8GGIuRY7t7szEk2zW/arY1qDug/py8AEktT00v5K+b6RvbVog+va51IA== - dependencies: - debug "^4.1.1" - lodash.isequal "^4.5.0" - "@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2": version "0.1.2" resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.2.tgz#3a9c3b20d51360b20affb8f753e756d553d49557" @@ -7528,11 +7520,6 @@ lodash.flattendeep@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" integrity sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ== -lodash.isequal@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" - integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== - lodash.isplainobject@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" From 58a0fb2fb9e05ce205651e785ffa3f226cad3118 Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 16:23:56 +0000 Subject: [PATCH 10/15] chore: 1886 module removed --- .changeset/funny-masks-cheat.md | 1 - .changeset/pre.json | 3 +- .github/workflows/on-pr.yml | 4 - .github/workflows/on-tag.yml | 3 - .github/workflows/rpc-proxy-docker.yml | 79 -- .github/workflows/rpc-proxy-test.yml | 49 - .github/workflows/rpc-proxy.yml | 15 - docker-compose.rpc-proxy.yml | 179 ---- package.json | 1 - packages/core/eslint.config.mjs | 3 +- packages/errors/eslint.config.mjs | 3 +- packages/errors/src/available-errors/index.ts | 1 - .../src/available-errors/rpc-proxy/index.ts | 1 - .../available-errors/rpc-proxy/rpc-proxy.ts | 40 - .../available-errors/rpc-proxy.unit.test.ts | 68 -- packages/logging/eslint.config.mjs | 3 +- packages/network/eslint.config.mjs | 3 +- packages/rpc-proxy/README.md | 262 ----- packages/rpc-proxy/default-proxy-config.json | 10 - packages/rpc-proxy/eslint.config.mjs | 22 - packages/rpc-proxy/jest.config.browser.js | 9 - packages/rpc-proxy/jest.config.js | 18 - packages/rpc-proxy/package.json | 57 -- packages/rpc-proxy/solo-config.json | 10 - packages/rpc-proxy/src/index.ts | 165 --- packages/rpc-proxy/src/types.d.ts | 54 - .../args-validator-and-getter.ts | 197 ---- .../utils/args-validator/args-validator.ts | 306 ------ .../src/utils/args-validator/index.ts | 2 - .../rpc-proxy/src/utils/args/args-options.ts | 111 -- .../rpc-proxy/src/utils/args/args-parser.ts | 102 -- .../rpc-proxy/src/utils/args/env-to-args.ts | 69 -- packages/rpc-proxy/src/utils/args/index.ts | 3 - .../config-validator/config-validator.ts | 257 ----- .../src/utils/config-validator/index.ts | 1 - packages/rpc-proxy/src/utils/index.ts | 4 - .../rpc-proxy/src/utils/validators/index.ts | 1 - .../src/utils/validators/validators.ts | 117 --- ...-config-accounts-list-of-private-keys.json | 9 - ...orrect-proxy-config-accounts-mnemonic.json | 10 - ...ct-proxy-config-delegator-private-key.json | 13 - .../correct-proxy-config-delegator-url.json | 13 - ...s-list-of-private-keys-proxy-config-1.json | 8 - ...s-list-of-private-keys-proxy-config-2.json | 8 - ...lid-accounts-mnemonics-proxy-config-1.json | 10 - ...lid-accounts-mnemonics-proxy-config-2.json | 10 - ...lid-accounts-mnemonics-proxy-config-3.json | 10 - ...lid-accounts-mnemonics-proxy-config-4.json | 10 - ...lid-accounts-mnemonics-proxy-config-5.json | 10 - .../invalid-delegator-proxy-config-1.json | 13 - .../invalid-delegator-proxy-config-2.json | 13 - .../invalid-delegator-proxy-config-3.json | 14 - ...alid-enable-delegation-proxy-config-1.json | 10 - .../invalid-json-format-proxy-config | 8 - ...lid-port-proxy-config-negative-number.json | 10 - ...invalid-port-proxy-config-non-integer.json | 10 - .../invalid-semantic-proxy-config-1.json | 9 - .../invalid-url-proxy-config.json | 10 - .../invalid-verbose-flag-proxy-config-1.json | 11 - .../tests/e2e_rpc_proxy.solo.test.ts | 952 ------------------ packages/rpc-proxy/tests/fixture.ts | 124 --- .../utils/args/args-options.unit.test.ts | 220 ---- .../tests/utils/args/args-parser.unit.test.ts | 669 ------------ .../env-to-args-negative-cases.unit.test.ts | 22 - .../env-to-args-positive-cases.unit.test.ts | 64 -- .../config-validator.unit.test.ts | 171 ---- packages/rpc-proxy/tsconfig.json | 18 - 67 files changed, 5 insertions(+), 4687 deletions(-) delete mode 100644 .github/workflows/rpc-proxy-docker.yml delete mode 100644 .github/workflows/rpc-proxy-test.yml delete mode 100644 .github/workflows/rpc-proxy.yml delete mode 100644 docker-compose.rpc-proxy.yml delete mode 100644 packages/errors/src/available-errors/rpc-proxy/index.ts delete mode 100644 packages/errors/src/available-errors/rpc-proxy/rpc-proxy.ts delete mode 100644 packages/errors/tests/available-errors/rpc-proxy.unit.test.ts delete mode 100644 packages/rpc-proxy/README.md delete mode 100644 packages/rpc-proxy/default-proxy-config.json delete mode 100644 packages/rpc-proxy/eslint.config.mjs delete mode 100644 packages/rpc-proxy/jest.config.browser.js delete mode 100644 packages/rpc-proxy/jest.config.js delete mode 100644 packages/rpc-proxy/package.json delete mode 100644 packages/rpc-proxy/solo-config.json delete mode 100644 packages/rpc-proxy/src/index.ts delete mode 100644 packages/rpc-proxy/src/types.d.ts delete mode 100644 packages/rpc-proxy/src/utils/args-validator/args-validator-and-getter.ts delete mode 100644 packages/rpc-proxy/src/utils/args-validator/args-validator.ts delete mode 100644 packages/rpc-proxy/src/utils/args-validator/index.ts delete mode 100644 packages/rpc-proxy/src/utils/args/args-options.ts delete mode 100644 packages/rpc-proxy/src/utils/args/args-parser.ts delete mode 100644 packages/rpc-proxy/src/utils/args/env-to-args.ts delete mode 100644 packages/rpc-proxy/src/utils/args/index.ts delete mode 100644 packages/rpc-proxy/src/utils/config-validator/config-validator.ts delete mode 100644 packages/rpc-proxy/src/utils/config-validator/index.ts delete mode 100644 packages/rpc-proxy/src/utils/index.ts delete mode 100644 packages/rpc-proxy/src/utils/validators/index.ts delete mode 100644 packages/rpc-proxy/src/utils/validators/validators.ts delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-list-of-private-keys.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-mnemonic.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-delegator-private-key.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-delegator-url.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-list-of-private-keys-proxy-config-1.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-list-of-private-keys-proxy-config-2.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-1.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-2.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-3.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-4.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-5.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-1.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-2.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-3.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-enable-delegation-proxy-config-1.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-json-format-proxy-config delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-port-proxy-config-negative-number.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-port-proxy-config-non-integer.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-semantic-proxy-config-1.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-url-proxy-config.json delete mode 100644 packages/rpc-proxy/tests/config-files-fixtures/invalid-verbose-flag-proxy-config-1.json delete mode 100644 packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts delete mode 100644 packages/rpc-proxy/tests/fixture.ts delete mode 100644 packages/rpc-proxy/tests/utils/args/args-options.unit.test.ts delete mode 100644 packages/rpc-proxy/tests/utils/args/args-parser.unit.test.ts delete mode 100644 packages/rpc-proxy/tests/utils/args/env-to-args-negative-cases.unit.test.ts delete mode 100644 packages/rpc-proxy/tests/utils/args/env-to-args-positive-cases.unit.test.ts delete mode 100644 packages/rpc-proxy/tests/utils/config-validator/config-validator.unit.test.ts delete mode 100644 packages/rpc-proxy/tsconfig.json diff --git a/.changeset/funny-masks-cheat.md b/.changeset/funny-masks-cheat.md index 68b0ea6c7..afac35390 100644 --- a/.changeset/funny-masks-cheat.md +++ b/.changeset/funny-masks-cheat.md @@ -3,7 +3,6 @@ "@vechain/sdk-errors": patch "@vechain/sdk-logging": patch "@vechain/sdk-network": patch -"@vechain/sdk-rpc-proxy": patch --- First BETA release of the VeChain SDK! :D diff --git a/.changeset/pre.json b/.changeset/pre.json index d5735925d..19f714c0c 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -5,8 +5,7 @@ "@vechain/sdk-core": "1.0.0", "@vechain/sdk-errors": "1.0.0", "@vechain/sdk-logging": "1.0.0", - "@vechain/sdk-network": "1.0.0", - "@vechain/sdk-rpc-proxy": "1.0.0" + "@vechain/sdk-network": "1.0.0" }, "changesets": [] } diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 33e08407e..b2e15e7ad 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -33,10 +33,6 @@ jobs: id: stop-solo run: yarn stop-thor-solo - rpc-proxy: - uses: ./.github/workflows/rpc-proxy.yml - secrets: inherit - install-build: uses: ./.github/workflows/build-lint.yml secrets: inherit diff --git a/.github/workflows/on-tag.yml b/.github/workflows/on-tag.yml index 855bc8983..7bc02cba8 100644 --- a/.github/workflows/on-tag.yml +++ b/.github/workflows/on-tag.yml @@ -10,6 +10,3 @@ jobs: uses: ./.github/workflows/publish-sdk.yml secrets: inherit - rpc-proxy-docker-publish: - uses: ./.github/workflows/rpc-proxy.yml - secrets: inherit diff --git a/.github/workflows/rpc-proxy-docker.yml b/.github/workflows/rpc-proxy-docker.yml deleted file mode 100644 index 9f4b80c88..000000000 --- a/.github/workflows/rpc-proxy-docker.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: RPC Proxy - Docker build, scan and push - -on: - workflow_call: - -permissions: - contents: read - packages: write - checks: write - actions: read - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up QEMU - if: ${{ github.event_name != 'pull_request' }} - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - if: ${{ github.event_name != 'pull_request' }} - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - if: ${{ github.event_name != 'pull_request' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: vechain/sdk-rpc-proxy - - - name: Build and export to Docker - uses: docker/build-push-action@v6 - with: - context: . - file: docker/rpc-proxy/Dockerfile - load: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Create .trivyignore file - # "cross-spawn" is resolved as version 7.0.5 but Trivy keeps showing the error - run: echo "CVE-2024-21538" > .trivyignore - - - name: Run Trivy Scan - uses: aquasecurity/trivy-action@master - with: - image-ref: ${{ fromJSON(steps.meta.outputs.json).tags[0] }} - format: 'table' - ignore-unfixed: true - exit-code: '1' - vuln-type: os,library - severity: CRITICAL,HIGH,MEDIUM - scanners: misconfig,vuln,secret - trivyignores: .trivyignore - env: - # See https://github.com/aquasecurity/trivy/discussions/7538 - TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2 - - - name: Build and push - if: ${{ github.event_name != 'pull_request' }} - uses: docker/build-push-action@v6 - with: - context: . - file: docker/rpc-proxy/Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - sbom: true - provenance: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/rpc-proxy-test.yml b/.github/workflows/rpc-proxy-test.yml deleted file mode 100644 index c03f2e9a8..000000000 --- a/.github/workflows/rpc-proxy-test.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: RPC Proxy - Test - -on: - workflow_call: - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: lts/* - - - name: Install & Patch packages - run: yarn install - - - name: Build - run: yarn build - - - name: Run E2E RPC Proxy tests - run: | - yarn workspace @vechain/sdk-rpc-proxy test:e2e - - - name: Start Thor solo node - id: start-solo - run: yarn start-thor-solo - - - name: Start RPC Proxy - run: | - yarn workspace @vechain/sdk-rpc-proxy start & disown - - - name: Run RPC Proxy tests - run: | - yarn test-rpc-proxy - exit_code=$? - if [ $exit_code -eq 0 ]; then - echo "RPC Proxy tests passed successfully." - else - echo "RPC Proxy tests failed." - exit 1 - fi - - - name: Stop Thor solo node - id: stop-solo - run: yarn stop-thor-solo \ No newline at end of file diff --git a/.github/workflows/rpc-proxy.yml b/.github/workflows/rpc-proxy.yml deleted file mode 100644 index 53860626a..000000000 --- a/.github/workflows/rpc-proxy.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: RPC Proxy - -on: - workflow_call: - -jobs: - test: - if: github.ref != 'refs/tags/*' - uses: ./.github/workflows/rpc-proxy-test.yml - secrets: inherit - - docker: - uses: ./.github/workflows/rpc-proxy-docker.yml - secrets: inherit - diff --git a/docker-compose.rpc-proxy.yml b/docker-compose.rpc-proxy.yml deleted file mode 100644 index 799d3c0cf..000000000 --- a/docker-compose.rpc-proxy.yml +++ /dev/null @@ -1,179 +0,0 @@ -#services: -# -# ... -# -# rpc-proxy: -# build: -# context: . -# dockerfile: docker/rpc-proxy/Dockerfile -# -# # ********* SET HERE THE REQUIRED ENVIRONMENT VARIABLES ********* -# environment: -# - URL= ... the url of the node ... -# - PORT={CONTAINER_PORT} ... the port of the node ... -# - ACCOUNTS=... the accounts as a list of private keys ... (a space-separated list of private keys) -# - MNEMONIC=... the mnemonic of the accounts ... (a space-separated list of mnemonics) -# - MNEMONIC_COUNT=... the number of accounts to generate ... -# - MNEMONIC_INITIAL_INDEX=... the initial index of the mnemonic ... -# - ENABLE_DELEGATION=... true or false ... (if true, the delegation will be enabled) -# - DELEGATOR_PRIVATE_KEY=... the private key of the delegator ... (without 0x) -# - DELEGATOR_URL=... the url of the delegator ... -# - VERBOSE=... true or false ... (if true, the logs will be displayed in the console) -# - CONFIGURATION_FILE={CONTAINER_PATH_OF_CUSTOM_CONFIG_FILE} ... the path of the custom configuration file ... -# -# container_name: rpc-proxy -# -# # ********* ADD THE DEPENDENCY ON THE THOR-SOLO SERVICE (IF YOU WANT TO USE THE THOR-SOLO SERVICE) ********* -# depends_on: -# - thor-solo -# -# # ********* MOUNT HERE THE CUSTOM CONFIGURATION FILE ********* -# volumes: -# - "HOST_PATH_OF_CUSTOM_CONFIG_FILE:{CONTAINER_PATH_OF_CUSTOM_CONFIG_FILE}" -# -# # ********* SET HERE THE REQUIRED PORT MAPPING ********* -# ports: -# - "HOST_PORT:{CONTAINER_PORT}" - -services: - # The Thor solo service - thor-solo: - container_name: thor-solo - image: ${THOR_IMAGE:-ghcr.io/vechain/thor:master-latest} - ports: - - "8669:8669" - command: - - solo - - --genesis=/node/config/genesis.json - - --on-demand - - --api-addr=0.0.0.0:8669 - - --api-cors=* - - --txpool-limit-per-account=256 - - --api-allowed-tracers=all - - --cache=1024 - - --verbosity=9 - - --persist - volumes: - - type: bind - source: ./docker/rpc-proxy/config - target: /node/config - deploy: - resources: - limits: - cpus: "1" - memory: 2048M - - # Default configuration for the RPC proxy service - rpc-proxy: - build: - context: . - dockerfile: docker/rpc-proxy/Dockerfile - container_name: rpc-proxy - environment: - - CONFIGURATION_FILE=/app/packages/rpc-proxy/solo-config.json - depends_on: - - thor-solo - ports: - - "8545:8545" - - # ********* SOME CUSTOM CONFIGURATION EXAMPLES ********* - - # 1. Example of a custom configuration file for the RPC proxy service - rpc-proxy-custom-config-file: - build: - context: . - dockerfile: docker/rpc-proxy/Dockerfile - environment: - - CONFIGURATION_FILE=/app/packages/rpc-proxy/custom-config.json - container_name: rpc-proxy-custom-config-file - depends_on: - - thor-solo - volumes: - - "./packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-list-of-private-keys.json:/app/packages/rpc-proxy/custom-config.json" - ports: - - "8545:8545" - - # 2. Example of a custom parameters for the RPC proxy service - rpc-proxy-custom-parameters: - build: - context: . - dockerfile: docker/rpc-proxy/Dockerfile - environment: - - PORT=9000 - - URL=https://testnet.vechain.org - - VERBOSE=true - container_name: rpc-proxy-custom-parameters - depends_on: - - thor-solo - ports: - - "9000:9000" - - # 3. Example of a custom accounts for the RPC proxy service - rpc-proxy-custom-accounts: - build: - context: . - dockerfile: docker/rpc-proxy/Dockerfile - environment: - - URL=https://testnet.vechain.org - - VERBOSE=true - - ACCOUNTS=7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 - container_name: rpc-proxy-custom-accounts - depends_on: - - thor-solo - ports: - - "8545:8545" - - # 3. Example of a custom mnemonic for the RPC proxy service - rpc-proxy-custom-mnemonic: - build: - context: . - dockerfile: docker/rpc-proxy/Dockerfile - environment: - - URL=https://testnet.vechain.org - - VERBOSE=true - - MNEMONIC=expire pair material agent north ostrich fortune level cousin snow mixture nurse - - MNEMONIC_COUNT=10 - - MNEMONIC_INITIAL_INDEX=0 - container_name: rpc-proxy-custom-mnemonic - depends_on: - - thor-solo - ports: - - "8545:8545" - - # 4. Example of a custom delegation by private key for the RPC proxy service - rpc-proxy-with-delegation-by-private-key: - build: - context: . - dockerfile: docker/rpc-proxy/Dockerfile - environment: - - URL=https://testnet.vechain.org - - VERBOSE=true - - MNEMONIC=expire pair material agent north ostrich fortune level cousin snow mixture nurse - - MNEMONIC_COUNT=10 - - MNEMONIC_INITIAL_INDEX=0 - - ENABLE_DELEGATION=true - - DELEGATOR_PRIVATE_KEY=7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 - container_name: rpc-proxy-with-delegation-by-private-key - depends_on: - - thor-solo - ports: - - "8545:8545" - - # 5. Example of a custom delegation by url for the RPC proxy service - rpc-proxy-with-delegation-by-url: - build: - context: . - dockerfile: docker/rpc-proxy/Dockerfile - environment: - - URL=https://testnet.vechain.org - - VERBOSE=true - - MNEMONIC=expire pair material agent north ostrich fortune level cousin snow mixture nurse - - MNEMONIC_COUNT=10 - - MNEMONIC_INITIAL_INDEX=0 - - ENABLE_DELEGATION=true - - DELEGATOR_URL=https://sponsor-testnet.vechain.energy/by/269 - container_name: rpc-proxy-with-delegation-by-url - depends_on: - - thor-solo - ports: - - "8545:8545" diff --git a/package.json b/package.json index 12654ed52..882d3aa9f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "build": "turbo build", "check:circular-dependencies": "turbo check:circular-dependencies", "pre-release": "ts-node scripts/pre-release.ts", - "test-rpc-proxy": "ts-node scripts/test-rpc-proxy.ts", "generate:apidocs": "typedoc --options typedoc.json --logLevel Error", "generate:apidocs-debug": "typedoc --options typedoc.json --logLevel Verbose --plugin typedoc-plugin-missing-exports --validation.notDocumented", "lint": "turbo lint", diff --git a/packages/core/eslint.config.mjs b/packages/core/eslint.config.mjs index 07928a2eb..6d343178f 100644 --- a/packages/core/eslint.config.mjs +++ b/packages/core/eslint.config.mjs @@ -10,8 +10,7 @@ export default [ from: [ "../errors", "../logging", - "../network", - "../rpc-proxy", + "../network" ], message: "Please import using @vechain/sdk-", }], diff --git a/packages/errors/eslint.config.mjs b/packages/errors/eslint.config.mjs index 24db7edd5..4c0ac6d3b 100644 --- a/packages/errors/eslint.config.mjs +++ b/packages/errors/eslint.config.mjs @@ -11,8 +11,7 @@ export default [ from: [ "../core", "../logging", - "../network", - "../rpc-proxy", + "../network" ], message: "Please import using @vechain/sdk-", diff --git a/packages/errors/src/available-errors/index.ts b/packages/errors/src/available-errors/index.ts index 8d1aa6484..40811d0cf 100644 --- a/packages/errors/src/available-errors/index.ts +++ b/packages/errors/src/available-errors/index.ts @@ -10,7 +10,6 @@ export * from './keystore'; export * from './poll'; export * from './provider'; export * from './rlp'; -export * from './rpc-proxy'; export * from './sdk-error'; export * from './secp256k1'; export * from './signer'; diff --git a/packages/errors/src/available-errors/rpc-proxy/index.ts b/packages/errors/src/available-errors/rpc-proxy/index.ts deleted file mode 100644 index a1ca663c6..000000000 --- a/packages/errors/src/available-errors/rpc-proxy/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './rpc-proxy'; diff --git a/packages/errors/src/available-errors/rpc-proxy/rpc-proxy.ts b/packages/errors/src/available-errors/rpc-proxy/rpc-proxy.ts deleted file mode 100644 index 97f30b176..000000000 --- a/packages/errors/src/available-errors/rpc-proxy/rpc-proxy.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { VechainSDKError } from '../sdk-error'; - -/** - * Invalid command line arguments - * - * WHEN TO USE: - * * When the RPC proxy is called with invalid command line arguments - */ -class InvalidCommandLineArguments extends VechainSDKError<{ - flag: string; - value: string; -}> {} - -/** - * Invalid configuration file path - * - * WHEN TO USE: - * * When the configuration file path given as input is invalid - */ -class InvalidConfigurationFilePath extends VechainSDKError<{ - filePath: string; -}> {} - -/** - * Invalid configuration file - * - * WHEN TO USE: - * * When the configuration file given as input is invalid - */ -class InvalidConfigurationFile extends VechainSDKError<{ - filePath?: string; - wrongField?: string; - message?: string; -}> {} - -export { - InvalidCommandLineArguments, - InvalidConfigurationFilePath, - InvalidConfigurationFile -}; diff --git a/packages/errors/tests/available-errors/rpc-proxy.unit.test.ts b/packages/errors/tests/available-errors/rpc-proxy.unit.test.ts deleted file mode 100644 index 907bb06aa..000000000 --- a/packages/errors/tests/available-errors/rpc-proxy.unit.test.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { - InvalidCommandLineArguments, - InvalidConfigurationFile, - InvalidConfigurationFilePath, - VechainSDKError -} from '../../src'; - -/** - * Available errors test - RPC Proxy - * @group unit/errors/available-errors/rpc-proxy - */ -describe('Error package Available errors test - RPC Proxy', () => { - /** - * InvalidCommandLineArguments - */ - test('InvalidCommandLineArguments', () => { - // Inner error - [undefined, new Error('error')].forEach((innerError) => { - expect(() => { - throw new InvalidCommandLineArguments( - 'method', - 'message', - { flag: 'flag1', value: 'value1' }, - innerError - ); - }).toThrowError(VechainSDKError); - }); - }); - - /** - * InvalidConfigurationFilePath - */ - test('InvalidConfigurationFilePath', () => { - // Inner error - [undefined, new Error('error')].forEach((innerError) => { - expect(() => { - throw new InvalidConfigurationFilePath( - 'method', - 'message', - { filePath: 'path' }, - innerError - ); - }).toThrowError(VechainSDKError); - }); - }); - - /** - * InvalidConfigurationFile - */ - test('InvalidConfigurationFile', () => { - // Inner error - [undefined, new Error('error')].forEach((innerError) => { - expect(() => { - throw new InvalidConfigurationFile( - 'method', - 'message', - { - filePath: 'path', - wrongField: 'field', - message: 'Some message' - }, - innerError - ); - }).toThrowError(VechainSDKError); - }); - }); -}); diff --git a/packages/logging/eslint.config.mjs b/packages/logging/eslint.config.mjs index 740a9c8c1..410118d8c 100644 --- a/packages/logging/eslint.config.mjs +++ b/packages/logging/eslint.config.mjs @@ -11,8 +11,7 @@ export default [ from: [ "../core", "../errors", - "../network", - "../rpc-proxy", + "../network" ], message: "Please import using @vechain/sdk-", diff --git a/packages/network/eslint.config.mjs b/packages/network/eslint.config.mjs index 36764d2cc..b6ad51e94 100644 --- a/packages/network/eslint.config.mjs +++ b/packages/network/eslint.config.mjs @@ -11,8 +11,7 @@ export default [ from: [ "../core", "../errors", - "../logging", - "../rpc-proxy", + "../logging" ], message: "Please import using @vechain/sdk-", diff --git a/packages/rpc-proxy/README.md b/packages/rpc-proxy/README.md deleted file mode 100644 index f85785ef5..000000000 --- a/packages/rpc-proxy/README.md +++ /dev/null @@ -1,262 +0,0 @@ -# @vechain/sdk-rpc-proxy - -Welcome to the **RPC Proxy** of the VeChain SDK! - -## Introduction - -The RPC Proxy is designed to bridge the gap between Thor's RESTful API and Ethereum's JSON-RPC, enabling seamless -interaction with the VeChainThor blockchain through RPC calls. It is particularly useful for integrating with tools such -as the Remix IDE. - -## Installation - -To install the RPC proxy, use the following command: - -``` bash -yarn add @vechain/sdk-rpc-proxy -``` - -## Usage - -The RPC proxy is simple to use. To start it, run: - -``` bash -npx rpc-proxy -``` - -By default, the proxy is configured to be used with a solo node running on your local machine. There are two options if you want to change the default behavior, or use a custom configuration: - - Create a config.json file and pass it to the command when launching the RPC Proxy. - - Use CLI options. - -## Configuration file - -Run: - -``` bash -npx rpc-proxy -c -``` - -Or: - -``` bash -npx rpc-proxy --configurationFile -``` - -## CLI Options - -With rpc-proxy, you can use the following CLI options. -Cli options override the configuration file. -So you can run the rpc-proxy with: - -- a configuration file with the default values and override them with the cli options - - -e.g.- `npx rpc-proxy -p 8545 -v ...` - -- a custom configuration file and override some values with the cli options - - -e.g.- `npx rpc-proxy -c /path/of/custom-config.json -p 8545 -v ...` - -### Cli options list - -#### Give the configuration file - -- `-c, --configurationFile `: The path to the configuration file. - - -e.g.- `npx rpc-proxy -c /path/of/custom-config.json` OR `rpc-proxy --configurationFile custom-config.json` - -- `-p, --port `: The port on which the proxy server will run. - - -e.g.- `npx rpc-proxy -p 8545` OR `rpc-proxy --port 8545` - -- `-u, --url `: The URL of the VeChainThor node. - - -e.g.- `npx rpc-proxy -u http://testnet.vechain.org` OR `rpc-proxy --url http://testnet.vechain.org` - -- `-v, --verbose`: Whether to enable verbose logging. - - -e.g.- `npx rpc-proxy -v` OR `rpc-proxy --verbose` - -#### Give the accounts - -- `-a, --accounts `: The accounts (private keys) that the proxy server will use to sign transactions. It is a - space-separated list of private keys. - - -e.g.- `npx rpc-proxy -a "7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158"` - OR `npx rpc-proxy --accounts "7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158"` - -- `-m, --mnemonic `: The mnemonic that the proxy server will use to sign transactions. -- `--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" --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. -- `--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 -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. - -## Configuration file - -The `config.json` file is used to configure the proxy server. It contains the following fields: - -- `url`: The URL of the VeChainThor node. -- `port`: The port of the proxy server. -- `accounts`: The accounts that the proxy server will use to sign transactions (can be a mnemonic or an array of private - keys). -- `verbose`: Wheter to enable verbose logging. -- `debug`: Whether to enable debug mode. -- `enableDelegation`: Whether to enable delegation. - -### Example Configurations - -Simple thor solo configuration with mnemonic: - -``` json -{ - "url": "http://127.0.0.1:8669", - "port": 8545, - "accounts": { - "mnemonic": "denial kitchen pet squirrel other broom bar gas better priority spoil cross", - "count": 10 - }, - "verbose": true, - "enableDelegation": false -} -``` - -Simple thor solo configuration with accounts as a list of private keys: - -``` json -{ - "url": "http://127.0.0.1:8669", - "port": 8545, - "accounts": [ - "7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158", - "8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158" - ], - "verbose": true, - "enableDelegation": false -} -``` - -Simple testnet configuration with a delegator private key: - -``` json -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "delegator": { - "delegatorPrivateKey": "8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158" - }, - "enableDelegation": true -} -``` - -Simple testnet configuration with a delegator private url: - -``` json -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "delegator": { - "delegatorUrl": "https://sponsor-testnet.vechain.energy/by/..." - }, - "enableDelegation": true -} -``` - -# Run as Docker Container - -To run the RPC proxy as a Docker container, follow these steps: - -``` bash -cd ../.. -docker build -f docker/rpc-proxy/Dockerfile . -t vechain-rpc-proxy -# We are assuming that the config.json file is placed at the same level as the project root -docker run -d -p 8545:8545 -v ./config.json:/app/config.json -t vechain-rpc-proxy -``` - -If you do not pass a config.json file, the default solo network standard configuration will be used. Make sure to -provide your desired configuration file. - -## JSON RPC Methods Support Status - -Below is the support status for JSON RPC methods in VeChain via `sdk-rpc-proxy`. - -| JSON RPC Method | Support Status | -|------------------------------------------|---------------------| -| debug_traceBlockByHash | Fully Supported | -| debug_traceBlockByNumber | Fully Supported | -| debug_traceCall | Fully Supported | -| debug_traceTransaction | Fully Supported | -| eth_accounts | Fully Supported | -| eth_blockNumber | Fully Supported | -| eth_call | Partially Supported | -| eth_chainId | Fully Supported | -| eth_coinbase | Fully Supported | -| eth_createAccessList | Fully Supported | -| eth_estimateGas | Partially Supported | -| eth_gasPrice | Fully Supported | -| eth_getBalance | Fully Supported | -| eth_getBlockByHash | Partially Supported | -| eth_getBlockByNumber | Partially Supported | -| eth_getBlockReceipts | Fully Supported | -| eth_getBlockTransactionCountByHash | Fully Supported | -| eth_getBlockTransactionCountByNumber | Fully Supported | -| eth_getCode | Fully Supported | -| eth_getLogs | Partially Supported | -| eth_getStorageAt | Fully Supported | -| eth_getTransactionByBlockHashAndIndex | Fully Supported | -| eth_getTransactionByBlockNumberAndIndex | Fully Supported | -| eth_getTransactionByHash | Fully Supported | -| eth_getTransactionCount | Partially Supported | -| eth_getTransactionReceipt | Fully Supported | -| eth_getUncleByBlockHashAndIndex | Partially Supported | -| eth_getUncleByBlockNumberAndIndex | Partially Supported | -| eth_getUncleCountByBlockHash | Partially Supported | -| eth_getUncleCountByBlockNumber | Partially Supported | -| eth_requestAccounts | Fully Supported | -| eth_sendRawTransaction | Fully Supported | -| eth_sendTransaction | Fully Supported | -| eth_signTransaction | Fully Supported | -| eth_signTypedDataV4 | Fully Supported | -| eth_subscribe | Fully Supported | -| eth_syncing | Partially Supported | -| eth_unsubscribe | Fully Supported | -| evm_mine | Fully Supported | -| net_listening | Fully Supported | -| net_peerCount | Fully Supported | -| net_version | Fully Supported | -| txpool_content | Partially Supported | -| txpool_contentFrom | Partially Supported | -| txpool_inspect | Partially Supported | -| txpool_status | Partially Supported | -| web3_clientVersion | Fully Supported | -| web3_sha3 | Fully Supported | -| eth_getUncleByBlockHash | Not Supported | -| eth_getUncleByBlockNumber | Not Supported | -| eth_newFilter | Not Supported | -| eth_newBlockFilter | Not Supported | -| eth_newPendingTransactionFilter | Not Supported | -| eth_uninstallFilter | Not Supported | -| eth_getFilterChanges | Not Supported | -| eth_getFilterLogs | Not Supported | -| eth_getProof | Not Supported | -| txpool_inspectFrom | Not Supported | - -### Notes -- **Fully Supported**: The method is implemented and works as expected. -- **Partially Supported**: The method is implemented but may have limitations or deviations from the Ethereum standard. -- **Not Supported**: The method is not implemented or cannot be supported due to protocol constraints. diff --git a/packages/rpc-proxy/default-proxy-config.json b/packages/rpc-proxy/default-proxy-config.json deleted file mode 100644 index 756900fb9..000000000 --- a/packages/rpc-proxy/default-proxy-config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/eslint.config.mjs b/packages/rpc-proxy/eslint.config.mjs deleted file mode 100644 index 02fff951e..000000000 --- a/packages/rpc-proxy/eslint.config.mjs +++ /dev/null @@ -1,22 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - rules: { - "import/no-restricted-paths": ["error", { - zones: [{ - target: "./src", - - from: [ - "../core", - "../errors", - "../logging", - "../network", - ], - - message: "Please import using @vechain/sdk-", - }], - }], - }, - }]; diff --git a/packages/rpc-proxy/jest.config.browser.js b/packages/rpc-proxy/jest.config.browser.js deleted file mode 100644 index 920f12e80..000000000 --- a/packages/rpc-proxy/jest.config.browser.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: '../../customEnv.js', - coverageReporters: ['html', 'lcov', 'json'], - runner: 'groups', - reporters: ['default', 'jest-junit'], - workerThreads: true -}; diff --git a/packages/rpc-proxy/jest.config.js b/packages/rpc-proxy/jest.config.js deleted file mode 100644 index f0f37eb7e..000000000 --- a/packages/rpc-proxy/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - coverageReporters: ['html', 'lcov', 'json'], - runner: 'groups', - reporters: ['default', 'jest-junit'], - workerThreads: true, - testTimeout: 180_0000, - coverageThreshold: { - global: { - branches: 100, - functions: 100, - lines: 100, - statements: 100 - } - } -}; diff --git a/packages/rpc-proxy/package.json b/packages/rpc-proxy/package.json deleted file mode 100644 index 632858671..000000000 --- a/packages/rpc-proxy/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@vechain/sdk-rpc-proxy", - "version": "2.0.0-beta.1", - "description": "Proxy Thor's RESTful API to Eth JSON-RPC", - "author": "VeChain Foundation", - "license": "MIT", - "homepage": "https://github.com/vechain/vechain-sdk-js", - "repository": { - "type": "git", - "url": "github:vechain/vechain-sdk-js" - }, - "keywords": [ - "VeChain", - "RPC", - "proxy" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "bin": { - "rpc-proxy": "dist/index.js" - }, - "files": [ - "dist", - "src", - "package.json", - "README.md", - "LICENSE" - ], - "scripts": { - "build": "rm -rf ./dist && tsup-node src/index.ts --format cjs,esm --dts", - "lint": "eslint", - "format": "prettier --write src/**/*.ts", - "start": "node dist/index.js", - "test:e2e": "cross-env DEBUG=\"testcontainers*\" jest tests/e2e_rpc_proxy.solo.test.ts", - "test:unit": "rm -rf ./coverageUnit && jest --coverage --coverageDirectory=coverageUnit --group=unit", - "test:integration": "rm -rf ./coverageIntegration && jest --coverage --coverageDirectory=coverageIntegration --group=integration", - "test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit", - "test:browser": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit --config ./jest.config.browser.js" - }, - "dependencies": { - "@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": "^13.0.0", - "cors": "^2.8.5", - "express": "^4.21.2" - }, - "devDependencies": { - "@types/cors": "^2.8.17", - "@types/express": "^5.0.0", - "@types/node": "^22.7.9", - "cross-env": "^7.0.3", - "testcontainers": "^10.14.0" - } -} \ No newline at end of file diff --git a/packages/rpc-proxy/solo-config.json b/packages/rpc-proxy/solo-config.json deleted file mode 100644 index fbce52e3c..000000000 --- a/packages/rpc-proxy/solo-config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "http://thor-solo:8669", - "port": 8545, - "accounts": { - "mnemonic": "denial kitchen pet squirrel other broom bar gas better priority spoil cross", - "count": 10, - "initialIndex": 0 - }, - "enableDelegation": false -} diff --git a/packages/rpc-proxy/src/index.ts b/packages/rpc-proxy/src/index.ts deleted file mode 100644 index 27cb23ee7..000000000 --- a/packages/rpc-proxy/src/index.ts +++ /dev/null @@ -1,165 +0,0 @@ -#! /usr/bin/env node - -import { Address, HDKey, HexUInt, Secp256k1 } from '@vechain/sdk-core'; -import { - ProviderInternalBaseWallet, - ProviderInternalHDWallet, - type ProviderInternalWallet, - ThorClient, - VeChainProvider -} from '@vechain/sdk-network'; -import cors from 'cors'; -import express, { type Express, type Request, type Response } from 'express'; -import defaultProxyConfig from '../default-proxy-config.json'; -import packageJson from '../package.json'; -import { type Config, type RequestBody } from './types'; -import { - getArgsFromEnv, - getOptionsFromCommandLine, - parseAndGetFinalConfig -} from './utils'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; -import { JSONRPCInternalError, stringifyData } from '@vechain/sdk-errors'; - -/** - * Start the proxy function. - * @note - * * This is a simple proxy server that converts and forwards RPC requests to the VeChain network. - * * Don't use this in production, it's just for testing purposes. - */ -function startProxy(): void { - // Init the default configuration - const defaultConfiguration: Config = defaultProxyConfig as Config; - - // Chose what args to pass to the proxy. - // If we use docker, we will convert docker env variables to command line arguments - // Otherwise, we will use the command line arguments - const runIntoDockerContainer = - process.env.RUNNING_WITH_DOCKER !== undefined && - process.env.RUNNING_WITH_DOCKER === 'true'; - - // Get the command line arguments options. This will be used to parse the command line arguments - const options = getOptionsFromCommandLine( - packageJson.version, - runIntoDockerContainer ? getArgsFromEnv() : process.argv - ); - - // Parse the SEMANTIC of the arguments and throw an error if the options are not valid - const config = parseAndGetFinalConfig(options, defaultConfiguration); - - // Log the RPC Proxy start - console.log('[rpc-proxy]: Starting VeChain RPC Proxy'); - - // Create all necessary objects to init Provider and Signer - const thorClient = ThorClient.at(config.url); - const wallet: ProviderInternalWallet = Array.isArray(config.accounts) - ? new ProviderInternalBaseWallet( - config.accounts.map((privateKey: string) => { - // Convert the private key to a buffer - const privateKeyBuffer = HexUInt.of( - privateKey.startsWith('0x') - ? privateKey.slice(2) - : privateKey - ).bytes; - - // Derive the public key and address from the private key - return { - privateKey: privateKeyBuffer, - publicKey: Secp256k1.derivePublicKey(privateKeyBuffer), - address: Address.ofPrivateKey(privateKeyBuffer).toString() - }; - }), - { - delegator: config.delegator - } - ) - : new ProviderInternalHDWallet( - config.accounts.mnemonic.split(' '), - config.accounts.count, - config.accounts.initialIndex, - HDKey.VET_DERIVATION_PATH, - { delegator: config.delegator } - ); - const provider = new VeChainProvider( - thorClient, - wallet, - config.enableDelegation - ); - - // Start the express proxy server - const app: Express = express(); - app.disable('x-powered-by'); - app.use( - (cors as (options: cors.CorsOptions) => express.RequestHandler)({}) - ); - app.use(express.json()); - - app.post('*', handleRequest); - app.get('*', handleRequest); - - app.listen(config.port, () => { - console.log(`[rpc-proxy]: Proxy is running on port ${config.port}`); - }).on('error', (err: Error) => { - console.error(`[rpc-proxy]: Error starting proxy ${err.message}`); - }); - - function handleRequest(req: Request, res: Response): void { - void (async () => { - // Request array - const requests = Array.isArray( - req.body as RequestBody | RequestBody[] - ) - ? (req.body as RequestBody[]) - : [req.body as RequestBody]; - - // Response array - const responses: unknown[] = []; - - for (const requestBody of requests) { - try { - // Get result - const result = await provider.request({ - method: requestBody.method, - params: requestBody.params - }); - - // Push the result to the responses array - responses.push({ - jsonrpc: '2.0', - result, - id: requestBody.id - }); - - // Log the request and the response - if (config.verbose === true) { - VeChainSDKLogger('log').log({ - title: `Sending request - ${requestBody.method}`, - messages: [`response: ${stringifyData(result)}`] - }); - } - } catch (error) { - // Push the error to the responses array - responses.push({ - jsonrpc: '2.0', - error, - id: requestBody.id - }); - - // Log the error - VeChainSDKLogger('error').log( - new JSONRPCInternalError( - requestBody.method, - `Error on request - ${requestBody.method}`, - { requestBody }, - error - ) - ); - } - } - - res.json(responses.length === 1 ? responses[0] : responses); - })(); - } -} - -startProxy(); diff --git a/packages/rpc-proxy/src/types.d.ts b/packages/rpc-proxy/src/types.d.ts deleted file mode 100644 index 11cb92bdc..000000000 --- a/packages/rpc-proxy/src/types.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { type SignTransactionOptions } from '@vechain/sdk-network'; - -/** - * Interface for the configuration object loaded from the config.json file - */ -interface Config { - /** - * Port to run the proxy on - */ - port?: number; - - /** - * URL of the blockchain node - */ - url: string; - - /** - * Accounts to use for signing transactions - */ - accounts: - | { - mnemonic: string; - count: number; - initialIndex: number; - } - | string[]; - - /** - * - * Delegator configuration - */ - delegator?: SignTransactionOptions; - - /** - * Enable verbose logging - */ - verbose?: boolean; - - /** - * Enable delegation - */ - enableDelegation?: boolean; -} - -/** - * Interface for the request body object that is sent to the proxy - */ -interface RequestBody { - method: string; - id: string; - params?: unknown[]; -} - -export type { Config, RequestBody }; 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 deleted file mode 100644 index d945ac251..000000000 --- a/packages/rpc-proxy/src/utils/args-validator/args-validator-and-getter.ts +++ /dev/null @@ -1,197 +0,0 @@ -import { type Config } from '../../types'; -import { type OptionValues } from 'commander'; -import { - checkValidConfigurationFile, - getConfigObjectFromFile -} from '../config-validator'; -import { ArgsValidator } from './args-validator'; -import { InvalidCommandLineArguments } from '@vechain/sdk-errors'; - -/** - * Main args validator AND getter object. - * - * It validates the command line arguments. - * AND then it gets a fresh configuration with the validated arguments. - * - * ArgsValidatorAndGetter is used to validate and, then, get the configuration fields. - */ -const ArgsValidatorAndGetter = { - /** - * Validate configuration fields and get the configuration. - * If a configuration file is provided, validate it and get the configuration. - * - * @param options Command line arguments options - * @param defaultConfiguration Default configuration to use if no configuration file or arguments are provided - * @returns Configuration object - * @throws {InvalidConfigurationFilePath, InvalidConfigurationFile} - */ - configurationFile: ( - options: OptionValues, - defaultConfiguration: Config - ): Config => { - const configurationFile = ArgsValidator.configurationFile( - options.configurationFile as string - ); - if (configurationFile !== null) { - // Check if the configuration file is valid JSON and if it exists - checkValidConfigurationFile(configurationFile); - - // Return the configuration object from the configuration file - return getConfigObjectFromFile(configurationFile); - } - return defaultConfiguration; - }, - - /** - * Validate 'port' configuration field - * - * @param options Command line arguments options - * @param currentConfiguration Default configuration to use if no field is provided - * @returns Configuration object - * @throws {InvalidCommandLineArguments} - */ - port: (options: OptionValues, currentConfiguration: Config): Config => { - const port = ArgsValidator.port( - options.port as string | null | undefined - ); - if (port !== null) { - return { - ...currentConfiguration, - port - } satisfies Config; - } - return currentConfiguration; - }, - - /** - * Validate 'url' configuration field - * - * @param options Command line arguments options - * @param currentConfiguration Default configuration to use if no field is provided - * @returns Configuration object - * @throws {InvalidCommandLineArguments} - */ - url: (options: OptionValues, currentConfiguration: Config): Config => { - const url = ArgsValidator.url(options.url as string | null | undefined); - if (url !== null) { - return { - ...currentConfiguration, - url - } satisfies Config; - } - return currentConfiguration; - }, - - /** - * Validate 'accounts' configuration field - * - * @param options Command line arguments options - * @param currentConfiguration Default configuration to use if no field is provided - * @returns Configuration object - * @throws {InvalidCommandLineArguments} - */ - accounts: (options: OptionValues, currentConfiguration: Config): Config => { - const accounts = ArgsValidator.accounts( - options.accounts as string | null | undefined - ); - if (accounts !== null) { - return { - ...currentConfiguration, - accounts - } satisfies Config; - } - return currentConfiguration; - }, - - /** - * Validate 'mnemonic' configuration field - * - * @param options Command line arguments options - * @param currentConfiguration Default configuration to use if no field is provided - * @returns Configuration object - * @throws {InvalidCommandLineArguments} - */ - mnemonicFields: ( - options: OptionValues, - currentConfiguration: Config - ): Config => { - const accounts = ArgsValidator.mnemonicFields( - options.mnemonic as string | null | undefined, - options.mnemonicCount as string | null | undefined, - options.mnemonicInitialIndex as string | null | undefined - ); - - if (accounts !== null) { - return { - ...currentConfiguration, - accounts - } satisfies Config; - } - - return currentConfiguration; - }, - - /** - * Validate 'delegation' configuration fields - * - * @param options Command line arguments options - * @param currentConfiguration Default configuration to use if no field is provided - * @returns Configuration object - * @throws {InvalidCommandLineArguments} - */ - delegation: ( - options: OptionValues, - currentConfiguration: Config - ): Config => { - // Both delegation fields are provided - throw an error - if ( - options.delegatorPrivateKey !== undefined && - options.delegatorUrl !== undefined && - options.delegatorPrivateKey !== null && - options.delegatorUrl !== null - ) { - throw new InvalidCommandLineArguments( - 'ArgsValidatorAndGetter.delegation()', - 'Both delegator private key and delegator URL are provided. Only one can be provided', - { - flag: '{--delegatorPrivateKey}, {-d , --delegatorUrl}', - value: `{value not provided for security reason} , {${options.delegatorUrl as string}}` - } - ); - } - - // Delegation is made with a private key - if ( - options.delegatorPrivateKey !== undefined && - options.delegatorPrivateKey !== null - ) { - return { - ...currentConfiguration, - delegator: { - delegatorPrivateKey: ArgsValidator.delegatorPrivateKey( - options.delegatorPrivateKey as string - ) - } - }; - } - - // Delegation is made with a delegator URL - if ( - options.delegatorUrl !== undefined && - options.delegatorUrl !== null - ) { - return { - ...currentConfiguration, - delegator: { - delegatorUrl: ArgsValidator.delegatorUrl( - options.delegatorUrl as string - ) - } - }; - } - - return currentConfiguration; - } -}; - -export { ArgsValidatorAndGetter }; diff --git a/packages/rpc-proxy/src/utils/args-validator/args-validator.ts b/packages/rpc-proxy/src/utils/args-validator/args-validator.ts deleted file mode 100644 index bc728ef16..000000000 --- a/packages/rpc-proxy/src/utils/args-validator/args-validator.ts +++ /dev/null @@ -1,306 +0,0 @@ -import { InvalidCommandLineArguments } from '@vechain/sdk-errors'; -import { checkValidConfigurationFile } from '../config-validator'; -import { - isValidAccountsAsListOfPrivateKeys, - isValidCount, - isValidDelegatorPrivateKey, - isValidDelegatorUrl, - isValidMnemonic, - isValidPort, - isValidUrl -} from '../validators'; - -/** - * Main args validator. - * - * It validates the command line arguments. - * - * ArgsValidator is used to validate every single field of the configuration. - */ -const ArgsValidator = { - /** - * Validate configuration fields and get the configuration. - * If a configuration file is provided, validate it and get the configuration. - * - * @param configurationFilePath The path to the configuration file. - * @returns Configuration file path if provided AND valid, null otherwise - * @throws {InvalidConfigurationFilePath, InvalidConfigurationFile} - */ - configurationFile: ( - configurationFilePath?: string | null - ): string | null => { - if ( - configurationFilePath !== undefined && - configurationFilePath !== null - ) { - if (configurationFilePath === '') - // Check if the configuration file is valid: It exists and is a valid JSON - checkValidConfigurationFile(configurationFilePath); - - console.log( - `[rpc-proxy]: Configuration file provided ${configurationFilePath}` - ); - - return configurationFilePath; - } else { - console.log( - '[rpc-proxy]: No configuration file. Default configuration will be used with command line args overrides.' - ); - } - return null; - }, - - /** - * Validate 'port' configuration field - * - * @param port Port to validate - * @returns Port if provided AND valid, null otherwise - * @throws {InvalidCommandLineArguments} - */ - port: (port?: string | null): number | null => { - if (port !== undefined && port !== null) { - const portAsNumber = Number(port.toString()); - - if (!isValidPort(portAsNumber) || port === '') { - throw new InvalidCommandLineArguments( - 'ArgsValidator.port()', - 'Invalid port provided. The parameter must be an integer', - { - flag: '-p , --port', - value: port - } - ); - } - console.log( - `[rpc-proxy]: Port provided with command line options: ${port}` - ); - - return portAsNumber; - } else { - console.log( - '[rpc-proxy]: No port provided with command line arguments. Default port will be used.' - ); - } - return null; - }, - - /** - * Validate 'url' configuration field - * - * @param url URL to validate - * @returns URL if provided AND valid, null otherwise - * @throws {InvalidCommandLineArguments} - */ - url: (url?: string | null): string | null => { - if (url !== undefined && url !== null) { - if (!isValidUrl(url) || url === '') { - throw new InvalidCommandLineArguments( - 'ArgsValidator.url()', - 'Invalid url provided. The parameter must be a valid url', - { - flag: '-u , --url', - value: url - } - ); - } - console.log( - `[rpc-proxy]: Url provided with command line options: ${url}` - ); - - return url; - } else { - console.log( - '[rpc-proxy]: No url provided with command line arguments. Default url will be used.' - ); - } - return null; - }, - - /** - * Validate 'accounts' configuration field - * - * @param accounts Accounts to validate - * @returns Accounts as a list of private keys, if provided AND valid, null otherwise - * @throws {InvalidCommandLineArguments} - */ - accounts: (accounts?: string | null): string[] | null => { - if (accounts !== undefined && accounts !== null) { - const accountsList: string[] = accounts.split(' '); - - if (Array.isArray(accountsList)) { - if ( - !isValidAccountsAsListOfPrivateKeys(accountsList) || - accounts === '' - ) { - throw new InvalidCommandLineArguments( - 'ArgsValidator.accounts()', - 'Invalid accounts provided. The parameter must be an array of valid private keys', - { - flag: '-a , --accounts', - value: 'Value will not be shown for security reasons (check your command line arguments)' - } - ); - } - - return accountsList; - } - } else { - console.log( - '[rpc-proxy]: No accounts provided with command line arguments. Default accounts will be used.' - ); - } - return null; - }, - - /* - * Validate mnemonic configuration fields - * - * @param mnemonic The mnemonic to validate - * @param mnemonicCount Mnemonic count to validate - * @param mnemonicIndex Mnemonic index to validate - * @returns Mnemonic, mnemonic count, and mnemonic index if provided AND valid, null otherwise - * @throws {InvalidCommandLineArguments} - */ - mnemonicFields: ( - mnemonic?: string | null, - mnemonicCount?: string | null, - mnemonicInitialIndex?: string | null - ): { - mnemonic: string; - count: number; - initialIndex: number; - } | null => { - // Check the fields (valid or not) - const isMnemonicValid = - mnemonic !== undefined && mnemonic !== null - ? isValidMnemonic(mnemonic) - : false; - - const isMnemonicCountValid = - mnemonicCount !== undefined && mnemonicCount !== null - ? isValidCount(Number(mnemonicCount)) && mnemonicCount !== '' - : false; - - const isMnemonicInitialIndexValid = - mnemonicInitialIndex !== undefined && mnemonicInitialIndex !== null - ? isValidCount(Number(mnemonicInitialIndex)) && - mnemonicInitialIndex !== '' - : false; - - // Check if at least one field is valid - const isAtLeastOneFieldValid = - isMnemonicCountValid || - isMnemonicInitialIndexValid || - isMnemonicValid; - - // Check if all fields are valid - const areAllFieldsValid = - isMnemonicValid && - isMnemonicCountValid && - isMnemonicInitialIndexValid; - - // If there is at least one field valid, ALL fields must be valid - if (isAtLeastOneFieldValid) { - // All fields are valid, we can return the configuration - if (areAllFieldsValid) { - return { - mnemonic: mnemonic as string, - count: Number(mnemonicCount), - initialIndex: Number(mnemonicInitialIndex) - }; - } - - // Some field is missing/invalid. Check which one is invalid and throw an error - if (!isMnemonicValid) { - throw new InvalidCommandLineArguments( - 'ArgsValidator.mnemonicFields()', - 'Invalid mnemonic provided. The parameter must be a valid mnemonic', - { - flag: '-m , --mnemonic', - value: 'Value will not be shown for security reasons' - } - ); - } - if (!isMnemonicCountValid) { - throw new InvalidCommandLineArguments( - 'ArgsValidator.mnemonicFields()', - 'Invalid count provided. The parameter must be an integer', - { - flag: '--mnemonicCount', - value: String(mnemonicCount) - } - ); - } - if (!isMnemonicInitialIndexValid) { - throw new InvalidCommandLineArguments( - 'ArgsValidator.mnemonicFields()', - 'Invalid initial index provided. The parameter must be an integer', - { - flag: '--mnemonicInitialIndex', - value: String(mnemonicInitialIndex) - } - ); - } - } else { - console.log( - '[rpc-proxy]: No mnemonic provided with command line arguments. Default mnemonic will be used.' - ); - } - - return null; - }, - - /** - * Delegate configuration - * Validate 'delegatorPrivateKey' configuration field. - * - * @param delegatorPrivateKey Delegator private key to validate - * @returns Delegator private key if provided AND valid, null otherwise - */ - delegatorPrivateKey: (delegatorPrivateKey: string): string => { - if ( - !isValidDelegatorPrivateKey(delegatorPrivateKey) || - delegatorPrivateKey === '' - ) { - throw new InvalidCommandLineArguments( - 'ArgsValidator.delegatorPrivateKey()', - 'An invalid delegator private key provided.', - { - flag: '--delegatorPrivateKey', - value: 'Value will not be shown for security reasons' - } - ); - } - console.log( - `[rpc-proxy]: Delegator private key provided with command line options` - ); - - return delegatorPrivateKey; - }, - - /* - * Validate 'delgatorUrl' configuration field - * - * @param delegatorUrl Delegator URL to validate - * @returns Delegator URL if provided AND valid, null otherwise - */ - delegatorUrl: (delegatorUrl: string): string => { - if (!isValidDelegatorUrl(delegatorUrl) || delegatorUrl === '') { - throw new InvalidCommandLineArguments( - 'ArgsValidator.delegatorUrl()', - 'Invalid delegator url provided. The parameter must be a valid url', - { - flag: '-d , --delegatorUrl', - value: delegatorUrl - } - ); - } - console.log( - `[rpc-proxy]: Delegator url provided with command line options: ${delegatorUrl}` - ); - - return delegatorUrl; - } -}; - -export { ArgsValidator }; diff --git a/packages/rpc-proxy/src/utils/args-validator/index.ts b/packages/rpc-proxy/src/utils/args-validator/index.ts deleted file mode 100644 index 19cf6f6ac..000000000 --- a/packages/rpc-proxy/src/utils/args-validator/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './args-validator'; -export * from './args-validator-and-getter'; diff --git a/packages/rpc-proxy/src/utils/args/args-options.ts b/packages/rpc-proxy/src/utils/args/args-options.ts deleted file mode 100644 index a8418ffdf..000000000 --- a/packages/rpc-proxy/src/utils/args/args-options.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { Command, Option, type OptionValues } from 'commander'; - -/** - * Get the command line arguments options - * - * Options: - * rpc-proxy {-u|--url} - The URL of the blockchain node - * rpc-proxy {-p|--port} - The port to run the proxy on - * - * rpc-proxy {-a|--accounts} - List of accounts private keys to use for signing transactions - * * 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 {--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 {--delegatorPrivateKey} - Delegator private key - * rpc-proxy {-d|--delegatorUrl} - Delegator URL - * - * rpc-proxy {-v|--verbose} - Enable verbose logging - * - * rpc-proxy {-c|--configurationFile} - Path to configuration file - * - * @param proxyVersion - Version of the proxy - * @param source - Source of the command line arguments to parse - * @returns Command line arguments options - */ -function getOptionsFromCommandLine( - proxyVersion: string, - source: string[] -): OptionValues { - // Create the program to parse the command line arguments and options - const program = new Command(); - - // Set the program version and description and command line options - program - .version(proxyVersion) - .description('VeChain RPC Proxy') - - // URL of the blockchain node - // Syntax: -u OR --url - .addOption(new Option('-u, --url ', 'URL of the blockchain node')) - - // Port to run the proxy on (optional) - // Syntax: -p OR --port - .addOption(new Option('-p, --port ', 'Port to run the proxy on')) - - // Accounts to use for signing transactions (LIST OF PRIVATE KEYS) - .addOption( - new Option( - '-a, --accounts ', - 'List of accounts private keys to use for signing transactions' - ) - ) - - // Accounts to use for signing transactions (HD WALLET MNEMONIC) - .addOption( - new Option( - '-m, --mnemonic ', - 'Mnemonic to use for signing transactions' - ) - ) - .addOption( - new Option( - '--mnemonicCount ', - 'Number of accounts to derive from the mnemonic' - ) - ) - .addOption( - new Option( - '--mnemonicInitialIndex ', - 'Initial index to start deriving accounts from the mnemonic' - ) - ) - - // Enable delegation boolean - .addOption(new Option('-e, --enableDelegation', 'Enable delegation')) - - // Delegator configuration (private key) - .addOption( - new Option( - '--delegatorPrivateKey ', - 'Delegator private key' - ) - ) - - // Delegator configuration (url) - .addOption( - new Option('-d, --delegatorUrl ', 'Delegator URL') - ) - - // Enable verbose logging - .addOption(new Option('-v, --verbose', 'Enable verbose logging')) - - // Configuration file - .addOption( - new Option( - '-c, --configurationFile ', - 'Path to configuration file' - ) - ) - - // Get the options from the command line arguments - .parse(source); - - // Return the options - return program.opts(); -} - -export { getOptionsFromCommandLine }; diff --git a/packages/rpc-proxy/src/utils/args/args-parser.ts b/packages/rpc-proxy/src/utils/args/args-parser.ts deleted file mode 100644 index d149be47e..000000000 --- a/packages/rpc-proxy/src/utils/args/args-parser.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { type OptionValues } from 'commander'; -import { type Config } from '../../types'; -import { ArgsValidatorAndGetter } from '../args-validator'; -import { InvalidCommandLineArguments } from '@vechain/sdk-errors'; - -/** - * Parse the semantic of the arguments. - * This function is related to rules of the arguments. - * - * -e.g.- if we use accounts:, - * * we need to use mnemonic, mnemonicCount and mnemonicInitialIndex - * OR - * * accounts as a list of private keys - * - * -e.g.- We need to check if the port is a number - * - * -e.g.- We need to check if the configuration file is valid - * - * ... - * - * @param options Arguments options to parse - * @param defaultConfiguration Default configuration to use if no configuration file or arguments are provided - * @throws {InvalidCommandLineArguments, InvalidConfigurationFilePath, InvalidConfigurationFile} - */ -function parseAndGetFinalConfig( - options: OptionValues, - defaultConfiguration: Config -): Config { - // Initialize the configuration - let configuration: Config = defaultConfiguration; - - // A - No configuration OR arguments provided - if (Object.keys(options).length === 0) { - console.log( - '[rpc-proxy]: No configuration file or command line args provided. Default configuration will be used.' - ); - } - - // B - Configuration OR arguments provided - else { - // B.1 - Get and validate configuration file - configuration = ArgsValidatorAndGetter.configurationFile( - options, - defaultConfiguration - ); - - // B.2 - Get and validate port field - configuration = ArgsValidatorAndGetter.port(options, configuration); - - // B.3 - Get and validate url field - configuration = ArgsValidatorAndGetter.url(options, configuration); - - // B.4 - Verbosity - if (options.verbose !== undefined) { - configuration.verbose = options.verbose as boolean; - } - - // B.5 - Get and validate accounts field - configuration = ArgsValidatorAndGetter.accounts(options, configuration); - - // B.6 - Get and validate mnemonic field - configuration = ArgsValidatorAndGetter.mnemonicFields( - options, - configuration - ); - - // B.7 - Enable delegation - if (options.enableDelegation !== undefined) { - configuration.enableDelegation = - options.enableDelegation as boolean; - } - - // B.8 - Get and validate delegator private key field - configuration = ArgsValidatorAndGetter.delegation( - options, - configuration - ); - - // C - Evaluate the semantic of the arguments. - // NOTE: Here we know all the fields are valid. So we can check the semantics of the fields. - - // Delegation cannot be enabled without a delegator - if ( - (configuration.enableDelegation as boolean) && - configuration.delegator === undefined - ) { - throw new InvalidCommandLineArguments( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid configuration: Delegation cannot be enabled without a delegator`, - { - flag: '--enableDelegation , --delegatorPrivateKey, --delegatorUrl', - value: `${options.enableDelegation}, Not provided, Not provided` - } - ); - } - } - - // Return the configuration - return configuration; -} - -export { parseAndGetFinalConfig }; diff --git a/packages/rpc-proxy/src/utils/args/env-to-args.ts b/packages/rpc-proxy/src/utils/args/env-to-args.ts deleted file mode 100644 index ef4b6bc12..000000000 --- a/packages/rpc-proxy/src/utils/args/env-to-args.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Get a cli field from an environment variable - * @param field The field to get - * @param envVarValue The environment variable value - * @param envVarName The name of the environment variable - * @returns {string[]} The cli field - */ -function getCliFieldFromEnv( - field: string, - envVarValue: string | undefined, - envVarName: string -): string[] { - // Variable is defined - if (envVarValue !== undefined) { - console.log(`[rpc-proxy]: Get ${envVarName} from environment variable`); - return [field, envVarValue]; - } - return []; -} - -/** - * Get the CLI arguments from the environment variables - * - * @returns {string[]} The CLI arguments - */ -function getArgsFromEnv(): string[] { - // Initial log - console.log(`[rpc-proxy]: Running with Docker`); - - // Array of arguments to pass to the proxy - const argsFromEnvOptions: string[] = ['node', 'dist/index.js'].concat( - getCliFieldFromEnv('-u', process.env.URL, 'URL'), - getCliFieldFromEnv('-p', process.env.PORT, 'PORT'), - getCliFieldFromEnv('-a', process.env.ACCOUNTS, 'ACCOUNTS'), - getCliFieldFromEnv('-m', process.env.MNEMONIC, 'MNEMONIC'), - getCliFieldFromEnv( - '--mnemonicCount', - process.env.MNEMONIC_COUNT, - 'MNEMONIC_COUNT' - ), - getCliFieldFromEnv( - '--mnemonicInitialIndex', - process.env.MNEMONIC_INITIAL_INDEX, - 'MNEMONIC_INITIAL_INDEX' - ), - getCliFieldFromEnv( - '-e', - process.env.ENABLE_DELEGATION, - 'ENABLE_DELEGATION' - ), - getCliFieldFromEnv( - '--delegatorPrivateKey', - process.env.DELEGATOR_PRIVATE_KEY, - 'DELEGATOR_PRIVATE_KEY' - ), - getCliFieldFromEnv('-d', process.env.DELEGATOR_URL, 'DELEGATOR_URL'), - getCliFieldFromEnv('-v', process.env.VERBOSE, 'VERBOSE'), - getCliFieldFromEnv( - '-c', - process.env.CONFIGURATION_FILE, - 'CONFIGURATION_FILE' - ) - ); - - // Start the proxy - return argsFromEnvOptions; -} - -export { getArgsFromEnv }; diff --git a/packages/rpc-proxy/src/utils/args/index.ts b/packages/rpc-proxy/src/utils/args/index.ts deleted file mode 100644 index 86184c920..000000000 --- a/packages/rpc-proxy/src/utils/args/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './args-options'; -export * from './args-parser'; -export * from './env-to-args'; diff --git a/packages/rpc-proxy/src/utils/config-validator/config-validator.ts b/packages/rpc-proxy/src/utils/config-validator/config-validator.ts deleted file mode 100644 index 9cb3fadcf..000000000 --- a/packages/rpc-proxy/src/utils/config-validator/config-validator.ts +++ /dev/null @@ -1,257 +0,0 @@ -import { - InvalidConfigurationFile, - InvalidConfigurationFilePath -} from '@vechain/sdk-errors'; -import fs from 'fs'; -import path from 'path'; -import type { Config } from '../../types'; -import { - isValidAccountsAsListOfPrivateKeys, - isValidAccountsAsMnemonic, - isValidDelegatorPrivateKey, - isValidDelegatorUrl, - isValidPort, - isValidUrl -} from '../validators'; - -/** - * Check of the configuration file exists. - * @param filePath The path to the configuration file. - * @throws {InvalidConfigurationFilePath} - */ -function _checkConfigurationFileExists(filePath: string): void { - // Resolve the absolute path of the configuration file - const absolutePath = path.resolve(filePath); - - // Throw an error if the configuration file does not exist - if (!fs.existsSync(absolutePath) || filePath === '') { - throw new InvalidConfigurationFilePath( - '_checkConfigurationFileExists()', - `Configuration file not found: ${absolutePath}`, - { - filePath - } - ); - } -} - -/** - * Check if the configuration file is a valid JSON. - * @param filePath The path to the configuration file. - * @throws {InvalidConfigurationFile} - */ -function _checkIfConfigurationFileIsAValidJSON(filePath: string): void { - // Resolve the absolute path of the configuration file - const absolutePath = path.resolve(filePath); - - // Read the configuration file - const fileContent = fs.readFileSync(absolutePath, 'utf-8'); - - // Try to parse the JSON configuration file - try { - JSON.parse(fileContent) as Config; - } catch (e) { - throw new InvalidConfigurationFile( - '_readAndValidateConfigurationFile()', - `Cannot parse configuration file: ${absolutePath}. It is not a valid JSON file`, - { - filePath - }, - e - ); - } -} - -/** - * Check if the configuration file is has the correct structure. - * @param filePath The path to the configuration file. - * @throws {InvalidConfigurationFile} - */ -function _checkIfConfigurationFileHasCorrectStructure(filePath: string): void { - // Resolve the absolute path of the configuration file - const absolutePath = path.resolve(filePath); - - // Read the configuration file - const fileContent = fs.readFileSync(absolutePath, 'utf-8'); - - // Try to parse the JSON configuration file - const configFile = JSON.parse(fileContent) as Config; - - // Check the port - if (configFile.port !== undefined && !isValidPort(configFile.port)) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid port in configuration file: ${absolutePath}. Port must be a positive integer`, - { - filePath - } - ); - } - - // Check the url - if (configFile.url !== undefined && !isValidUrl(configFile.url)) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid url in configuration file: ${absolutePath}. URL is required`, - { - filePath - } - ); - } - - // Check the accounts (as an array or private keys) - if (Array.isArray(configFile.accounts)) { - if (!isValidAccountsAsListOfPrivateKeys(configFile.accounts)) - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid accounts in configuration file: ${absolutePath}. Accounts must be an array of valid private keys`, - { - filePath - } - ); - } else if (!isValidAccountsAsMnemonic(configFile.accounts)) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid accounts in configuration file: ${absolutePath}. Accounts must contain a valid mnemonic, count, and initialIndex`, - { - filePath - } - ); - } - - // Check the delegator - if (configFile.delegator !== undefined) { - // Both delegator private key and url are given - if ( - configFile.delegator.delegatorPrivateKey !== undefined && - configFile.delegator.delegatorUrl !== undefined - ) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid delegator configuration in configuration file: ${absolutePath}. Delegator configuration must contain either a private key or a URL, not both`, - { - filePath - } - ); - } - - // Invalid delegator private key - if ( - configFile.delegator.delegatorPrivateKey !== undefined && - !isValidDelegatorPrivateKey( - configFile.delegator.delegatorPrivateKey - ) - ) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid delegator private key in configuration file: ${absolutePath}. Delegator private key must be a valid private key`, - { - filePath - } - ); - } - - // Invalid delegator url - if ( - configFile.delegator.delegatorUrl !== undefined && - !isValidDelegatorUrl(configFile.delegator.delegatorUrl) - ) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid delegator url in configuration file: ${absolutePath}. Delegator url must be a valid URL`, - { - filePath - } - ); - } - } - - // Check the verbose flag - if ( - configFile.verbose !== undefined && - typeof configFile.verbose !== 'boolean' - ) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid verbose flag in configuration file: ${absolutePath}. Verbose flag must be a boolean`, - { - filePath - } - ); - } - - // Check the enableDelegation flag - if ( - configFile.enableDelegation !== undefined && - typeof configFile.enableDelegation !== 'boolean' - ) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid enableDelegation flag in configuration file: ${absolutePath}. enableDelegation flag must be a boolean`, - { - filePath - } - ); - } - - // NOTE: Here we know all the fields are valid. So we can check the semantics of the fields. - - // Delegation cannot be enabled without a delegator - if ( - (configFile.enableDelegation as boolean) && - configFile.delegator === undefined - ) { - throw new InvalidConfigurationFile( - '_checkIfConfigurationFileHasCorrectStructure()', - `Invalid configuration file: ${absolutePath}. Delegator configuration must be removed when enableDelegation is false`, - { - filePath - } - ); - } -} - -/** - * Get the configuration object from the configuration file. - * - * @note: The configuration file is assumed to be valid. - * Before calling this function, check the configuration file with - * the checkValidConfigurationFile() function. - * - * @param filePath The path to the configuration file. - * @returns The configuration object. - */ -function getConfigObjectFromFile(filePath: string): Config { - // Resolve the absolute path of the configuration file - const absolutePath = path.resolve(filePath); - - // Read the configuration file - const fileContent = fs.readFileSync(absolutePath, 'utf-8'); - - // Parse the JSON configuration file - return JSON.parse(fileContent) as Config; -} - -/** - * Read and parse the configuration file. - * Check if: - * * The configuration file exists. - * * The configuration file is a valid JSON. - * * The configuration file has the correct structure. - * - * @param filePath The path to the configuration file. - * @returns The configuration object. - * @throws {InvalidConfigurationFilePath, InvalidConfigurationFile} - */ -function checkValidConfigurationFile(filePath: string): void { - // Check if the configuration file exists - _checkConfigurationFileExists(filePath); - - // Check if the configuration file is a valid JSON - _checkIfConfigurationFileIsAValidJSON(filePath); - - // The configuration has a valid structure - _checkIfConfigurationFileHasCorrectStructure(filePath); -} - -export { checkValidConfigurationFile, getConfigObjectFromFile }; diff --git a/packages/rpc-proxy/src/utils/config-validator/index.ts b/packages/rpc-proxy/src/utils/config-validator/index.ts deleted file mode 100644 index c283c1852..000000000 --- a/packages/rpc-proxy/src/utils/config-validator/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './config-validator'; diff --git a/packages/rpc-proxy/src/utils/index.ts b/packages/rpc-proxy/src/utils/index.ts deleted file mode 100644 index f8710fc4b..000000000 --- a/packages/rpc-proxy/src/utils/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './args'; -export * from './args-validator'; -export * from './config-validator'; -export * from './validators'; diff --git a/packages/rpc-proxy/src/utils/validators/index.ts b/packages/rpc-proxy/src/utils/validators/index.ts deleted file mode 100644 index 011b41e03..000000000 --- a/packages/rpc-proxy/src/utils/validators/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './validators'; diff --git a/packages/rpc-proxy/src/utils/validators/validators.ts b/packages/rpc-proxy/src/utils/validators/validators.ts deleted file mode 100644 index 2dfa90a36..000000000 --- a/packages/rpc-proxy/src/utils/validators/validators.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { Hex, Mnemonic, Secp256k1 } from '@vechain/sdk-core'; - -/** - * Check if the url field is valid - * @param url - URL to check - * @returns True if the url is valid, false otherwise - */ -function isValidUrl(url: string): boolean { - try { - // eslint-disable-next-line no-new - new URL(url); - return true; - } catch { - return false; - } -} - -/** - * Check if the port field is valid - * @param port - Port to check - * @returns True if the port is valid, false otherwise - */ -function isValidPort(port: number): boolean { - return !isNaN(port) && Number.isInteger(port) && port >= 0; -} - -/** - * Check if the accounts (as array or private keys) field is valid - * @param accounts - Account to check - * @returns True if the account is valid, false otherwise - */ -function isValidAccountsAsListOfPrivateKeys(accounts: string[]): boolean { - return accounts.every((account) => { - if (Hex.isValid(account)) { - return Secp256k1.isValidPrivateKey(Hex.of(account).bytes); - } - return false; - }); -} - -/** - * Check if the mnemonic is valid - * @param mnemonicWords - Mnemonic to check - * @returns True if the mnemonic is valid, false otherwise - */ -function isValidMnemonic(mnemonicWords: string): boolean { - return Mnemonic.isValid(mnemonicWords.split(' ')); -} - -/** - * Check if count field is valid - * @param count - Count to check - * @returns True if the count is valid, false otherwise - */ -function isValidCount(count: number): boolean { - return !isNaN(count) && Number.isInteger(count) && count >= 0; -} - -/** - * Check if initialIndex field is valid - * @param initialIndex - Initial index to check - * @returns True if the initial index is valid, false otherwise - */ -function isValidInitialIndex(initialIndex: number): boolean { - return ( - !isNaN(initialIndex) && - Number.isInteger(initialIndex) && - initialIndex >= 0 - ); -} - -/** - * Check if the accounts (as mnemonic) field is valid - * @param account - Account to check - * @returns True if the account is valid, false otherwise - */ -function isValidAccountsAsMnemonic(account: { - mnemonic: string; - count: number; - initialIndex: number; -}): boolean { - return !( - !isValidMnemonic(account.mnemonic) || - !isValidCount(account.count) || - !isValidInitialIndex(account.initialIndex) - ); -} - -/** - * Check if the delegator url is valid - * @param url - URL to check - * @returns True if the url is valid, false otherwise - */ -function isValidDelegatorUrl(url: string): boolean { - return isValidUrl(url); -} - -/** - * Check if the delegator private key is valid - * @param privateKey - Private key to check - * @returns True if the private key is valid, false otherwise - */ -function isValidDelegatorPrivateKey(privateKey: string): boolean { - return isValidAccountsAsListOfPrivateKeys([privateKey]); -} - -export { - isValidUrl, - isValidPort, - isValidAccountsAsListOfPrivateKeys, - isValidMnemonic, - isValidCount, - isValidInitialIndex, - isValidAccountsAsMnemonic, - isValidDelegatorUrl, - isValidDelegatorPrivateKey -}; diff --git a/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-list-of-private-keys.json b/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-list-of-private-keys.json deleted file mode 100644 index f8135ac8d..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-list-of-private-keys.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": [ - "7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158", - "8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158" - ], - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-mnemonic.json b/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-mnemonic.json deleted file mode 100644 index 1a79ebf81..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-accounts-mnemonic.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-delegator-private-key.json b/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-delegator-private-key.json deleted file mode 100644 index 885350a0d..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-delegator-private-key.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "delegator": { - "delegatorPrivateKey": "8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158" - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-delegator-url.json b/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-delegator-url.json deleted file mode 100644 index 7af6e7e30..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/correct-proxy-config-delegator-url.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "delegator": { - "delegatorUrl": "https://testnet.vechain.org" - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-list-of-private-keys-proxy-config-1.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-list-of-private-keys-proxy-config-1.json deleted file mode 100644 index f2bb0234d..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-list-of-private-keys-proxy-config-1.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": [ - "INVALID_ACCOUNT" - ], - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-list-of-private-keys-proxy-config-2.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-list-of-private-keys-proxy-config-2.json deleted file mode 100644 index 58b18c8c0..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-list-of-private-keys-proxy-config-2.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": [ - "01234" - ], - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-1.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-1.json deleted file mode 100644 index 67e18f2a2..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-1.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": { - "mnemonic": "INVALID_MNEMONIC", - "count": 10, - "initialIndex": 0 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-2.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-2.json deleted file mode 100644 index f062c8e89..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": -1, - "initialIndex": 0 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-3.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-3.json deleted file mode 100644 index 1cd91c343..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-3.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": "INVALID_INTEGER", - "initialIndex": 0 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-4.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-4.json deleted file mode 100644 index 7c73d2358..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-4.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 0, - "initialIndex": -1 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-5.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-5.json deleted file mode 100644 index 7c73d2358..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-accounts-mnemonics-proxy-config-5.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 0, - "initialIndex": -1 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-1.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-1.json deleted file mode 100644 index 3b65773b0..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-1.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 0, - "initialIndex": 0 - }, - "delegator": { - "delegatorPrivateKey": "INVALID" - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-2.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-2.json deleted file mode 100644 index 37020cf52..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-2.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 0, - "initialIndex": 0 - }, - "delegator": { - "delegatorUrl": "INVALID" - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-3.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-3.json deleted file mode 100644 index 7145ec069..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-delegator-proxy-config-3.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 10, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 0, - "initialIndex": 0 - }, - "delegator": { - "delegatorPrivateKey": "INVALID", - "delegatorUrl": "INVALID" - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-enable-delegation-proxy-config-1.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-enable-delegation-proxy-config-1.json deleted file mode 100644 index 9af99c5d3..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-enable-delegation-proxy-config-1.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "enableDelegation": "INVALID" -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-json-format-proxy-config b/packages/rpc-proxy/tests/config-files-fixtures/invalid-json-format-proxy-config deleted file mode 100644 index 3c3ba7059..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-json-format-proxy-config +++ /dev/null @@ -1,8 +0,0 @@ -"url": "https://testnet.vechain.org", -"port", -"accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 -}, -"enableDelegation" \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-port-proxy-config-negative-number.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-port-proxy-config-negative-number.json deleted file mode 100644 index 2d4a2bbbb..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-port-proxy-config-negative-number.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": -1, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-port-proxy-config-non-integer.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-port-proxy-config-non-integer.json deleted file mode 100644 index 2d4a2bbbb..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-port-proxy-config-non-integer.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": -1, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-semantic-proxy-config-1.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-semantic-proxy-config-1.json deleted file mode 100644 index 5e5ef9310..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-semantic-proxy-config-1.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": [ - "7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158", - "8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158" - ], - "enableDelegation": true -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-url-proxy-config.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-url-proxy-config.json deleted file mode 100644 index 5e2ff89a9..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-url-proxy-config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "url": "INVALID_URL", - "port": 10, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/config-files-fixtures/invalid-verbose-flag-proxy-config-1.json b/packages/rpc-proxy/tests/config-files-fixtures/invalid-verbose-flag-proxy-config-1.json deleted file mode 100644 index 305d8231c..000000000 --- a/packages/rpc-proxy/tests/config-files-fixtures/invalid-verbose-flag-proxy-config-1.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "url": "https://testnet.vechain.org", - "port": 8545, - "accounts": { - "mnemonic": "expire pair material agent north ostrich fortune level cousin snow mixture nurse", - "count": 10, - "initialIndex": 0 - }, - "verbose": "INVALID", - "enableDelegation": false -} \ No newline at end of file diff --git a/packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts b/packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts deleted file mode 100644 index 4ec540ee4..000000000 --- a/packages/rpc-proxy/tests/e2e_rpc_proxy.solo.test.ts +++ /dev/null @@ -1,952 +0,0 @@ -import { describe, it, beforeAll, afterAll } from '@jest/globals'; -import axios from 'axios'; -import { - DockerComposeEnvironment, - PullPolicy, - type StartedDockerComposeEnvironment, - Wait -} from 'testcontainers'; - -let environment: StartedDockerComposeEnvironment; -const RPC_PROXY_URL = `http://localhost:8545`; - -beforeAll(async () => { - environment = await new DockerComposeEnvironment( - '../../', - 'docker-compose.rpc-proxy.yml' - ) - .withPullPolicy(PullPolicy.alwaysPull()) - .withWaitStrategy( - 'thor-solo', - Wait.forLogMessage('📦 new block packed') - ) - .withWaitStrategy( - 'rpc-proxy', - Wait.forLogMessage('[rpc-proxy]: Proxy is running on port 8545') - ) - .withBuild() - .up(['rpc-proxy']); -}); - -afterAll(async () => { - await environment.down(); -}); - -describe('RPC Proxy endpoints', () => { - describe('should return proper response for', () => { - it('debug_traceBlockByHash method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'debug_traceBlockByHash', - params: [ - '0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de', - { tracer: 'callTracer' } - ], - id: 1 - }); - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('debug_traceBlockByNumber method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'debug_traceBlockByNumber', - params: ['0x0', { tracer: 'callTracer' }], - id: 1 - }); - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('debug_traceCall method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'debug_traceCall', - params: [ - { - from: '0xf077b491b355e64048ce21e3a6fc4751eeea77fa', - to: '0x435933c8064b4ae76be665428e0307ef2ccfbd68', - value: '0x0', - data: '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000', - gas: '0x0' - }, - 'latest', - { - tracer: 'callTracer', - tracerConfig: { - onlyTopCall: true - } - } - ], - id: 1 - }); - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('debug_traceTransaction method call', async () => { - // post tx - let response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_sendTransaction', - params: [ - { - from: '0xf077b491b355e64048ce21e3a6fc4751eeea77fa', - to: '0x435933c8064b4ae76be665428e0307ef2ccfbd68', - value: '0x111' - } - ], - id: 67 - }); - - expect(response.status).toBe(200); - - // get receipt - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const tx = response.data.result as string; - let receipt = null; - - while (receipt === null) { - // wait for receipt - response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getTransactionReceipt', - params: [tx], - id: 1 - }); - - expect(response.status).toBe(200); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - receipt = response.data.result as string; - } - - response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'debug_traceTransaction', - params: [ - tx, - { - tracer: 'callTracer' - } - ], - id: 1 - }); - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_accounts method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_accounts', - id: 1 - }); - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_blockNumber method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_blockNumber', - params: [], - id: 1 - }); - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_call method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_call', - params: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - 'latest' - ], - id: 1 - }); - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_chainId method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_chainId', - params: [], - id: 1 - }); - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBe('0x186aa'); - }); - - it('eth_estimateGas method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - method: 'eth_estimateGas', - params: [ - { - to: '0xf077b491b355e64048ce21e3a6fc4751eeea77fa', - value: '0x186a0', - data: '0x' - }, - 'latest' - ], - id: 1, - jsonrpc: '2.0' - }); - - expect(response.status).toBe(200); - console.log(response.data); - - expect(response.data).toHaveProperty('result'); - }); - - it('eth_gasPrice method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_gasPrice', - params: [], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getBalance method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getBalance', - params: [ - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - 'latest' - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getBlockByHash method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getBlockByHash', - params: [ - '0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de', - false - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getBlockByNumber method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getBlockByNumber', - params: ['0x0', false], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getBlockReceipts method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getBlockReceipts', - params: [ - '0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de' - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getBlockTransactionCountByHash method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - method: 'eth_getBlockTransactionCountByHash', - params: [ - '0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de' - ], - id: 1, - jsonrpc: '2.0' - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getBlockTransactionCountByNumber method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - method: 'eth_getBlockTransactionCountByNumber', - params: ['0x0'], - id: 1, - jsonrpc: '2.0' - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getCode method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getCode', - params: [ - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - 'latest' - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getLogs method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getLogs', - params: [ - { address: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' } - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getStorageAt method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getStorageAt', - params: [ - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - '0x0', - '0x0' - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getTransactionByBlockHashAndIndex method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - method: 'eth_getTransactionByBlockHashAndIndex', - params: [ - '0x0000000008602e7a995c747a3215b426c0c65709480b9e9ac57ad37c3f7d73de', - '0x0' - ], - id: 1, - jsonrpc: '2.0' - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getTransactionByBlockNumberAndIndex method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - method: 'eth_getTransactionByBlockNumberAndIndex', - params: ['0x0', '0x0'], - id: 1, - jsonrpc: '2.0' - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getTransactionByHash method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getTransactionCount', - params: [ - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - 'latest' - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getTransactionCount method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getTransactionCount', - params: [ - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - 'latest' - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getTransactionReceipt method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getTransactionReceipt', - params: [ - '0x4836db989f9072035586451ead35eb8a4ff5d2d4ce1996d7a550bdcb71a769f2' - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_getUncleCountByBlockHash method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - method: 'eth_getUncleCountByBlockHash', - params: [ - '0x829df9bb801fc0494abf2f443423a49ffa32964554db71b098d332d87b70a48b' - ], - id: 1, - jsonrpc: '2.0' - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBe(0); - }); - - it('eth_getUncleCountByBlockNumber method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - method: 'eth_getUncleCountByBlockNumber', - params: ['0xc5043f'], - id: 1, - jsonrpc: '2.0' - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBe(0); - }); - - it('eth_getUncleByBlockHashAndIndex method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getUncleByBlockHashAndIndex', - params: [ - '0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35', - '0x0' - ], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBeNull(); - }); - - it('eth_getUncleByBlockNumberAndIndex method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_getUncleByBlockNumberAndIndex', - params: ['latest', '0x0'], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBeNull(); - }); - - it('eth_requestAccounts method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_requestAccounts', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_sendRawTransaction method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_sendRawTransaction', - params: [ - '0xf86f81de8020dbda94435933c8064b4ae76be665428e0307ef2ccfbd68830f424080818082520880840165ec15c0b8411afd26e63bc79effbb4094c0181a14091f293044018f8b08911219d15fb2595563c5d436d036bfb5153b80fa3506fc5c5241474ec5ffc68ad7bfeb140ac5d12801' - ], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_sendTransaction method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_sendTransaction', - params: [ - { - from: '0xf077b491b355e64048ce21e3a6fc4751eeea77fa', - to: '0x435933c8064b4ae76be665428e0307ef2ccfbd68', - value: '0x111' - } - ], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_signTransaction method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_signTransaction', - params: [ - { - from: '0xf077b491b355e64048ce21e3a6fc4751eeea77fa', - to: '0x435933c8064b4ae76be665428e0307ef2ccfbd68', - value: '0x111' - } - ], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_signTypedDataV4 method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_signTypedData_v4', - params: [ - '0xf077b491b355e64048ce21e3a6fc4751eeea77fa', - { - domain: { - name: 'Ether Mail', - version: '1', - chainId: 1, - verifyingContract: - '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC' - }, - types: { - Person: [ - { - name: 'name', - type: 'string' - }, - { - name: 'wallet', - type: 'address' - } - ], - Mail: [ - { - name: 'from', - type: 'Person' - }, - { - name: 'to', - type: 'Person' - }, - { - name: 'contents', - type: 'string' - } - ] - }, - message: { - from: { - name: 'Cow', - wallet: '0xf077b491b355e64048ce21e3a6fc4751eeea77fa' - }, - to: { - name: 'Bob', - wallet: '0x435933c8064b4ae76be665428e0307ef2ccfbd68' - }, - contents: 'Hello, Bob!' - }, - primaryType: 'Mail' - } - ], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_subscribe method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_subscribe', - params: ['newHeads'], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_syncing method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_syncing', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('eth_unsubscribe method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'eth_unsubscribe', - params: ['0x9cef478923ff08bf67fde6c64013158d'], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('evm_mine method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'evm_mine', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toHaveProperty('hash'); - }); - - it('net_listening method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'net_listening', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('net_peerCount method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'net_peerCount', - params: [], - id: 1 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - }); - - it('net_version method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'net_version', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBe('0x186aa'); - }); - - it('txpool_content method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'txpool_content', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toStrictEqual({}); - }); - - it('txpool_contentFrom method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'txpool_contentFrom', - params: ['0x9431D1615FA755Faa25A74da7f34C8Bd6963bd0A'], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toStrictEqual({}); - }); - - it('txpool_inspect method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'txpool_inspect', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toStrictEqual({}); - }); - - it('txpool_status method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'txpool_status', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toStrictEqual({}); - }); - - it('web3_clientVersion method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'web3_clientVersion', - params: [], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBe('thor'); - }); - - it('web3_sha3 method call', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'web3_sha3', - params: ['0x68656c6c6f20776f726c64'], - id: 67 - }); - - expect(response.status).toBe(200); - - console.log(response.data); - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBe( - '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad' - ); - }); - }); - - const notImplementedMethods = [ - 'debug_getBadBlocks', - 'debug_getRawBlock', - 'debug_getRawHeader', - 'debug_getRawReceipts', - 'debug_getRawTransaction', - 'engine_exchangeCapabilities', - 'engine_exchangeTransitionConfigurationV1', - 'engine_forkchoiceUpdatedV1', - 'engine_forkchoiceUpdatedV2', - 'engine_forkchoiceUpdatedV3', - 'engine_getPayloadBodiesByHashV1', - 'engine_getPayloadBodiesByRangeV1', - 'engine_getPayloadV1', - 'engine_getPayloadV2', - 'engine_getPayloadV3', - 'engine_newPayloadV1', - 'engine_newPayloadV2', - 'engine_newPayloadV3', - 'eth_coinbase', - 'eth_createAccessList', - 'eth_feeHistory', - 'eth_getFilterChanges', - 'eth_getFilterLogs', - 'eth_getProof', - 'eth_getWork', - 'eth_hashrate', - 'eth_maxPriorityFeePerGas', - 'eth_mining', - 'eth_newBlockFilter', - 'eth_newFilter', - 'eth_newPendingTransactionFilter', - 'eth_protocolVersion', - 'eth_sign', - 'eth_submitWork', - 'eth_uninstallFilter', - 'parity_nextNonce' - ]; - - describe('should return: METHOD NOT IMPLEMENTED for', () => { - notImplementedMethods.forEach((method) => { - it(`${method} method call`, async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method, - params: [], - id: 1 - }); - - expect(response.status).toBe(200); - - expect(response.data).toHaveProperty('result'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.result).toBe('METHOD NOT IMPLEMENTED'); - }); - }); - }); - - describe('should fail for', () => { - it('non existing invalid method', async () => { - const response = await axios.post(RPC_PROXY_URL, { - jsonrpc: '2.0', - method: 'invalid_method', - params: [], - id: 1 - }); - - expect(response.status).toBe(200); - - expect(response.data).toHaveProperty('error'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.error.errorMessage).toBe( - 'Method not found. Invalid RPC method given as input.' - ); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(response.data.error.methodName).toBe( - 'VeChainProvider.request()' - ); - }); - }); -}); diff --git a/packages/rpc-proxy/tests/fixture.ts b/packages/rpc-proxy/tests/fixture.ts deleted file mode 100644 index 1e7529fe7..000000000 --- a/packages/rpc-proxy/tests/fixture.ts +++ /dev/null @@ -1,124 +0,0 @@ -import path from 'path'; - -/** - * Directory with the configuration files. - */ -const _configFilesDirectory = path.join(__dirname, 'config-files-fixtures'); - -/** - * Default configuration file fixture. - * This is the default configuration file. - */ -const correctConfigurationFilePathFixture = [ - path.join( - _configFilesDirectory, - 'correct-proxy-config-accounts-mnemonic.json' - ), - path.join( - _configFilesDirectory, - 'correct-proxy-config-accounts-list-of-private-keys.json' - ), - path.join( - _configFilesDirectory, - 'correct-proxy-config-delegator-private-key.json' - ), - path.join(_configFilesDirectory, 'correct-proxy-config-delegator-url.json') -]; - -/** - * Invalid configuration file fixture. - * This is an invalid JSON configuration file. - */ -const invalidJSONConfigurationFilePathFixture = path.join( - _configFilesDirectory, - 'invalid-json-format-proxy-config' -); - -/** - * Invalid parameters configuration file fixtures. - */ -const invalidParametersConfigurationFilePathFixture = { - 'invalid-port': [ - path.join( - _configFilesDirectory, - 'invalid-port-proxy-config-negative-number.json' - ), - path.join( - _configFilesDirectory, - 'invalid-port-proxy-config-non-integer.json' - ) - ], - 'invalid-url': [ - path.join(_configFilesDirectory, 'invalid-url-proxy-config.json') - ], - 'invalid-accounts': [ - path.join( - _configFilesDirectory, - 'invalid-accounts-list-of-private-keys-proxy-config-1.json' - ), - path.join( - _configFilesDirectory, - 'invalid-accounts-list-of-private-keys-proxy-config-2.json' - ), - path.join( - _configFilesDirectory, - 'invalid-accounts-mnemonics-proxy-config-1.json' - ), - path.join( - _configFilesDirectory, - 'invalid-accounts-mnemonics-proxy-config-2.json' - ), - path.join( - _configFilesDirectory, - 'invalid-accounts-mnemonics-proxy-config-3.json' - ), - path.join( - _configFilesDirectory, - 'invalid-accounts-mnemonics-proxy-config-4.json' - ), - path.join( - _configFilesDirectory, - 'invalid-accounts-mnemonics-proxy-config-5.json' - ) - ], - 'invalid-delegator': [ - path.join( - _configFilesDirectory, - 'invalid-delegator-proxy-config-1.json' - ), - path.join( - _configFilesDirectory, - 'invalid-delegator-proxy-config-2.json' - ), - path.join( - _configFilesDirectory, - 'invalid-delegator-proxy-config-3.json' - ) - ], - 'invalid-verbose': [ - path.join( - _configFilesDirectory, - 'invalid-verbose-flag-proxy-config-1.json' - ) - ], - 'invalid-enable-delegation': [ - path.join( - _configFilesDirectory, - 'invalid-enable-delegation-proxy-config-1.json' - ) - ] -}; - -/** - * Invalid semantic configuration file fixtures. - */ -const invalidSemanticConfigurationFilePathFixture = [ - path.join(_configFilesDirectory, 'invalid-semantic-proxy-config-1.json') -]; - -export { - correctConfigurationFilePathFixture, - invalidJSONConfigurationFilePathFixture, - invalidParametersConfigurationFilePathFixture, - invalidSemanticConfigurationFilePathFixture -}; 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 deleted file mode 100644 index 3b03968c8..000000000 --- a/packages/rpc-proxy/tests/utils/args/args-options.unit.test.ts +++ /dev/null @@ -1,220 +0,0 @@ -import { describe, test } from '@jest/globals'; -import { getOptionsFromCommandLine } from '../../../src/utils'; - -/** - * Args options tests - * @group unit/utils/args-options - */ -describe('Args options tests', () => { - /** - * Parse command line arguments - */ - describe('Get options with command line arguments', () => { - /** - * Should be able to parse the port option - */ - test('Should be able to parse the port option', () => { - [ - // Normal syntax - ['path', 'program', '--port', '10'], - // Short syntax - ['path', 'program', '-p', '10'] - ].forEach((args) => { - const portOption = getOptionsFromCommandLine('1.0.0', args); - - expect(portOption).toBeDefined(); - expect(portOption.port).toBe('10'); - }); - }); - - /** - * Should be able to parse the url option - */ - test('Should be able to parse the url option', () => { - [ - // Normal syntax - ['path', 'program', '--url', 'http://localhost:8080'], - // Short syntax - ['path', 'program', '-u', 'http://localhost:8080'] - ].forEach((args) => { - const urlOption = getOptionsFromCommandLine('1.0.0', args); - - expect(urlOption).toBeDefined(); - expect(urlOption.url).toBe('http://localhost:8080'); - }); - }); - - /** - * Should be able to parse the verbose option - */ - test('Should be able to parse the verbose option', () => { - [ - // Normal syntax - ['path', 'program', '--verbose'], - // Short syntax - ['path', 'program', '-v'] - ].forEach((args) => { - const verboseOption = getOptionsFromCommandLine('1.0.0', args); - - expect(verboseOption).toBeDefined(); - expect(verboseOption.verbose).toBe(true); - }); - }); - - /** - * Should be able to parse the account option (as a list of private keys) - */ - test('Should be able to parse the account option', () => { - [ - // Normal syntax - [ - 'path', - 'program', - '--accounts', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], - // Short syntax - [ - 'path', - 'program', - '-a', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ] - ].forEach((args) => { - const accountOption = getOptionsFromCommandLine('1.0.0', args); - - expect(accountOption).toBeDefined(); - expect(accountOption.accounts).toEqual( - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ); - }); - }); - - /** - * Should be able to parse the mnemonic options - * (mnemonic, mnemonicIndex, mnemonicCount) - */ - test('Should be able to parse the mnemonic options', () => { - [ - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '2' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '2' - ] - ].forEach((args) => { - const mnemonicOption = getOptionsFromCommandLine('1.0.0', args); - - expect(mnemonicOption).toBeDefined(); - expect(mnemonicOption.mnemonic).toBe( - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse' - ); - expect(mnemonicOption.mnemonicInitialIndex).toBe('1'); - expect(mnemonicOption.mnemonicCount).toBe('2'); - }); - }); - - /** - * Should be able to parse the enable delegation option - */ - test('Should be able to parse the enable delegation option', () => { - [ - // Normal syntax - ['path', 'program', '--enableDelegation'], - // Short syntax - ['path', 'program', '-e'] - ].forEach((args) => { - const enableDelegationOption = getOptionsFromCommandLine( - '1.0.0', - args - ); - - expect(enableDelegationOption).toBeDefined(); - expect(enableDelegationOption.enableDelegation).toBe(true); - }); - }); - - /** - * Should be able to parse the delegator private key option - */ - test('Should be able to parse the delegator private key option', () => { - [ - // Normal syntax - [ - 'path', - 'program', - '--delegatorPrivateKey', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ] - ].forEach((args) => { - const delegatorPrivateKeyOption = getOptionsFromCommandLine( - '1.0.0', - args - ); - - expect(delegatorPrivateKeyOption).toBeDefined(); - expect(delegatorPrivateKeyOption.delegatorPrivateKey).toBe( - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ); - }); - }); - - /** - * Should be able to parse the delegator URL option - */ - test('Should be able to parse the delegator URL option', () => { - [ - // Normal syntax - ['path', 'program', '--delegatorUrl', 'http://localhost:8080'], - // Short syntax - ['path', 'program', '-d', 'http://localhost:8080'] - ].forEach((args) => { - const delegatorUrlOption = getOptionsFromCommandLine( - '1.0.0', - args - ); - - expect(delegatorUrlOption).toBeDefined(); - expect(delegatorUrlOption.delegatorUrl).toBe( - 'http://localhost:8080' - ); - }); - }); - - /** - * Should be able to parse the configuration file option - */ - test('Should be able to parse the configuration file option', () => { - [ - // Normal syntax - ['path', 'program', '--configurationFile', 'config.json'], - // Short syntax - ['path', 'program', '-c', 'config.json'] - ].forEach((args) => { - const configFileOption = getOptionsFromCommandLine( - '1.0.0', - args - ); - - expect(configFileOption).toBeDefined(); - expect(configFileOption.configurationFile).toBe('config.json'); - }); - }); - }); -}); 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 deleted file mode 100644 index ebf4860d9..000000000 --- a/packages/rpc-proxy/tests/utils/args/args-parser.unit.test.ts +++ /dev/null @@ -1,669 +0,0 @@ -import { describe, test } from '@jest/globals'; -import { - getConfigObjectFromFile, - getOptionsFromCommandLine, - parseAndGetFinalConfig -} from '../../../src/utils'; -import { correctConfigurationFilePathFixture } from '../../fixture'; -import { - InvalidCommandLineArguments, - InvalidConfigurationFilePath -} from '@vechain/sdk-errors'; - -/** - * Args options tests - * @group unit/utils/args-parser - */ -describe('Args parser tests', () => { - /** - * Default configuration - */ - const defaultConfiguration = getConfigObjectFromFile( - correctConfigurationFilePathFixture[0] - ); - - /** - * Parse command line arguments AND get the configuration - positive test cases - */ - describe('Parse command line arguments AND get the configuration - positive cases', () => { - /** - * Should be able to parse empty command line arguments (default configuration) AND get the configuration - */ - test('Should be able to parse empty command line arguments AND get the configuration', () => { - const options = getOptionsFromCommandLine('1.0.0', [ - 'path', - 'program' - ]); - - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - expect(configuration).toEqual(defaultConfiguration); - }); - - /** - * Should be able to parse the port option from command line arguments AND get the configuration - */ - test('Should be able to get the port from command lime arguments AND get the configuration', () => { - [ - // Normal syntax - ['path', 'program', '--port', '10'], - // Short syntax - ['path', 'program', '-p', '10'] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Get the configuration - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - expect(configuration.port).toBe(10); - }); - }); - - /** - * Should be able to parse the url option from command line arguments AND get the configuration - */ - test('Should be able to get the url from command line arguments AND get the configuration', () => { - [ - // Normal syntax - ['path', 'program', '--url', 'http://localhost:8080'], - // Short syntax - ['path', 'program', '-u', 'http://localhost:8080'] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Get the configuration - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - expect(configuration.url).toBe('http://localhost:8080'); - }); - }); - - /** - * Should be able to parse the verbose option from command line arguments AND get the configuration - */ - test('Should be able to get the verbose option from command line arguments AND get the configuration', () => { - [ - // Normal syntax - ['path', 'program', '--verbose'], - // Short syntax - ['path', 'program', '-v'] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Get the configuration - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - expect(configuration.verbose).toBe(true); - }); - }); - - /** - * Should be able to parse the accounts (as a list of private keys) option from command line arguments AND get the configuration - */ - test('Should be able to get the accounts from command line arguments AND get the configuration', () => { - [ - // Normal syntax - [ - 'path', - 'program', - '--accounts', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], - // Short syntax - [ - 'path', - 'program', - '-a', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // // Get the configuration - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - - expect(configuration.accounts).toEqual([ - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ]); - }); - }); - - /** - * Should be able to parse the mnemonic field from command line arguments AND get the configuration - */ - test('Should be able to get the mnemonic field from command line arguments AND get the configuration', () => { - [ - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '2' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '2' - ] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Get the configuration - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - - console.log(configuration); - }); - }); - - /** - * Should be able to parse the enableDelegation option from command line arguments AND get the configuration - */ - test('Should be able to get the enableDelegation option from command line arguments AND get the configuration', () => { - [ - // Normal syntax - [ - 'path', - 'program', - '--enableDelegation', - '--delegatorPrivateKey', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], - // Short syntax - [ - 'path', - 'program', - '-e', - '--delegatorPrivateKey', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Get the configuration - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - expect(configuration.enableDelegation).toBe(true); - }); - }); - - /** - * Should be able to delegation options from command line arguments (delegatorPrivateKey and delegatorUrl fields) AND get the configuration - */ - test('Should be able to get the delegation options from command line arguments AND get the configuration', () => { - [ - // Delegator private key - - // Normal syntax - [ - 'path', - 'program', - '--delegatorPrivateKey', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ], - - // Delegator URL - - // Normal syntax - ['path', 'program', '--delegatorUrl', 'http://localhost:8080'], - // Short syntax - ['path', 'program', '-d', 'http://localhost:8080'] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Get the configuration - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - expect(configuration).toBeDefined(); - }); - }); - - /** - * Should be able to parse the configuration file option from command line arguments AND get the configuration - */ - test('Should be able to get the configuration file from command line arguments AND get the configuration', () => { - [ - // Normal syntax - [ - 'path', - 'program', - '--configurationFile', - `${correctConfigurationFilePathFixture[0]}` - ], - // Short syntax - [ - 'path', - 'program', - '-c', - `${correctConfigurationFilePathFixture[0]}` - ] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // // Get the configuration - const configuration = parseAndGetFinalConfig( - options, - defaultConfiguration - ); - expect(configuration).toEqual( - getConfigObjectFromFile( - correctConfigurationFilePathFixture[0] - ) - ); - }); - }); - }); - - /** - * Parse command line arguments AND get the configuration - negative test cases - */ - describe('Parse command line arguments AND get the configuration - negative cases', () => { - /** - * Should NOT be able to parse an invalid port option from command line arguments AND get the configuration - */ - test('Should NOT be able to parse an invalid port option from command line arguments AND get the configuration', () => { - [ - // Normal syntax - ['path', 'program', '--port', '-1'], - // Short syntax - ['path', 'program', '-p', '-1'], - // Normal syntax - ['path', 'program', '--port', 'INVALID'], - // Short syntax - ['path', 'program', '-p', 'INVALID'], - // Normal syntax - ['path', 'program', '--port', ''], - // Short syntax - ['path', 'program', '-p', ''] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Throw the error - expect(() => - parseAndGetFinalConfig(options, defaultConfiguration) - ).toThrow(InvalidCommandLineArguments); - }); - }); - - /** - * Should NOT be able to parse the url option from command line arguments AND get the configuration - */ - test('Should be NOT able to parse an invalid url from command line arguments AND get the configuration', () => { - [ - // Normal syntax - ['path', 'program', '--url', 'INVALID'], - // Short syntax - ['path', 'program', '-u', 'INVALID'], - // Normal syntax - ['path', 'program', '--url', ''], - // Short syntax - ['path', 'program', '-u', ''] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Throw the error - expect(() => - parseAndGetFinalConfig(options, defaultConfiguration) - ).toThrow(InvalidCommandLineArguments); - }); - }); - - /** - * Should NOT be able to parse the accounts (as a list of private keys) option from command line arguments AND get the configuration - */ - test('Should be NOT able to parse an invalid accounts from command line arguments AND get the configuration', () => { - [ - // Normal syntax - ['path', 'program', '--accounts', `INVALID`], - // Short syntax - ['path', 'program', '-a', `INVALID`], - // Normal syntax - [ - 'path', - 'program', - '--accounts', - `8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 INVALID` - ], - // Short syntax - [ - 'path', - 'program', - '-a', - `8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158 INVALID` - ], - // Normal syntax - ['path', 'program', '--accounts', ''], - // Short syntax - ['path', 'program', '-a', ''] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Throw the error - expect(() => - parseAndGetFinalConfig(options, defaultConfiguration) - ).toThrow(InvalidCommandLineArguments); - }); - }); - - /** - * Should NOT be able to parse mnemonic fields from command line arguments AND get the configuration - * All edge cases (invalid mnemonic, invalid initial index, invalid count OR missing mnemonic, missing initial index, missing count) - */ - test('Should be NOT able to parse invalid mnemonic fields from command line arguments AND get the configuration', () => { - [ - // Missing fields - - // 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', - '--mnemonicInitialIndex', - '1' - ], - - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse' - ], - - // Normal syntax - ['path', 'program', '--mnemonicInitialIndex', '1'], - - // Wrong format - - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'INVALID', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '2' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'INVALID', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '2' - ], - - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '-1', - '--mnemonicCount', - '2' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '-1', - '--mnemonicCount', - '2' - ], - - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '-2' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '-2' - ], - - // Empty fields - - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - '', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '2' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - '', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '2' - ], - - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '', - '--mnemonicCount', - '2' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '', - '--mnemonicCount', - '2' - ], - - // Normal syntax - [ - 'path', - 'program', - '--mnemonic', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '' - ], - // Short syntax - [ - 'path', - 'program', - '-m', - 'expire pair material agent north ostrich fortune level cousin snow mixture nurse', - '--mnemonicInitialIndex', - '1', - '--mnemonicCount', - '' - ] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Throw the error - expect(() => - parseAndGetFinalConfig(options, defaultConfiguration) - ).toThrow(InvalidCommandLineArguments); - }); - }); - - /** - * Should NOT be able to parse delegation options from command line arguments (delegatorPrivateKey and delegatorUrl fields) AND get the configuration - */ - test('Should be NOT able to parse delegation options from command line arguments AND get the configuration', () => { - [ - // Both delegation fields are provided - - // Normal syntax - [ - 'path', - 'program', - '--delegatorPrivateKey', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - '--delegatorUrl', - 'http://localhost:8080' - ], - // Short syntax - [ - 'path', - 'program', - '--delegatorPrivateKey', - '8f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - '-d', - 'http://localhost:8080' - ], - - // Invalid fields - - // Normal syntax - ['path', 'program', '--delegatorPrivateKey', 'INVALID'], - - // Normal syntax - ['path', 'program', '--delegatorUrl', 'INVALID'], - // Short syntax - ['path', 'program', '-d', 'INVALID'], - - // Empty fields - - // Normal syntax - ['path', 'program', '--delegatorPrivateKey', ''], - - // Normal syntax - ['path', 'program', '--delegatorUrl', ''], - // Short syntax - ['path', 'program', '-d', ''], - - // Enable delegation without the delegator - - // Normal syntax - ['path', 'program', '--enableDelegation'] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Throw the error - expect(() => - parseAndGetFinalConfig(options, defaultConfiguration) - ).toThrow(InvalidCommandLineArguments); - }); - }); - - /** - * Should NOT be able to parse the configuration file option from command line arguments AND get the configuration - */ - test('Should be NOT able to parse an invalid configuration file from command line arguments AND get the configuration', () => { - [ - // Normal syntax - ['path', 'program', '--configurationFile', `INVALID`], - // Short syntax - ['path', 'program', '-c', `INVALID`], - // Normal syntax - ['path', 'program', '--configurationFile', ''], - // Short syntax - ['path', 'program', '-c', ''] - ].forEach((args) => { - // Get options - const options = getOptionsFromCommandLine('1.0.0', args); - - // Throw the error - expect(() => - parseAndGetFinalConfig(options, defaultConfiguration) - ).toThrow(InvalidConfigurationFilePath); - }); - }); - }); -}); diff --git a/packages/rpc-proxy/tests/utils/args/env-to-args-negative-cases.unit.test.ts b/packages/rpc-proxy/tests/utils/args/env-to-args-negative-cases.unit.test.ts deleted file mode 100644 index 11dac0c87..000000000 --- a/packages/rpc-proxy/tests/utils/args/env-to-args-negative-cases.unit.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, test } from '@jest/globals'; -import { getArgsFromEnv } from '../../../src/utils'; - -/** - * Environment variables to command line arguments negative cases tests - * @group unit/utils/env-to-args-negative-cases - */ -describe('Environment variables to command line arguments negative cases', () => { - /** - * Convert environment variables to command line arguments - */ - describe('Convert environment variables to command line arguments', () => { - /** - * Should be able to convert environment variables to command line arguments - */ - test('Should be able to convert environment variables to command line arguments', () => { - const args = getArgsFromEnv(); - - expect(args).toEqual(['node', 'dist/index.js']); - }); - }); -}); 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 deleted file mode 100644 index b0419b38a..000000000 --- a/packages/rpc-proxy/tests/utils/args/env-to-args-positive-cases.unit.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { describe, test } from '@jest/globals'; -import { getArgsFromEnv } from '../../../src/utils'; - -/** - * Environment variables to command line arguments positive cases tests - * @group unit/utils/env-to-args-positive-cases - */ -describe('Environment variables to command line arguments positive cases', () => { - /** - * Set up the environment variables - */ - beforeAll(() => { - process.env.URL = 'http://localhost:8669'; - process.env.PORT = '8669'; - process.env.ACCOUNTS = 'some accounts'; - process.env.MNEMONIC = 'some mnemonic'; - process.env.MNEMONIC_COUNT = '10'; - process.env.MNEMONIC_INITIAL_INDEX = '0'; - process.env.ENABLE_DELEGATION = 'true'; - process.env.DELEGATOR_PRIVATE_KEY = '0x1234567890abcdef'; - process.env.DELEGATOR_URL = 'http://localhost:8669'; - process.env.VERBOSE = 'true'; - process.env.CONFIGURATION_FILE = 'config.json'; - }); - - /** - * Convert environment variables to command line arguments - */ - describe('Convert environment variables to command line arguments', () => { - /** - * Should be able to convert environment variables to command line arguments - */ - test('Should be able to convert environment variables to command line arguments', () => { - const args = getArgsFromEnv(); - - expect(args).toEqual([ - 'node', - 'dist/index.js', - '-u', - 'http://localhost:8669', - '-p', - '8669', - '-a', - 'some accounts', - '-m', - 'some mnemonic', - '--mnemonicCount', - '10', - '--mnemonicInitialIndex', - '0', - '-e', - 'true', - '--delegatorPrivateKey', - '0x1234567890abcdef', - '-d', - 'http://localhost:8669', - '-v', - 'true', - '-c', - 'config.json' - ]); - }); - }); -}); diff --git a/packages/rpc-proxy/tests/utils/config-validator/config-validator.unit.test.ts b/packages/rpc-proxy/tests/utils/config-validator/config-validator.unit.test.ts deleted file mode 100644 index ac446ae3c..000000000 --- a/packages/rpc-proxy/tests/utils/config-validator/config-validator.unit.test.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { describe, test } from '@jest/globals'; -import { - checkValidConfigurationFile, - getConfigObjectFromFile -} from '../../../src/utils'; -import { - correctConfigurationFilePathFixture, - invalidJSONConfigurationFilePathFixture, - invalidParametersConfigurationFilePathFixture, - invalidSemanticConfigurationFilePathFixture -} from '../../fixture'; -import { - InvalidConfigurationFile, - InvalidConfigurationFilePath -} from '@vechain/sdk-errors'; - -/** - * Config validator tests - * @group unit/utils/config-validator - */ -describe('Configuration file validator', () => { - /** - * Validation of configuration file positive cases - */ - describe('configurationFile - correct cases', () => { - /** - * Should be able to parse valid configuration files - */ - test('Should be able to parse valid configuration files', () => { - correctConfigurationFilePathFixture.forEach((filePath) => { - expect(() => { - checkValidConfigurationFile(filePath); - }).not.toThrow(); - }); - }); - - /** - * Should be able to load configuration files - */ - test('Should be able to load configuration files', () => { - correctConfigurationFilePathFixture.forEach((filePath) => { - const config = getConfigObjectFromFile(filePath); - expect(config).toBeDefined(); - - // Check the properties - expect(config.url).toBeDefined(); - expect(config.port).toBeDefined(); - expect(config.accounts).toBeDefined(); - }); - }); - }); - - /** - * Validation of configuration file negative cases - */ - describe('configurationFile - negative cases', () => { - /** - * Should not be able to parse a file that does not exist - */ - test('Should not be able to parse a file that does not exist', () => { - expect(() => { - checkValidConfigurationFile('INVALID'); - }).toThrow(InvalidConfigurationFilePath); - }); - - /** - * Should not be able to parse an invalid JSON file - */ - test('Should not be able to parse an invalid JSON file', () => { - expect(() => { - checkValidConfigurationFile( - invalidJSONConfigurationFilePathFixture - ); - }).toThrow(InvalidConfigurationFile); - }); - - /** - * Invalid configuration parameters - */ - describe('Invalid configuration parameters', () => { - /** - * Should not be able to parse a configuration file with an invalid port - */ - test('Should not be able to parse a configuration file with an invalid port', () => { - invalidParametersConfigurationFilePathFixture[ - 'invalid-port' - ].forEach((filePath) => { - expect(() => { - checkValidConfigurationFile(filePath); - }).toThrow(InvalidConfigurationFile); - }); - }); - - /** - * Should not be able to parse a configuration file with an invalid URL - */ - test('Should not be able to parse a configuration file with an invalid URL', () => { - invalidParametersConfigurationFilePathFixture[ - 'invalid-url' - ].forEach((filePath) => { - expect(() => { - checkValidConfigurationFile(filePath); - }).toThrow(InvalidConfigurationFile); - }); - }); - - /** - * Should not be able to parse a configuration file with invalid accounts - */ - test('Should not be able to parse a configuration file with invalid accounts', () => { - invalidParametersConfigurationFilePathFixture[ - 'invalid-accounts' - ].forEach((filePath) => { - expect(() => { - checkValidConfigurationFile(filePath); - }).toThrow(InvalidConfigurationFile); - }); - }); - - /** - * Should not be able to parse a configuration file with invalid delegator - */ - test('Should not be able to parse a configuration file with invalid delegator', () => { - invalidParametersConfigurationFilePathFixture[ - 'invalid-delegator' - ].forEach((filePath) => { - expect(() => { - checkValidConfigurationFile(filePath); - }).toThrow(InvalidConfigurationFile); - }); - }); - - /** - * Should not be able to parse a configuration file with invalid verbose - */ - test('Should not be able to parse a configuration file with invalid verbose', () => { - invalidParametersConfigurationFilePathFixture[ - 'invalid-verbose' - ].forEach((filePath) => { - expect(() => { - checkValidConfigurationFile(filePath); - }).toThrow(InvalidConfigurationFile); - }); - }); - - /** - * Should not be able to parse a configuration file with invalid enableDelegation - */ - test('Should not be able to parse a configuration file with invalid enableDelegation', () => { - invalidParametersConfigurationFilePathFixture[ - 'invalid-enable-delegation' - ].forEach((filePath) => { - expect(() => { - checkValidConfigurationFile(filePath); - }).toThrow(InvalidConfigurationFile); - }); - }); - }); - - /** - * Should not be able to parse a configuration file with invalid semantic - */ - test('Should not be able to parse a configuration file with invalid semantic', () => { - invalidSemanticConfigurationFilePathFixture.forEach((filePath) => { - expect(() => { - checkValidConfigurationFile(filePath); - }).toThrow(InvalidConfigurationFile); - }); - }); - }); -}); diff --git a/packages/rpc-proxy/tsconfig.json b/packages/rpc-proxy/tsconfig.json deleted file mode 100644 index 98e4070be..000000000 --- a/packages/rpc-proxy/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./dist", - "strict": true, - "target": "es2020", - "module": "commonjs", - "sourceMap": true, - "esModuleInterop": true, - "resolveJsonModule": true, - "moduleResolution": "node" - }, - "include": [ - "./src/**/*.ts", - "./tests/**/*.ts" - ] -} \ No newline at end of file From c41d92eccb4c653652ccb3cf034179714b8c7218 Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 18:44:11 +0000 Subject: [PATCH 11/15] refactor: 1886 module removed --- .changeset/funny-masks-cheat.md | 8 - .changeset/pre.json | 3 +- .github/workflows/publish-sdk.yml | 8 - .github/workflows/unit-integration-test.yml | 3 +- packages/core/README.md | 19 - packages/core/eslint.config.mjs | 3 +- .../transaction/Transaction.unit.test.ts | 2 +- .../tests/vcdm/account/Account.unit.test.ts | 1 + .../tests/vcdm/currency/Coin.unit.test.ts | 2 +- .../tests/vcdm/currency/Units.unit.test.ts | 2 +- .../core/tests/vcdm/currency/VET.unit.test.ts | 2 +- .../tests/vcdm/currency/VTHO.unit.test.ts | 2 +- packages/errors/eslint.config.mjs | 3 +- packages/logging/eslint.config.mjs | 3 +- packages/network/README.md | 38 - packages/network/eslint.config.mjs | 21 - packages/network/jest.browser-setup.js | 18 - packages/network/jest.config.browser.js | 10 - packages/network/jest.config.js | 23 - packages/network/package.json | 60 - .../network/solo-seeding/TestingContract.sol | 337 -- .../builtin-contracts/authority.sol | 28 - .../builtin-contracts/builtin.sol | 146 - .../solo-seeding/builtin-contracts/energy.sol | 47 - .../builtin-contracts/executor.sol | 38 - .../builtin-contracts/extension.sol | 29 - .../solo-seeding/builtin-contracts/params.sol | 13 - .../builtin-contracts/prototype.sol | 79 - packages/network/src/http/HttpClient.ts | 47 - packages/network/src/http/HttpMethod.ts | 10 - packages/network/src/http/HttpParams.ts | 29 - packages/network/src/http/SimpleHttpClient.ts | 155 - packages/network/src/http/index.ts | 4 - packages/network/src/index.ts | 5 - packages/network/src/network.ts | 5 - .../network/src/provider/eip1193/index.ts | 1 - .../network/src/provider/eip1193/types.d.ts | 28 - .../network/src/provider/helpers/index.ts | 1 - .../abstract-provider-internal-wallet.ts | 175 - .../abstract-wallet/index.ts | 1 - .../base-wallet/index.ts | 1 - .../provider-internal-base-wallet.ts | 64 - .../hd-wallet/index.ts | 1 - .../hd-wallet/provider-internal-hd-wallet.ts | 71 - .../provider-internal-wallets/index.ts | 3 - .../provider-internal-wallets/types.d.ts | 132 - packages/network/src/provider/index.ts | 4 - .../providers/ethers-provider/index.ts | 1 - .../json-rpc-ethers-provider.ts | 100 - .../hardhat-provider/hardhat-provider.ts | 198 - .../providers/hardhat-provider/index.ts | 2 - .../providers/hardhat-provider/types.d.ts | 47 - .../network/src/provider/providers/index.ts | 3 - .../providers/vechain-provider/index.ts | 2 - .../providers/vechain-provider/types.d.ts | 107 - .../vechain-provider/vechain-provider.ts | 302 -- .../src/provider/utils/const/blocks/blocks.ts | 46 - .../src/provider/utils/const/blocks/index.ts | 1 - .../provider/utils/const/chain-id/chain-id.ts | 11 - .../provider/utils/const/chain-id/index.ts | 1 - .../network/src/provider/utils/const/index.ts | 4 - .../provider/utils/const/providers/const.ts | 6 - .../provider/utils/const/providers/index.ts | 1 - .../provider/utils/const/rpc-mapper/index.ts | 1 - .../utils/const/rpc-mapper/rpc-methods.ts | 100 - .../utils/formatter/blocks/formatter.ts | 62 - .../provider/utils/formatter/blocks/index.ts | 4 - .../utils/formatter/blocks/types.d.ts | 102 - .../utils/formatter/debug/formatter.ts | 49 - .../provider/utils/formatter/debug/index.ts | 8 - .../provider/utils/formatter/debug/types.d.ts | 58 - .../src/provider/utils/formatter/index.ts | 4 - .../utils/formatter/logs/formatter.ts | 161 - .../provider/utils/formatter/logs/index.ts | 2 - .../provider/utils/formatter/logs/types.d.ts | 51 - .../utils/formatter/transactions/formatter.ts | 199 - .../utils/formatter/transactions/index.ts | 13 - .../utils/formatter/transactions/types.d.ts | 201 - .../src/provider/utils/helpers/index.ts | 1 - .../utils/helpers/transaction/index.ts | 1 - .../transaction/transaction-helpers.ts | 78 - packages/network/src/provider/utils/index.ts | 4 - .../src/provider/utils/rpc-mapper/index.ts | 3 - .../debug_getBadBlocks/debug_getBadBlocks.ts | 24 - .../methods/debug_getBadBlocks/index.ts | 1 - .../debug_getRawBlock/debug_getRawBlock.ts | 24 - .../methods/debug_getRawBlock/index.ts | 1 - .../debug_getRawHeader/debug_getRawHeader.ts | 24 - .../methods/debug_getRawHeader/index.ts | 1 - .../debug_getRawReceipts.ts | 26 - .../methods/debug_getRawReceipts/index.ts | 1 - .../debug_getRawTransaction.ts | 26 - .../methods/debug_getRawTransaction/index.ts | 1 - .../debug_traceBlockByHash.ts | 98 - .../methods/debug_traceBlockByHash/index.ts | 1 - .../debug_traceBlockByNumber.ts | 99 - .../methods/debug_traceBlockByNumber/index.ts | 1 - .../debug_traceCall/debug_traceCall.ts | 103 - .../methods/debug_traceCall/index.ts | 1 - .../methods/debug_traceCall/types.d.ts | 19 - .../debug_traceTransaction.ts | 101 - .../methods/debug_traceTransaction/index.ts | 2 - .../methods/debug_traceTransaction/types.d.ts | 11 - .../engine_exchangeCapabilities.ts | 27 - .../engine_exchangeCapabilities/index.ts | 1 - ...ngine_exchangeTransitionConfigurationV1.ts | 27 - .../index.ts | 1 - .../engine_forkchoiceUpdatedV1.ts | 27 - .../engine_forkchoiceUpdatedV1/index.ts | 1 - .../engine_forkchoiceUpdatedV2.ts | 27 - .../engine_forkchoiceUpdatedV2/index.ts | 1 - .../engine_forkchoiceUpdatedV3.ts | 27 - .../engine_forkchoiceUpdatedV3/index.ts | 1 - .../engine_getPayloadBodiesByHashV1.ts | 27 - .../engine_getPayloadBodiesByHashV1/index.ts | 1 - .../engine_getPayloadBodiesByRangeV1.ts | 27 - .../engine_getPayloadBodiesByRangeV1/index.ts | 1 - .../engine_getPayloadV1.ts | 24 - .../methods/engine_getPayloadV1/index.ts | 1 - .../engine_getPayloadV2.ts | 24 - .../methods/engine_getPayloadV2/index.ts | 1 - .../engine_getPayloadV3.ts | 24 - .../methods/engine_getPayloadV3/index.ts | 1 - .../engine_newPayloadV1.ts | 24 - .../methods/engine_newPayloadV1/index.ts | 1 - .../engine_newPayloadV2.ts | 24 - .../methods/engine_newPayloadV2/index.ts | 1 - .../engine_newPayloadV3.ts | 24 - .../methods/engine_newPayloadV3/index.ts | 1 - .../methods/eth_accounts/eth_accounts.ts | 17 - .../rpc-mapper/methods/eth_accounts/index.ts | 1 - .../eth_blockNumber/eth_blockNumber.ts | 33 - .../methods/eth_blockNumber/index.ts | 1 - .../rpc-mapper/methods/eth_call/eth_call.ts | 82 - .../rpc-mapper/methods/eth_call/index.ts | 1 - .../rpc-mapper/methods/eth_call/types.d.ts | 11 - .../methods/eth_chainId/eth_chainId.ts | 52 - .../rpc-mapper/methods/eth_chainId/index.ts | 1 - .../methods/eth_coinbase/eth_coinbase.ts | 24 - .../rpc-mapper/methods/eth_coinbase/index.ts | 1 - .../eth_createAccessList.ts | 26 - .../methods/eth_createAccessList/index.ts | 1 - .../eth_estimateGas/eth_estimateGas.ts | 82 - .../methods/eth_estimateGas/index.ts | 1 - .../methods/eth_estimateGas/types.d.ts | 11 - .../methods/eth_feeHistory/eth_feeHistory.ts | 24 - .../methods/eth_feeHistory/index.ts | 1 - .../methods/eth_gasPrice/eth_gasPrice.ts | 16 - .../rpc-mapper/methods/eth_gasPrice/index.ts | 1 - .../methods/eth_getBalance/eth_getBalance.ts | 67 - .../methods/eth_getBalance/index.ts | 1 - .../eth_getBlockByHash/eth_getBlockByHash.ts | 57 - .../methods/eth_getBlockByHash/index.ts | 1 - .../eth_getBlockByNumber.ts | 78 - .../methods/eth_getBlockByNumber/index.ts | 1 - .../eth_getBlockReceipts.ts | 81 - .../methods/eth_getBlockReceipts/index.ts | 1 - .../eth_getBlockTransactionCountByHash.ts | 39 - .../index.ts | 1 - .../eth_getBlockTransactionCountByNumber.ts | 34 - .../index.ts | 1 - .../methods/eth_getCode/eth_getCode.ts | 66 - .../rpc-mapper/methods/eth_getCode/index.ts | 1 - .../eth_getFilterChanges.ts | 28 - .../methods/eth_getFilterChanges/index.ts | 1 - .../eth_getFilterLogs/eth_getFilterLogs.ts | 26 - .../methods/eth_getFilterLogs/index.ts | 1 - .../methods/eth_getLogs/eth_getLogs.ts | 105 - .../rpc-mapper/methods/eth_getLogs/index.ts | 1 - .../methods/eth_getProof/eth_getProof.ts | 26 - .../rpc-mapper/methods/eth_getProof/index.ts | 1 - .../eth_getStorageAt/eth_getStorageAt.ts | 73 - .../methods/eth_getStorageAt/index.ts | 1 - .../eth_getTransactionByBlockHashAndIndex.ts | 71 - .../index.ts | 1 - ...eth_getTransactionByBlockNumberAndIndex.ts | 71 - .../index.ts | 1 - .../eth_getTransactionByHash.ts | 72 - .../methods/eth_getTransactionByHash/index.ts | 1 - .../eth_getTransactionCount.ts | 44 - .../methods/eth_getTransactionCount/index.ts | 1 - .../eth_getTransactionReceipt.ts | 100 - .../eth_getTransactionReceipt/index.ts | 1 - .../eth_getUncleByBlockHashAndIndex.ts | 39 - .../eth_getUncleByBlockHashAndIndex/index.ts | 1 - .../eth_getUncleByBlockNumberAndIndex.ts | 38 - .../index.ts | 1 - .../eth_getUncleCountByBlockHash.ts | 29 - .../eth_getUncleCountByBlockHash/index.ts | 1 - .../eth_getUncleCountByBlockNumber.ts | 24 - .../eth_getUncleCountByBlockNumber/index.ts | 1 - .../methods/eth_getWork/eth_getWork.ts | 26 - .../rpc-mapper/methods/eth_getWork/index.ts | 1 - .../methods/eth_hashrate/eth_hashrate.ts | 24 - .../rpc-mapper/methods/eth_hashrate/index.ts | 1 - .../eth_maxPriorityFeePerGas.ts | 26 - .../methods/eth_maxPriorityFeePerGas/index.ts | 1 - .../methods/eth_mining/eth_mining.ts | 24 - .../rpc-mapper/methods/eth_mining/index.ts | 1 - .../eth_newBlockFilter/eth_newBlockFilter.ts | 24 - .../methods/eth_newBlockFilter/index.ts | 1 - .../methods/eth_newFilter/eth_newFilter.ts | 24 - .../rpc-mapper/methods/eth_newFilter/index.ts | 1 - .../eth_newPendingTransactionFilter.ts | 27 - .../eth_newPendingTransactionFilter/index.ts | 1 - .../eth_protocolVersion.ts | 24 - .../methods/eth_protocolVersion/index.ts | 1 - .../eth_requestAccounts.ts | 33 - .../methods/eth_requestAccounts/index.ts | 1 - .../eth_sendRawTransaction.ts | 63 - .../methods/eth_sendRawTransaction/index.ts | 1 - .../eth_sendTransaction.ts | 93 - .../methods/eth_sendTransaction/index.ts | 2 - .../methods/eth_sendTransaction/types.d.ts | 11 - .../rpc-mapper/methods/eth_sign/eth_sign.ts | 24 - .../rpc-mapper/methods/eth_sign/index.ts | 1 - .../eth_signTransaction.ts | 85 - .../methods/eth_signTransaction/index.ts | 1 - .../eth_signTypedData_v4.ts | 96 - .../methods/eth_signTypedData_v4/index.ts | 1 - .../methods/eth_submitWork/eth_submitWork.ts | 24 - .../methods/eth_submitWork/index.ts | 1 - .../methods/eth_subscribe/eth_subscribe.ts | 122 - .../rpc-mapper/methods/eth_subscribe/index.ts | 1 - .../methods/eth_syncing/eth_syncing.ts | 87 - .../rpc-mapper/methods/eth_syncing/index.ts | 1 - .../eth_uninstallFilter.ts | 24 - .../methods/eth_uninstallFilter/index.ts | 1 - .../eth_unsubscribe/eth_unsubscribe.ts | 66 - .../methods/eth_unsubscribe/index.ts | 1 - .../rpc-mapper/methods/evm_mine/evm_mine.ts | 43 - .../rpc-mapper/methods/evm_mine/index.ts | 1 - .../utils/rpc-mapper/methods/index.ts | 82 - .../rpc-mapper/methods/net_listening/index.ts | 1 - .../methods/net_listening/net_listening.ts | 26 - .../rpc-mapper/methods/net_peerCount/index.ts | 1 - .../methods/net_peerCount/net_peerCount.ts | 27 - .../rpc-mapper/methods/net_version/index.ts | 1 - .../methods/net_version/net_version.ts | 17 - .../methods/parity_nextNonce/index.ts | 1 - .../parity_nextNonce/parity_nextNonce.ts | 24 - .../methods/txpool_content/index.ts | 1 - .../methods/txpool_content/txpool_content.ts | 15 - .../methods/txpool_contentFrom/index.ts | 1 - .../txpool_contentFrom/txpool_contentFrom.ts | 31 - .../methods/txpool_inspect/index.ts | 1 - .../methods/txpool_inspect/txpool_inspect.ts | 15 - .../rpc-mapper/methods/txpool_status/index.ts | 1 - .../methods/txpool_status/txpool_status.ts | 15 - .../utils/rpc-mapper/methods/types.d.ts | 11 - .../methods/web3_clientVersion/index.ts | 1 - .../web3_clientVersion/web3_clientVersion.ts | 12 - .../rpc-mapper/methods/web3_sha3/index.ts | 1 - .../rpc-mapper/methods/web3_sha3/web3_sha3.ts | 28 - .../provider/utils/rpc-mapper/rpc-mapper.ts | 549 --- .../src/provider/utils/rpc-mapper/types.d.ts | 19 - packages/network/src/signer/index.ts | 1 - packages/network/src/signer/signers/index.ts | 4 - .../network/src/signer/signers/types.d.ts | 405 -- .../network/src/signer/signers/utils/index.ts | 6 - .../network/src/signer/signers/utils/utils.ts | 30 - .../signers/vechain-abstract-signer/index.ts | 1 - .../vechain-abstract-signer.ts | 550 --- .../vechain-private-key-signer/index.ts | 1 - .../vechain-private-key-signer.ts | 254 -- .../network/src/thor-client/ThorClient.ts | 122 - .../src/thor-client/accounts/AccountData.ts | 19 - .../src/thor-client/accounts/AccountDetail.ts | 51 - .../accounts/AccountInputOptions.ts | 14 - .../thor-client/accounts/AccountsModule.ts | 111 - .../network/src/thor-client/accounts/index.ts | 4 - .../src/thor-client/blocks/blocks-module.ts | 330 -- .../network/src/thor-client/blocks/index.ts | 2 - .../network/src/thor-client/blocks/types.d.ts | 275 -- .../thor-client/contracts/contracts-module.ts | 133 - .../src/thor-client/contracts/index.ts | 3 - .../contracts/model/contract-factory.ts | 182 - .../contracts/model/contract-filter.ts | 59 - .../contracts/model/contract-proxy.ts | 396 -- .../thor-client/contracts/model/contract.ts | 210 - .../src/thor-client/contracts/model/index.ts | 3 - .../thor-client/contracts/model/types.d.ts | 234 - .../src/thor-client/contracts/types.d.ts | 78 - .../debug/ContractTraceTarget.d.ts | 22 - .../src/thor-client/debug/DebugModule.ts | 185 - .../debug/RetrieveStorageRange.d.ts | 27 - .../debug/RetrieveStorageRangeOptions.d.ts | 23 - .../debug/TransactionTraceTarget.ts | 19 - .../network/src/thor-client/debug/index.ts | 7 - .../debug/types-by-name/4byte-name-types.d.ts | 11 - .../types-by-name/bigram-name-types.d.ts | 11 - .../debug/types-by-name/call-name-types.d.ts | 45 - .../types-by-name/default-name-types.d.ts | 23 - .../types-by-name/evmdis-name-types.d.ts | 16 - .../thor-client/debug/types-by-name/index.ts | 10 - .../debug/types-by-name/noop-name-types.d.ts | 11 - .../types-by-name/opcount-name-types.d.ts | 12 - .../types-by-name/prestate-name-types.d.ts | 19 - .../types-by-name/trigram-name-types.d.ts | 11 - .../types-by-name/unigram-name-types.d.ts | 11 - .../network/src/thor-client/debug/types.d.ts | 127 - .../network/src/thor-client/gas/gas-module.ts | 33 - .../src/thor-client/gas/helpers/const.ts | 17 - .../gas/helpers/decode-evm-error.ts | 38 - packages/network/src/thor-client/gas/index.ts | 1 - .../network/src/thor-client/gas/types.d.ts | 49 - packages/network/src/thor-client/index.ts | 12 - .../network/src/thor-client/logs/index.ts | 2 - .../src/thor-client/logs/logs-module.ts | 190 - .../network/src/thor-client/logs/types.d.ts | 271 -- .../network/src/thor-client/nodes/index.ts | 2 - .../src/thor-client/nodes/nodes-module.ts | 97 - .../network/src/thor-client/nodes/types.d.ts | 43 - .../helpers/delegation-handler.ts | 154 - .../thor-client/transactions/helpers/index.ts | 1 - .../src/thor-client/transactions/index.ts | 3 - .../transactions/transactions-module.ts | 884 ---- .../src/thor-client/transactions/types.d.ts | 331 -- .../src/utils/const/built-in/built-in.ts | 363 -- .../network/src/utils/const/built-in/index.ts | 1 - .../src/utils/const/client/http-client.ts | 11 - .../network/src/utils/const/client/index.ts | 3 - .../network/src/utils/const/client/nodes.ts | 7 - .../src/utils/const/client/transactions.ts | 17 - packages/network/src/utils/const/index.ts | 5 - .../network/src/utils/const/network/index.ts | 1 - .../src/utils/const/network/network.ts | 16 - packages/network/src/utils/const/rpc/index.ts | 1 - packages/network/src/utils/const/rpc/rpc.ts | 7 - .../src/utils/const/thor-solo/index.ts | 1 - .../src/utils/const/thor-solo/thor-solo.ts | 122 - packages/network/src/utils/helpers/index.ts | 1 - packages/network/src/utils/helpers/request.ts | 24 - packages/network/src/utils/index.ts | 6 - packages/network/src/utils/poll/event.ts | 274 -- packages/network/src/utils/poll/index.ts | 11 - packages/network/src/utils/poll/sync.ts | 164 - packages/network/src/utils/poll/types.d.ts | 28 - .../network/src/utils/subscriptions/beat.ts | 39 - .../network/src/utils/subscriptions/block.ts | 20 - .../network/src/utils/subscriptions/event.ts | 48 - .../network/src/utils/subscriptions/index.ts | 20 - .../src/utils/subscriptions/transaction.ts | 13 - .../src/utils/subscriptions/transfer.ts | 28 - .../src/utils/subscriptions/types.d.ts | 120 - packages/network/src/utils/thorest/helpers.ts | 62 - packages/network/src/utils/thorest/index.ts | 3 - packages/network/src/utils/thorest/thorest.ts | 203 - packages/network/src/utils/thorest/types.d.ts | 55 - packages/network/src/utils/vns/addresses.ts | 27 - packages/network/src/utils/vns/index.ts | 137 - packages/network/tests/fixture.ts | 895 ---- .../tests/http/SimpleHttpClient.solo.test.ts | 146 - .../http/SimpleHttpClient.testnet.test.ts | 84 - packages/network/tests/provider/fixture.ts | 181 - .../formatter/blocks-formatter.unit.test.ts | 22 - .../tests/provider/formatter/fixture.ts | 367 -- .../transactions-formatter.unit.test.ts | 26 - .../base-wallet/fixture.ts | 24 - ...provider-internal-base-wallet.unit.test.ts | 221 - .../hd-wallet/fixture.ts | 43 - .../provider-internal-hd-wallet.unit.test.ts | 45 - .../provider/helpers/transaction/fixture.ts | 45 - .../transaction-helpers.unit.test.ts | 41 - .../ethers/ethers-provider.mainnet.test.ts | 105 - .../ethers/ethers-provider.solo.test.ts | 105 - .../ethers/ethers-provider.testnet.test.ts | 106 - .../tests/provider/providers/fixture.ts | 282 -- .../hardhat/hardhat-provider.mainnet.test.ts | 143 - .../hardhat-provider.mock.mainnet.test.ts | 69 - .../hardhat/hardhat-provider.solo.test.ts | 354 -- .../hardhat/hardhat-provider.testnet.test.ts | 172 - .../tests/provider/providers/helpers.ts | 51 - .../vechain/vechain-provider.mainnet.test.ts | 82 - .../vechain/vechain-provider.solo.test.ts | 399 -- .../vechain/vechain-provider.testnet.test.ts | 120 - .../vechain/vechain-provider.unit.test.ts | 111 - .../debug_getBadBlocks.testnet.test.ts | 48 - .../methods/debug_getBadBlocks/fixture.ts | 0 .../debug_getRawBlock.testnet.test.ts | 48 - .../methods/debug_getRawBlock/fixture.ts | 0 .../debug_getRawHeader.testnet.test.ts | 48 - .../methods/debug_getRawHeader/fixture.ts | 0 .../debug_getRawReceipts.testnet.test.ts | 48 - .../methods/debug_getRawReceipts/fixture.ts | 0 .../debug_getRawTransaction.testnet.test.ts | 48 - .../debug_getRawTransaction/fixture.ts | 0 ...ebug_traceBlockByHash.mock.testnet.test.ts | 81 - .../debug_traceBlockByHash.testnet.test.ts | 90 - .../methods/debug_traceBlockByHash/fixture.ts | 47 - ...ug_traceBlockByNumber.mock.testnet.test.ts | 82 - .../debug_traceBlockByNumber.testnet.test.ts | 94 - .../debug_traceBlockByNumber/fixture.ts | 49 - .../debug_traceCall.solo.test.ts | 70 - .../debug_traceCall.testnet.test.ts | 83 - .../methods/debug_traceCall/fixture.ts | 132 - .../debug_traceTransaction.solo.test.ts | 56 - .../debug_traceTransaction.testnet.test.ts | 66 - .../methods/debug_traceTransaction/fixture.ts | 104 - ...ngine_exchangeCapabilities.testnet.test.ts | 48 - .../engine_exchangeCapabilities/fixture.ts | 0 ...eTransitionConfigurationV1.testnet.test.ts | 48 - .../fixture.ts | 0 ...engine_forkchoiceUpdatedV1.testnet.test.ts | 48 - .../engine_forkchoiceUpdatedV1/fixture.ts | 0 ...engine_forkchoiceUpdatedV2.testnet.test.ts | 48 - .../engine_forkchoiceUpdatedV2/fixture.ts | 0 ...engine_forkchoiceUpdatedV3.testnet.test.ts | 48 - .../engine_forkchoiceUpdatedV3/fixture.ts | 0 ...e_getPayloadBodiesByHashV1.testnet.test.ts | 48 - .../fixture.ts | 0 ..._getPayloadBodiesByRangeV1.testnet.test.ts | 48 - .../fixture.ts | 0 .../engine_getPayloadV1.testnet.test.ts | 48 - .../methods/engine_getPayloadV1/fixture.ts | 0 .../engine_getPayloadV2.testnet.test.ts | 48 - .../methods/engine_getPayloadV2/fixture.ts | 0 .../engine_getPayloadV3.testnet.test.ts | 48 - .../methods/engine_getPayloadV3/fixture.ts | 0 .../engine_newPayloadV1.testnet.test.ts | 48 - .../methods/engine_newPayloadV1/fixture.ts | 0 .../engine_newPayloadV2.testnet.test.ts | 48 - .../methods/engine_newPayloadV2/fixture.ts | 0 .../engine_newPayloadV3.testnet.test.ts | 48 - .../methods/engine_newPayloadV3/fixture.ts | 0 .../eth_accounts/eth_accounts.solo.test.ts | 84 - .../methods/eth_accounts/fixture.ts | 0 .../eth_blockNumber.mock.solo.test.ts | 65 - .../eth_blockNumber.solo.test.ts | 56 - .../eth_blockNumber.testnet.test.ts | 62 - .../methods/eth_blockNumber/fixture.ts | 0 .../eth_call/eth_call.mock.solo.test.ts | 56 - .../methods/eth_call/eth_call.testnet.test.ts | 63 - .../rpc-mapper/methods/eth_call/fixture.ts | 173 - .../eth_chainId/eth_chainId.mainnet.test.ts | 44 - .../eth_chainId/eth_chainId.mock.solo.test.ts | 61 - .../eth_chainId/eth_chainId.solo.test.ts | 44 - .../eth_chainId/eth_chainId.testnet.test.ts | 44 - .../rpc-mapper/methods/eth_chainId/fixture.ts | 0 .../eth_coinbase/eth_coinbase.testnet.test.ts | 46 - .../methods/eth_coinbase/fixture.ts | 0 .../eth_createAccessList.testnet.test.ts | 48 - .../methods/eth_createAccessList/fixture.ts | 0 .../eth_estimateGas.mock.testnet.test.ts | 56 - .../eth_estimateGas.testnet.test.ts | 63 - .../methods/eth_estimateGas/fixture.ts | 67 - .../eth_feeHistory.testnet.test.ts | 46 - .../methods/eth_feeHistory/fixture.ts | 0 .../eth_gasPrice/eth_gasPrice.mainnet.test.ts | 42 - .../eth_gasPrice/eth_gasPrice.testnet.test.ts | 42 - .../methods/eth_gasPrice/fixture.ts | 0 .../eth_getBalance.solo.test.ts | 72 - .../methods/eth_getBalance/fixture.ts | 74 - .../eth_getBlockByHash.mock.testnet.test.ts | 56 - .../eth_getBlockByHash.testnet.test.ts | 76 - .../methods/eth_getBlockByHash/fixture.ts | 75 - .../eth_getBlockByNumber.testnet.test.ts | 111 - .../methods/eth_getBlockByNumber/fixture.ts | 96 - .../eth_getBlockReceipts.mock.testnet.test.ts | 74 - .../eth_getBlockReceipts.testnet.test.ts | 83 - .../methods/eth_getBlockReceipts/fixture.ts | 137 - ...lockTransactionCountByHash.testnet.test.ts | 75 - .../fixture.ts | 0 ...ckTransactionCountByNumber.testnet.test.ts | 73 - .../fixture.ts | 24 - .../eth_getCode/eth_getCode.solo.test.ts | 68 - .../rpc-mapper/methods/eth_getCode/fixture.ts | 60 - .../eth_getFilterChanges.testnet.test.ts | 48 - .../methods/eth_getFilterChanges/fixture.ts | 0 .../eth_getFilterLogs.testnet.test.ts | 48 - .../methods/eth_getFilterLogs/fixture.ts | 0 .../eth_getLogs/eth_getLogs.mock.solo.test.ts | 78 - .../eth_getLogs/eth_getLogs.testnet.test.ts | 98 - .../rpc-mapper/methods/eth_getLogs/fixture.ts | 248 -- .../eth_getProof/eth_getProof.testnet.test.ts | 46 - .../methods/eth_getProof/fixture.ts | 0 .../eth_getStorageAt.mainnet.test.ts | 72 - .../methods/eth_getStorageAt/fixture.ts | 81 - ...sactionByBlockHashAndIndex.testnet.test.ts | 71 - .../fixture.ts | 124 - ...ctionByBlockNumberAndIndex.testnet.test.ts | 71 - .../fixture.ts | 102 - .../eth_getTransactionByHash.testnet.test.ts | 71 - .../eth_getTransactionByHash/fixture.ts | 56 - .../eth_getTransactionCount.testnet.test.ts | 64 - .../eth_getTransactionCount/fixture.ts | 25 - ...getTransactionReceipt.mock.testnet.test.ts | 69 - .../eth_getTransactionReceipt.solo.test.ts | 50 - .../eth_getTransactionReceipt.testnet.test.ts | 76 - .../eth_getTransactionReceipt/fixture.ts | 241 -- ...etUncleByBlockHashAndIndex.testnet.test.ts | 81 - ...UncleByBlockNumberAndIndex.testnet.test.ts | 78 - ...h_getUncleCountByBlockHash.testnet.test.ts | 72 - .../eth_getUncleCountByBlockHash/fixture.ts | 0 ...getUncleCountByBlockNumber.testnet.test.ts | 70 - .../eth_getUncleCountByBlockNumber/fixture.ts | 0 .../eth_getWork/eth_getWork.testnet.test.ts | 46 - .../rpc-mapper/methods/eth_getWork/fixture.ts | 0 .../eth_hashrate/eth_hashrate.testnet.test.ts | 46 - .../methods/eth_hashrate/fixture.ts | 0 .../eth_maxPriorityFeePerGas.testnet.test.ts | 48 - .../eth_maxPriorityFeePerGas/fixture.ts | 0 .../eth_mining/eth_mining.testnet.test.ts | 46 - .../rpc-mapper/methods/eth_mining/fixture.ts | 0 .../eth_newBlockFilter.testnet.test.ts | 48 - .../methods/eth_newBlockFilter/fixture.ts | 0 .../eth_newFilter.testnet.test.ts | 46 - .../methods/eth_newFilter/fixture.ts | 0 ...ewPendingTransactionFilter.testnet.test.ts | 48 - .../fixture.ts | 0 .../eth_protocolVersion.testnet.test.ts | 48 - .../methods/eth_protocolVersion/fixture.ts | 0 .../eth_requestAccounts.solo.test.ts | 91 - .../methods/eth_requestAccounts/fixture.ts | 0 ...th_sendRawTransaction.mock.testnet.test.ts | 50 - .../eth_sendRawTransaction.solo.test.ts | 100 - .../eth_sendRawTransaction.testnet.test.ts | 69 - .../eth_sendTransaction.solo.test.ts | 306 -- .../methods/eth_sendTransaction/fixture.ts | 19 - .../methods/eth_sign/eth_sign.testnet.test.ts | 46 - .../rpc-mapper/methods/eth_sign/fixture.ts | 0 .../eth_signTransaction.testnet.test.ts | 188 - .../methods/eth_signTransaction/fixture.ts | 0 .../eth_signTypedData_v4.testnet.test.ts | 167 - .../eth_submitWork.testnet.test.ts | 46 - .../methods/eth_submitWork/fixture.ts | 0 .../eth_subscribe.testnet.test.ts | 129 - .../methods/eth_subscribe/fixture.ts | 0 .../eth_syncing/eth_syncing.mock.solo.test.ts | 140 - .../rpc-mapper/methods/eth_syncing/fixture.ts | 61 - .../eth_uninstallFilter.testnet.test.ts | 48 - .../methods/eth_uninstallFilter/fixture.ts | 0 .../eth_unsubscribe.testnet.test.ts | 102 - .../methods/eth_unsubscribe/fixture.ts | 0 .../evm_mine/evm_mine.mock.solo.test.ts | 80 - .../methods/evm_mine/evm_mine.testnet.test.ts | 50 - .../rpc-mapper/methods/evm_mine/fixture.ts | 0 .../methods/net_listening/fixture.ts | 0 .../net_listening.mock.testnet.test.ts | 50 - .../net_listening.testnet.test.ts | 42 - .../methods/net_peerCount/fixture.ts | 0 .../net_peerCount.mock.testnet.test.ts | 50 - .../net_peerCount.testnet.test.ts | 42 - .../rpc-mapper/methods/net_version/fixture.ts | 0 .../net_version/net_version.testnet.test.ts | 48 - .../methods/parity_nextNonce/fixture.ts | 0 .../parity_nextNonce.testnet.test.ts | 46 - .../txpool_content.testnet.test.ts | 43 - .../txpool_contentFrom.testnet.test.ts | 78 - .../txpool_inspect.testnet.test.ts | 43 - .../txpool_status.testnet.test.ts | 43 - .../methods/web3_clientVersion/fixture.ts | 0 .../web3_clientVersion.testnet.test.ts | 42 - .../web3_sha3/web3_sha3.testnet.test.ts | 70 - .../vechain-private-key-signer/fixture.ts | 439 -- .../vechain-private-key-signer.solo.test.ts | 303 -- ...vechain-private-key-signer.testnet.test.ts | 289 -- .../vechain-private-key-signer.unit.test.ts | 402 -- packages/network/tests/test-utils.ts | 19 - .../tests/thor-client/ThorClient.unit.test.ts | 16 - .../accounts/AccountsModule.solo.test.ts | 87 - .../accounts/AccountsModule.testnet.test.ts | 212 - .../blocks/blocks.mock.solo.test.ts | 36 - .../thor-client/blocks/blocks.testnet.test.ts | 355 -- .../tests/thor-client/blocks/fixture.ts | 482 --- .../contracts/contract.erc20.solo.test.ts | 465 -- .../contracts/contract.erc20.testnet.test.ts | 102 - .../contracts/contract.erc721.solo.test.ts | 138 - .../contracts/contract.event.mainnet.test.ts | 66 - .../contracts/contract.event.solo.test.ts | 563 --- .../contracts/contract.event.testnet.test.ts | 91 - .../contracts/contract.solo.test.ts | 816 ---- .../contracts/contract.testnet.test.ts | 38 - .../tests/thor-client/contracts/fixture.ts | 3831 ----------------- .../debug/DebugModule.solo.test.ts | 443 -- .../debug/DebugModule.testnet.test.ts | 537 --- .../thor-client/debug/fixture-thorest.ts | 496 --- .../network/tests/thor-client/gas/fixture.ts | 346 -- .../tests/thor-client/gas/gas.solo.test.ts | 88 - .../network/tests/thor-client/logs/fixture.ts | 251 -- .../thor-client/logs/logs.testnet.test.ts | 42 - .../tests/thor-client/nodes/fixture.ts | 91 - .../nodes/nodes.mock.testnet.test.ts | 89 - .../thor-client/nodes/nodes.testnet.test.ts | 79 - .../transactions/fixture-thorest.ts | 496 --- .../tests/thor-client/transactions/fixture.ts | 504 --- .../helpers/delegation-handler.unit.test.ts | 55 - .../transactions/helpers/fixture.ts | 87 - .../transactions-thorest.solo.test.ts | 262 -- .../transactions-thorest.testnet.test.ts | 111 - .../transactions.mocks.solo.test.ts | 96 - .../transactions/transactions.solo.test.ts | 229 - .../transactions/transactions.testnet.test.ts | 143 - .../utils/poll/event/event-poll.unit.test.ts | 184 - packages/network/tests/utils/poll/fixture.ts | 77 - .../utils/poll/sync/sync-poll.unit.test.ts | 149 - .../tests/utils/subscriptions/fixture.ts | 292 -- .../subscriptions/subscriptions.solo.test.ts | 339 -- .../subscriptions.testnet.test.ts | 173 - .../network/tests/utils/thorest/fixture.ts | 91 - .../tests/utils/thorest/helpers.unit.test.ts | 46 - .../utils/vns/lookups.mock.testnet.test.ts | 189 - .../tests/utils/vns/lookups.unit.test.ts | 107 - packages/network/tsconfig.json | 12 - packages/network/typedoc.json | 4 - .../thor/blocks/RetrieveBlock.testnet.test.ts | 2 +- .../blocks/RetrieveExpandedBlock.unit.test.ts | 2 +- .../thor/blocks/RetrieveRawBlock.unit.test.ts | 2 +- .../blocks/RetrieveRegularBlock.unit.test.ts | 2 +- .../QuerySmartContractEvents.unit.test.ts | 4 +- .../logs/QueryVETTransferEvents.unit.test.ts | 2 +- .../node/RetrieveConnectedPeers.unit.test.ts | 2 +- .../BeatsSubscription.solo.test.ts | 2 +- .../BlocksSubscription.solo.test.ts | 2 +- .../NewTransactionSubscription.solo.test.ts | 2 +- .../tests/thor/transactions/EXP.solo.test.ts | 205 - .../thor/transactions/EXP.testnet.test.ts | 71 - .../transactions/SendTransaction.solo.test.ts | 34 - .../ws/MozillaWebSocketClient.solo.test.ts | 2 +- packages/thorest/typedoc.json | 4 +- yarn.lock | 965 +---- 621 files changed, 47 insertions(+), 45204 deletions(-) delete mode 100644 .changeset/funny-masks-cheat.md delete mode 100644 packages/network/README.md delete mode 100644 packages/network/eslint.config.mjs delete mode 100644 packages/network/jest.browser-setup.js delete mode 100644 packages/network/jest.config.browser.js delete mode 100644 packages/network/jest.config.js delete mode 100644 packages/network/package.json delete mode 100644 packages/network/solo-seeding/TestingContract.sol delete mode 100644 packages/network/solo-seeding/builtin-contracts/authority.sol delete mode 100644 packages/network/solo-seeding/builtin-contracts/builtin.sol delete mode 100644 packages/network/solo-seeding/builtin-contracts/energy.sol delete mode 100644 packages/network/solo-seeding/builtin-contracts/executor.sol delete mode 100644 packages/network/solo-seeding/builtin-contracts/extension.sol delete mode 100644 packages/network/solo-seeding/builtin-contracts/params.sol delete mode 100644 packages/network/solo-seeding/builtin-contracts/prototype.sol delete mode 100644 packages/network/src/http/HttpClient.ts delete mode 100644 packages/network/src/http/HttpMethod.ts delete mode 100644 packages/network/src/http/HttpParams.ts delete mode 100644 packages/network/src/http/SimpleHttpClient.ts delete mode 100644 packages/network/src/http/index.ts delete mode 100644 packages/network/src/index.ts delete mode 100644 packages/network/src/network.ts delete mode 100644 packages/network/src/provider/eip1193/index.ts delete mode 100644 packages/network/src/provider/eip1193/types.d.ts delete mode 100644 packages/network/src/provider/helpers/index.ts delete mode 100644 packages/network/src/provider/helpers/provider-internal-wallets/abstract-wallet/abstract-provider-internal-wallet.ts delete mode 100644 packages/network/src/provider/helpers/provider-internal-wallets/abstract-wallet/index.ts delete mode 100644 packages/network/src/provider/helpers/provider-internal-wallets/base-wallet/index.ts delete mode 100644 packages/network/src/provider/helpers/provider-internal-wallets/base-wallet/provider-internal-base-wallet.ts delete mode 100644 packages/network/src/provider/helpers/provider-internal-wallets/hd-wallet/index.ts delete mode 100644 packages/network/src/provider/helpers/provider-internal-wallets/hd-wallet/provider-internal-hd-wallet.ts delete mode 100644 packages/network/src/provider/helpers/provider-internal-wallets/index.ts delete mode 100644 packages/network/src/provider/helpers/provider-internal-wallets/types.d.ts delete mode 100644 packages/network/src/provider/index.ts delete mode 100644 packages/network/src/provider/providers/ethers-provider/index.ts delete mode 100644 packages/network/src/provider/providers/ethers-provider/json-rpc-ethers-provider.ts delete mode 100644 packages/network/src/provider/providers/hardhat-provider/hardhat-provider.ts delete mode 100644 packages/network/src/provider/providers/hardhat-provider/index.ts delete mode 100644 packages/network/src/provider/providers/hardhat-provider/types.d.ts delete mode 100644 packages/network/src/provider/providers/index.ts delete mode 100644 packages/network/src/provider/providers/vechain-provider/index.ts delete mode 100644 packages/network/src/provider/providers/vechain-provider/types.d.ts delete mode 100644 packages/network/src/provider/providers/vechain-provider/vechain-provider.ts delete mode 100644 packages/network/src/provider/utils/const/blocks/blocks.ts delete mode 100644 packages/network/src/provider/utils/const/blocks/index.ts delete mode 100644 packages/network/src/provider/utils/const/chain-id/chain-id.ts delete mode 100644 packages/network/src/provider/utils/const/chain-id/index.ts delete mode 100644 packages/network/src/provider/utils/const/index.ts delete mode 100644 packages/network/src/provider/utils/const/providers/const.ts delete mode 100644 packages/network/src/provider/utils/const/providers/index.ts delete mode 100644 packages/network/src/provider/utils/const/rpc-mapper/index.ts delete mode 100644 packages/network/src/provider/utils/const/rpc-mapper/rpc-methods.ts delete mode 100644 packages/network/src/provider/utils/formatter/blocks/formatter.ts delete mode 100644 packages/network/src/provider/utils/formatter/blocks/index.ts delete mode 100644 packages/network/src/provider/utils/formatter/blocks/types.d.ts delete mode 100644 packages/network/src/provider/utils/formatter/debug/formatter.ts delete mode 100644 packages/network/src/provider/utils/formatter/debug/index.ts delete mode 100644 packages/network/src/provider/utils/formatter/debug/types.d.ts delete mode 100644 packages/network/src/provider/utils/formatter/index.ts delete mode 100644 packages/network/src/provider/utils/formatter/logs/formatter.ts delete mode 100644 packages/network/src/provider/utils/formatter/logs/index.ts delete mode 100644 packages/network/src/provider/utils/formatter/logs/types.d.ts delete mode 100644 packages/network/src/provider/utils/formatter/transactions/formatter.ts delete mode 100644 packages/network/src/provider/utils/formatter/transactions/index.ts delete mode 100644 packages/network/src/provider/utils/formatter/transactions/types.d.ts delete mode 100644 packages/network/src/provider/utils/helpers/index.ts delete mode 100644 packages/network/src/provider/utils/helpers/transaction/index.ts delete mode 100644 packages/network/src/provider/utils/helpers/transaction/transaction-helpers.ts delete mode 100644 packages/network/src/provider/utils/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getBadBlocks/debug_getBadBlocks.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getBadBlocks/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawBlock/debug_getRawBlock.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawBlock/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawHeader/debug_getRawHeader.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawHeader/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawReceipts/debug_getRawReceipts.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawReceipts/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawTransaction/debug_getRawTransaction.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawTransaction/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByHash/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByNumber/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/debug_traceCall.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/types.d.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/types.d.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeCapabilities/engine_exchangeCapabilities.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeCapabilities/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/engine_exchangeTransitionConfigurationV1.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV1/engine_forkchoiceUpdatedV1.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV1/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV2/engine_forkchoiceUpdatedV2.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV2/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV3/engine_forkchoiceUpdatedV3.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV3/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/engine_getPayloadBodiesByHashV1.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/engine_getPayloadBodiesByRangeV1.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV1/engine_getPayloadV1.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV1/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV2/engine_getPayloadV2.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV2/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV3/engine_getPayloadV3.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV3/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV1/engine_newPayloadV1.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV1/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV2/engine_newPayloadV2.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV2/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV3/engine_newPayloadV3.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV3/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_accounts/eth_accounts.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_accounts/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_blockNumber/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_call/eth_call.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_call/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_call/types.d.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_chainId/eth_chainId.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_chainId/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_coinbase/eth_coinbase.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_coinbase/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_createAccessList/eth_createAccessList.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_createAccessList/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/types.d.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_feeHistory/eth_feeHistory.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_feeHistory/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_gasPrice/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBalance/eth_getBalance.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBalance/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByHash/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByNumber/eth_getBlockByNumber.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByNumber/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockReceipts/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByHash/eth_getBlockTransactionCountByHash.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByHash/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/eth_getBlockTransactionCountByNumber.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getCode/eth_getCode.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getCode/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterChanges/eth_getFilterChanges.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterChanges/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterLogs/eth_getFilterLogs.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterLogs/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getLogs/eth_getLogs.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getLogs/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getProof/eth_getProof.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getProof/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getStorageAt/eth_getStorageAt.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getStorageAt/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockHashAndIndex.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByHash/eth_getTransactionByHash.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByHash/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionCount/eth_getTransactionCount.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionCount/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionReceipt/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockHash/eth_getUncleCountByBlockHash.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockHash/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockNumber/eth_getUncleCountByBlockNumber.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockNumber/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getWork/eth_getWork.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_getWork/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_hashrate/eth_hashrate.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_hashrate/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_maxPriorityFeePerGas/eth_maxPriorityFeePerGas.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_maxPriorityFeePerGas/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_mining/eth_mining.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_mining/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_newBlockFilter/eth_newBlockFilter.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_newBlockFilter/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_newFilter/eth_newFilter.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_newFilter/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_newPendingTransactionFilter/eth_newPendingTransactionFilter.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_newPendingTransactionFilter/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_protocolVersion/eth_protocolVersion.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_protocolVersion/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_requestAccounts/eth_requestAccounts.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_requestAccounts/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_sendRawTransaction/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/eth_sendTransaction.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/types.d.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_sign/eth_sign.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_sign/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_signTransaction/eth_signTransaction.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_signTransaction/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_submitWork/eth_submitWork.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_submitWork/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_subscribe/eth_subscribe.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_subscribe/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_syncing/eth_syncing.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_syncing/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_uninstallFilter/eth_uninstallFilter.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_uninstallFilter/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_unsubscribe/eth_unsubscribe.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/eth_unsubscribe/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/evm_mine/evm_mine.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/evm_mine/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/net_listening/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/net_listening/net_listening.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/net_peerCount/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/net_peerCount/net_peerCount.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/net_version/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/net_version/net_version.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/parity_nextNonce/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/parity_nextNonce/parity_nextNonce.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/txpool_content/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/txpool_content/txpool_content.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/txpool_contentFrom/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/txpool_contentFrom/txpool_contentFrom.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/txpool_inspect/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/txpool_inspect/txpool_inspect.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/txpool_status/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/txpool_status/txpool_status.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/types.d.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/web3_clientVersion/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/web3_clientVersion/web3_clientVersion.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/web3_sha3/index.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/methods/web3_sha3/web3_sha3.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts delete mode 100644 packages/network/src/provider/utils/rpc-mapper/types.d.ts delete mode 100644 packages/network/src/signer/index.ts delete mode 100644 packages/network/src/signer/signers/index.ts delete mode 100644 packages/network/src/signer/signers/types.d.ts delete mode 100644 packages/network/src/signer/signers/utils/index.ts delete mode 100644 packages/network/src/signer/signers/utils/utils.ts delete mode 100644 packages/network/src/signer/signers/vechain-abstract-signer/index.ts delete mode 100644 packages/network/src/signer/signers/vechain-abstract-signer/vechain-abstract-signer.ts delete mode 100644 packages/network/src/signer/signers/vechain-private-key-signer/index.ts delete mode 100644 packages/network/src/signer/signers/vechain-private-key-signer/vechain-private-key-signer.ts delete mode 100644 packages/network/src/thor-client/ThorClient.ts delete mode 100644 packages/network/src/thor-client/accounts/AccountData.ts delete mode 100644 packages/network/src/thor-client/accounts/AccountDetail.ts delete mode 100644 packages/network/src/thor-client/accounts/AccountInputOptions.ts delete mode 100644 packages/network/src/thor-client/accounts/AccountsModule.ts delete mode 100644 packages/network/src/thor-client/accounts/index.ts delete mode 100644 packages/network/src/thor-client/blocks/blocks-module.ts delete mode 100644 packages/network/src/thor-client/blocks/index.ts delete mode 100644 packages/network/src/thor-client/blocks/types.d.ts delete mode 100644 packages/network/src/thor-client/contracts/contracts-module.ts delete mode 100644 packages/network/src/thor-client/contracts/index.ts delete mode 100644 packages/network/src/thor-client/contracts/model/contract-factory.ts delete mode 100644 packages/network/src/thor-client/contracts/model/contract-filter.ts delete mode 100644 packages/network/src/thor-client/contracts/model/contract-proxy.ts delete mode 100644 packages/network/src/thor-client/contracts/model/contract.ts delete mode 100644 packages/network/src/thor-client/contracts/model/index.ts delete mode 100644 packages/network/src/thor-client/contracts/model/types.d.ts delete mode 100644 packages/network/src/thor-client/contracts/types.d.ts delete mode 100644 packages/network/src/thor-client/debug/ContractTraceTarget.d.ts delete mode 100644 packages/network/src/thor-client/debug/DebugModule.ts delete mode 100644 packages/network/src/thor-client/debug/RetrieveStorageRange.d.ts delete mode 100644 packages/network/src/thor-client/debug/RetrieveStorageRangeOptions.d.ts delete mode 100644 packages/network/src/thor-client/debug/TransactionTraceTarget.ts delete mode 100644 packages/network/src/thor-client/debug/index.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/4byte-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/bigram-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/call-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/default-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/evmdis-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/index.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/noop-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/opcount-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/prestate-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/trigram-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types-by-name/unigram-name-types.d.ts delete mode 100644 packages/network/src/thor-client/debug/types.d.ts delete mode 100644 packages/network/src/thor-client/gas/gas-module.ts delete mode 100644 packages/network/src/thor-client/gas/helpers/const.ts delete mode 100644 packages/network/src/thor-client/gas/helpers/decode-evm-error.ts delete mode 100644 packages/network/src/thor-client/gas/index.ts delete mode 100644 packages/network/src/thor-client/gas/types.d.ts delete mode 100644 packages/network/src/thor-client/index.ts delete mode 100644 packages/network/src/thor-client/logs/index.ts delete mode 100644 packages/network/src/thor-client/logs/logs-module.ts delete mode 100644 packages/network/src/thor-client/logs/types.d.ts delete mode 100644 packages/network/src/thor-client/nodes/index.ts delete mode 100644 packages/network/src/thor-client/nodes/nodes-module.ts delete mode 100644 packages/network/src/thor-client/nodes/types.d.ts delete mode 100644 packages/network/src/thor-client/transactions/helpers/delegation-handler.ts delete mode 100644 packages/network/src/thor-client/transactions/helpers/index.ts delete mode 100644 packages/network/src/thor-client/transactions/index.ts delete mode 100644 packages/network/src/thor-client/transactions/transactions-module.ts delete mode 100644 packages/network/src/thor-client/transactions/types.d.ts delete mode 100644 packages/network/src/utils/const/built-in/built-in.ts delete mode 100644 packages/network/src/utils/const/built-in/index.ts delete mode 100644 packages/network/src/utils/const/client/http-client.ts delete mode 100644 packages/network/src/utils/const/client/index.ts delete mode 100644 packages/network/src/utils/const/client/nodes.ts delete mode 100644 packages/network/src/utils/const/client/transactions.ts delete mode 100644 packages/network/src/utils/const/index.ts delete mode 100644 packages/network/src/utils/const/network/index.ts delete mode 100644 packages/network/src/utils/const/network/network.ts delete mode 100644 packages/network/src/utils/const/rpc/index.ts delete mode 100644 packages/network/src/utils/const/rpc/rpc.ts delete mode 100644 packages/network/src/utils/const/thor-solo/index.ts delete mode 100644 packages/network/src/utils/const/thor-solo/thor-solo.ts delete mode 100644 packages/network/src/utils/helpers/index.ts delete mode 100644 packages/network/src/utils/helpers/request.ts delete mode 100644 packages/network/src/utils/index.ts delete mode 100644 packages/network/src/utils/poll/event.ts delete mode 100644 packages/network/src/utils/poll/index.ts delete mode 100644 packages/network/src/utils/poll/sync.ts delete mode 100644 packages/network/src/utils/poll/types.d.ts delete mode 100644 packages/network/src/utils/subscriptions/beat.ts delete mode 100644 packages/network/src/utils/subscriptions/block.ts delete mode 100644 packages/network/src/utils/subscriptions/event.ts delete mode 100644 packages/network/src/utils/subscriptions/index.ts delete mode 100644 packages/network/src/utils/subscriptions/transaction.ts delete mode 100644 packages/network/src/utils/subscriptions/transfer.ts delete mode 100644 packages/network/src/utils/subscriptions/types.d.ts delete mode 100644 packages/network/src/utils/thorest/helpers.ts delete mode 100644 packages/network/src/utils/thorest/index.ts delete mode 100644 packages/network/src/utils/thorest/thorest.ts delete mode 100644 packages/network/src/utils/thorest/types.d.ts delete mode 100644 packages/network/src/utils/vns/addresses.ts delete mode 100644 packages/network/src/utils/vns/index.ts delete mode 100644 packages/network/tests/fixture.ts delete mode 100644 packages/network/tests/http/SimpleHttpClient.solo.test.ts delete mode 100644 packages/network/tests/http/SimpleHttpClient.testnet.test.ts delete mode 100644 packages/network/tests/provider/fixture.ts delete mode 100644 packages/network/tests/provider/formatter/blocks-formatter.unit.test.ts delete mode 100644 packages/network/tests/provider/formatter/fixture.ts delete mode 100644 packages/network/tests/provider/formatter/transactions-formatter.unit.test.ts delete mode 100644 packages/network/tests/provider/helpers/provider-internal-wallets/base-wallet/fixture.ts delete mode 100644 packages/network/tests/provider/helpers/provider-internal-wallets/base-wallet/provider-internal-base-wallet.unit.test.ts delete mode 100644 packages/network/tests/provider/helpers/provider-internal-wallets/hd-wallet/fixture.ts delete mode 100644 packages/network/tests/provider/helpers/provider-internal-wallets/hd-wallet/provider-internal-hd-wallet.unit.test.ts delete mode 100644 packages/network/tests/provider/helpers/transaction/fixture.ts delete mode 100644 packages/network/tests/provider/helpers/transaction/transaction-helpers.unit.test.ts delete mode 100644 packages/network/tests/provider/providers/ethers/ethers-provider.mainnet.test.ts delete mode 100644 packages/network/tests/provider/providers/ethers/ethers-provider.solo.test.ts delete mode 100644 packages/network/tests/provider/providers/ethers/ethers-provider.testnet.test.ts delete mode 100644 packages/network/tests/provider/providers/fixture.ts delete mode 100644 packages/network/tests/provider/providers/hardhat/hardhat-provider.mainnet.test.ts delete mode 100644 packages/network/tests/provider/providers/hardhat/hardhat-provider.mock.mainnet.test.ts delete mode 100644 packages/network/tests/provider/providers/hardhat/hardhat-provider.solo.test.ts delete mode 100644 packages/network/tests/provider/providers/hardhat/hardhat-provider.testnet.test.ts delete mode 100644 packages/network/tests/provider/providers/helpers.ts delete mode 100644 packages/network/tests/provider/providers/vechain/vechain-provider.mainnet.test.ts delete mode 100644 packages/network/tests/provider/providers/vechain/vechain-provider.solo.test.ts delete mode 100644 packages/network/tests/provider/providers/vechain/vechain-provider.testnet.test.ts delete mode 100644 packages/network/tests/provider/providers/vechain/vechain-provider.unit.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getBadBlocks/debug_getBadBlocks.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getBadBlocks/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getRawBlock/debug_getRawBlock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getRawBlock/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getRawHeader/debug_getRawHeader.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getRawHeader/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getRawReceipts/debug_getRawReceipts.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getRawReceipts/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getRawTransaction/debug_getRawTransaction.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_getRawTransaction/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/debug_traceCall.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/debug_traceCall.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_exchangeCapabilities/engine_exchangeCapabilities.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_exchangeCapabilities/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/engine_exchangeTransitionConfigurationV1.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV1/engine_forkchoiceUpdatedV1.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV1/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV2/engine_forkchoiceUpdatedV2.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV2/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV3/engine_forkchoiceUpdatedV3.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV3/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/engine_getPayloadBodiesByHashV1.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/engine_getPayloadBodiesByRangeV1.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV1/engine_getPayloadV1.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV1/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV2/engine_getPayloadV2.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV2/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV3/engine_getPayloadV3.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV3/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV1/engine_newPayloadV1.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV1/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV2/engine_newPayloadV2.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV2/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV3/engine_newPayloadV3.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV3/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_accounts/eth_accounts.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_accounts/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.mock.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_call/eth_call.mock.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_call/eth_call.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_call/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.mainnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.mock.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_chainId/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_coinbase/eth_coinbase.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_coinbase/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_createAccessList/eth_createAccessList.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_createAccessList/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_feeHistory/eth_feeHistory.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_feeHistory/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.mainnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBalance/eth_getBalance.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBalance/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByNumber/eth_getBlockByNumber.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByNumber/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByHash/eth_getBlockTransactionCountByHash.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByHash/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/eth_getBlockTransactionCountByNumber.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getCode/eth_getCode.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getCode/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getFilterChanges/eth_getFilterChanges.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getFilterChanges/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getFilterLogs/eth_getFilterLogs.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getFilterLogs/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/eth_getLogs.mock.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/eth_getLogs.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getProof/eth_getProof.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getProof/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getStorageAt/eth_getStorageAt.mainnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getStorageAt/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockHashAndIndex.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByHash/eth_getTransactionByHash.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByHash/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionCount/eth_getTransactionCount.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionCount/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockHash/eth_getUncleCountByBlockHash.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockHash/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockNumber/eth_getUncleCountByBlockNumber.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockNumber/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getWork/eth_getWork.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_getWork/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_hashrate/eth_hashrate.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_hashrate/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_maxPriorityFeePerGas/eth_maxPriorityFeePerGas.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_maxPriorityFeePerGas/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_mining/eth_mining.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_mining/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_newBlockFilter/eth_newBlockFilter.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_newBlockFilter/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_newFilter/eth_newFilter.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_newFilter/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_newPendingTransactionFilter/eth_newPendingTransactionFilter.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_newPendingTransactionFilter/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_protocolVersion/eth_protocolVersion.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_protocolVersion/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_requestAccounts/eth_requestAccounts.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_requestAccounts/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_sendTransaction/eth_sendTransaction.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_sendTransaction/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_sign/eth_sign.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_sign/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_signTransaction/eth_signTransaction.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_signTransaction/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_submitWork/eth_submitWork.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_submitWork/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_subscribe/eth_subscribe.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_subscribe/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_syncing/eth_syncing.mock.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_syncing/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_uninstallFilter/eth_uninstallFilter.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_uninstallFilter/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_unsubscribe/eth_unsubscribe.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/eth_unsubscribe/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/evm_mine/evm_mine.mock.solo.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/evm_mine/evm_mine.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/evm_mine/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/net_listening/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/net_listening/net_listening.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/net_listening/net_listening.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/net_peerCount/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/net_peerCount/net_peerCount.mock.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/net_peerCount/net_peerCount.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/net_version/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/net_version/net_version.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/parity_nextNonce/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/parity_nextNonce/parity_nextNonce.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/txpool_content/txpool_content.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/txpool_contentFrom/txpool_contentFrom.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/txpool_inspect/txpool_inspect.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/txpool_status/txpool_status.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/web3_clientVersion/fixture.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/web3_clientVersion/web3_clientVersion.testnet.test.ts delete mode 100644 packages/network/tests/provider/rpc-mapper/methods/web3_sha3/web3_sha3.testnet.test.ts delete mode 100644 packages/network/tests/signer/signers/vechain-private-key-signer/fixture.ts delete mode 100644 packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.solo.test.ts delete mode 100644 packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.testnet.test.ts delete mode 100644 packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.unit.test.ts delete mode 100644 packages/network/tests/test-utils.ts delete mode 100644 packages/network/tests/thor-client/ThorClient.unit.test.ts delete mode 100644 packages/network/tests/thor-client/accounts/AccountsModule.solo.test.ts delete mode 100644 packages/network/tests/thor-client/accounts/AccountsModule.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/blocks/blocks.mock.solo.test.ts delete mode 100644 packages/network/tests/thor-client/blocks/blocks.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/blocks/fixture.ts delete mode 100644 packages/network/tests/thor-client/contracts/contract.erc20.solo.test.ts delete mode 100644 packages/network/tests/thor-client/contracts/contract.erc20.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/contracts/contract.erc721.solo.test.ts delete mode 100644 packages/network/tests/thor-client/contracts/contract.event.mainnet.test.ts delete mode 100644 packages/network/tests/thor-client/contracts/contract.event.solo.test.ts delete mode 100644 packages/network/tests/thor-client/contracts/contract.event.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/contracts/contract.solo.test.ts delete mode 100644 packages/network/tests/thor-client/contracts/contract.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/contracts/fixture.ts delete mode 100644 packages/network/tests/thor-client/debug/DebugModule.solo.test.ts delete mode 100644 packages/network/tests/thor-client/debug/DebugModule.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/debug/fixture-thorest.ts delete mode 100644 packages/network/tests/thor-client/gas/fixture.ts delete mode 100644 packages/network/tests/thor-client/gas/gas.solo.test.ts delete mode 100644 packages/network/tests/thor-client/logs/fixture.ts delete mode 100644 packages/network/tests/thor-client/logs/logs.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/nodes/fixture.ts delete mode 100644 packages/network/tests/thor-client/nodes/nodes.mock.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/nodes/nodes.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/transactions/fixture-thorest.ts delete mode 100644 packages/network/tests/thor-client/transactions/fixture.ts delete mode 100644 packages/network/tests/thor-client/transactions/helpers/delegation-handler.unit.test.ts delete mode 100644 packages/network/tests/thor-client/transactions/helpers/fixture.ts delete mode 100644 packages/network/tests/thor-client/transactions/transactions-thorest.solo.test.ts delete mode 100644 packages/network/tests/thor-client/transactions/transactions-thorest.testnet.test.ts delete mode 100644 packages/network/tests/thor-client/transactions/transactions.mocks.solo.test.ts delete mode 100644 packages/network/tests/thor-client/transactions/transactions.solo.test.ts delete mode 100644 packages/network/tests/thor-client/transactions/transactions.testnet.test.ts delete mode 100644 packages/network/tests/utils/poll/event/event-poll.unit.test.ts delete mode 100644 packages/network/tests/utils/poll/fixture.ts delete mode 100644 packages/network/tests/utils/poll/sync/sync-poll.unit.test.ts delete mode 100644 packages/network/tests/utils/subscriptions/fixture.ts delete mode 100644 packages/network/tests/utils/subscriptions/subscriptions.solo.test.ts delete mode 100644 packages/network/tests/utils/subscriptions/subscriptions.testnet.test.ts delete mode 100644 packages/network/tests/utils/thorest/fixture.ts delete mode 100644 packages/network/tests/utils/thorest/helpers.unit.test.ts delete mode 100644 packages/network/tests/utils/vns/lookups.mock.testnet.test.ts delete mode 100644 packages/network/tests/utils/vns/lookups.unit.test.ts delete mode 100644 packages/network/tsconfig.json delete mode 100644 packages/network/typedoc.json delete mode 100644 packages/thorest/tests/thor/transactions/EXP.solo.test.ts delete mode 100644 packages/thorest/tests/thor/transactions/EXP.testnet.test.ts delete mode 100644 packages/thorest/tests/thor/transactions/SendTransaction.solo.test.ts diff --git a/.changeset/funny-masks-cheat.md b/.changeset/funny-masks-cheat.md deleted file mode 100644 index afac35390..000000000 --- a/.changeset/funny-masks-cheat.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@vechain/sdk-core": patch -"@vechain/sdk-errors": patch -"@vechain/sdk-logging": patch -"@vechain/sdk-network": patch ---- - -First BETA release of the VeChain SDK! :D diff --git a/.changeset/pre.json b/.changeset/pre.json index 19f714c0c..6dfc0e547 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -4,8 +4,7 @@ "initialVersions": { "@vechain/sdk-core": "1.0.0", "@vechain/sdk-errors": "1.0.0", - "@vechain/sdk-logging": "1.0.0", - "@vechain/sdk-network": "1.0.0" + "@vechain/sdk-logging": "1.0.0" }, "changesets": [] } diff --git a/.github/workflows/publish-sdk.yml b/.github/workflows/publish-sdk.yml index 8e59e6301..3e2366b0d 100644 --- a/.github/workflows/publish-sdk.yml +++ b/.github/workflows/publish-sdk.yml @@ -50,14 +50,6 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Publish network - run: | - cd packages/network - yarn version --no-git-tag-version --new-version ${{ github.ref_name }} - yarn publish - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Publish logging run: | cd packages/logging diff --git a/.github/workflows/unit-integration-test.yml b/.github/workflows/unit-integration-test.yml index 918ef510a..6d1640d44 100644 --- a/.github/workflows/unit-integration-test.yml +++ b/.github/workflows/unit-integration-test.yml @@ -55,8 +55,7 @@ jobs: coverage-title: Coverage coverage-summary-path: coverage/coverage-summary.json multiple-junitxml-files: | - core, packages/core/junit.xml - network, packages/network/junit.xml + core, packages/core/junit.xml errors, packages/errors/junit.xml logging, packages/logging/junit.xml diff --git a/packages/core/README.md b/packages/core/README.md index 3b0ae4911..80387fe83 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1,24 +1,9 @@ # @vechain/sdk-core -Welcome to the **core package** of the VeChain SDK! - ## Introduction -Vechain SDK Core is a robust package meticulously crafted for dApp development and various blockchain operations that seamlessly unfold offline. This versatile toolkit empowers users to effortlessly create and sign transactions, providing a comprehensive solution for offline blockchain interactions. Explore the power of VeChain SDK Core for a smooth and efficient dApp development experience. - ## Key Features -Vechain SDK Core boasts an extensive array of functionalities tailored for VeChainThor blockchain and dApp development. Here are some standout features: - -- **Hash Functions and Public Key Cryptography**: VeChain SDK Core provides fundamental hash functions and methods for public key cryptography, ensuring the security of blockchain operations. Notable functions include Blake2b256.of, Keccak256.of, and Secp256k.of. -- **Accounts Handling**: Facilitating seamless account management, the package offers tools for private key generation, mnemonic handling, and keystore encryption/decryption. Users can efficiently manage accounts with mnemonics and keystore functionalities. -- **Transactions**: Empowering users to interact with the VeChainThor blockchain, VeChainSDK Core enables the construction, signing, and manipulation of transactions. Users can customize transactions with various clauses and gas settings, enhancing flexibility and control. -- **Recursive Length Prefix (RLP)**: The package includes robust RLP encoding and decoding capabilities, crucial for efficient data serialization and deserialization on the VeChainThor blockchain. RLP plays a pivotal role in optimizing data handling processes. -- **Certificates**: VeChain SDK Core supports the creation and verification of client-side self-signed certificates. This feature enhances security by facilitating secure identification and validation processes within the dApp ecosystem. -- **Bloom Filter**: Harnessing the power of a highly efficient Bloom filter, VeChainSDK Core optimizes element lookup within a set. This probabilistic data structure contributes to enhanced speed and efficiency in various applications, including database management, network routing, and caching systems. - -Vechain SDK Core is your go-to solution for secure, offline dApp development on the VeChainThor blockchain. Dive into a world of efficient blockchain operations and seamlessly integrate offline capabilities into your decentralized applications. - ## Commands - **Build**: Execute `yarn build` to build the package. @@ -29,7 +14,3 @@ Vechain SDK Core is your go-to solution for secure, offline dApp development on - **Test**: Execute `yarn test` to run all tests on the package. ## Usage - -Feel free to leverage these resources and don't hesitate to reach out if you have any questions or need further assistance. - -Happy coding with the VeChain SDK! diff --git a/packages/core/eslint.config.mjs b/packages/core/eslint.config.mjs index 6d343178f..357e3447e 100644 --- a/packages/core/eslint.config.mjs +++ b/packages/core/eslint.config.mjs @@ -9,8 +9,7 @@ export default [ target: "./src", from: [ "../errors", - "../logging", - "../network" + "../logging" ], message: "Please import using @vechain/sdk-", }], diff --git a/packages/core/tests/transaction/Transaction.unit.test.ts b/packages/core/tests/transaction/Transaction.unit.test.ts index ea092f77b..9bafded66 100644 --- a/packages/core/tests/transaction/Transaction.unit.test.ts +++ b/packages/core/tests/transaction/Transaction.unit.test.ts @@ -1,4 +1,4 @@ -import { describe, expect } from '@jest/globals'; +import { describe, expect, test } from '@jest/globals'; import { InvalidDataType, InvalidSecp256k1PrivateKey, diff --git a/packages/core/tests/vcdm/account/Account.unit.test.ts b/packages/core/tests/vcdm/account/Account.unit.test.ts index 50d7d099a..c50c220ec 100644 --- a/packages/core/tests/vcdm/account/Account.unit.test.ts +++ b/packages/core/tests/vcdm/account/Account.unit.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, test } from '@jest/globals'; import { Address, FixedPointNumber, Mnemonic, Account } from '../../../src'; import { VET } from '../../../src/vcdm/currency/VET'; diff --git a/packages/core/tests/vcdm/currency/Coin.unit.test.ts b/packages/core/tests/vcdm/currency/Coin.unit.test.ts index 467fa6746..dca45f419 100644 --- a/packages/core/tests/vcdm/currency/Coin.unit.test.ts +++ b/packages/core/tests/vcdm/currency/Coin.unit.test.ts @@ -1,5 +1,5 @@ +import { describe, expect, test } from '@jest/globals'; import { type Coin, FixedPointNumber, Txt, VET, VTHO } from '../../../src'; -import { expect } from '@jest/globals'; import { InvalidDataType } from '@vechain/sdk-errors'; const CoinFixure = { diff --git a/packages/core/tests/vcdm/currency/Units.unit.test.ts b/packages/core/tests/vcdm/currency/Units.unit.test.ts index 5c9650c59..5b4fb1428 100644 --- a/packages/core/tests/vcdm/currency/Units.unit.test.ts +++ b/packages/core/tests/vcdm/currency/Units.unit.test.ts @@ -1,4 +1,4 @@ -import { expect } from '@jest/globals'; +import { describe, expect, test } from '@jest/globals'; import { formatEther, formatUnits, parseEther, parseUnits } from 'viem'; import { FixedPointNumber, Units } from '../../../src'; diff --git a/packages/core/tests/vcdm/currency/VET.unit.test.ts b/packages/core/tests/vcdm/currency/VET.unit.test.ts index a44c07ad4..692446d4e 100644 --- a/packages/core/tests/vcdm/currency/VET.unit.test.ts +++ b/packages/core/tests/vcdm/currency/VET.unit.test.ts @@ -1,6 +1,6 @@ import { FixedPointNumber, Txt } from '../../../src'; import { VET } from '../../../src/vcdm/currency/VET'; -import { expect } from '@jest/globals'; +import { describe, expect, test } from '@jest/globals'; const VETFixture = { value: FixedPointNumber.of('123456789.012345678') diff --git a/packages/core/tests/vcdm/currency/VTHO.unit.test.ts b/packages/core/tests/vcdm/currency/VTHO.unit.test.ts index c53fbac45..ca9de7c71 100644 --- a/packages/core/tests/vcdm/currency/VTHO.unit.test.ts +++ b/packages/core/tests/vcdm/currency/VTHO.unit.test.ts @@ -1,4 +1,4 @@ -import { expect } from '@jest/globals'; +import { describe, expect, test } from '@jest/globals'; import { FixedPointNumber, Txt } from '../../../src'; import { VTHO } from '../../../src/vcdm/currency/VTHO'; diff --git a/packages/errors/eslint.config.mjs b/packages/errors/eslint.config.mjs index 4c0ac6d3b..ee7644462 100644 --- a/packages/errors/eslint.config.mjs +++ b/packages/errors/eslint.config.mjs @@ -10,8 +10,7 @@ export default [ from: [ "../core", - "../logging", - "../network" + "../logging" ], message: "Please import using @vechain/sdk-", diff --git a/packages/logging/eslint.config.mjs b/packages/logging/eslint.config.mjs index 410118d8c..7102e01ff 100644 --- a/packages/logging/eslint.config.mjs +++ b/packages/logging/eslint.config.mjs @@ -10,8 +10,7 @@ export default [ from: [ "../core", - "../errors", - "../network" + "../errors" ], message: "Please import using @vechain/sdk-", diff --git a/packages/network/README.md b/packages/network/README.md deleted file mode 100644 index 240bf993d..000000000 --- a/packages/network/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# @vechain/sdk-network - -Welcome to the **network package** of the VeChain SDK! - -## Introduction - -Vechain SDK Network serves as the standard interface connecting decentralized applications (dApps) and users to the VeChainThor blockchain. This versatile package is essential for dApp development and facilitates blockchain operations. Developers rely on VeChain SDK Network to effortlessly create, sign, and broadcast transactions to the VeChainThor blockchain network. - -## Key Features - -Explore the rich feature set of the VeChain SDK Network package, tailored for VeChainThor blockchain and dApp development: - -- **Blocks and Node Status**: Interact with and retrieve information about blocks on the VeChainThor blockchain.VeChain SDK Network allows developers to access block data and query the status of connected VeChain nodes. -- **Accounts**: Facilitate interactions with Externally Owned Accounts (EOAs), empowering developers to manage and transact with individual user accounts on the VeChainThor blockchain. This includes sending VET tokens and interacting with VTHO (VeThor) tokens. -- **Smart Contracts**: With VeChain SDK Network, seamlessly interact with and manage smart contracts deployed on the VeChainThor blockchain. Deploy contracts, invoke functions, and retrieve contract data effortlessly. -- **Transactions**: Initiate various transactions on the VeChainThor blockchain using VeChain SDK Network. Developers can create and broadcast transactions, including token transfers, contract interactions, and asset management. -- **Certificates**: Manage certificates and certificate-related operations on the blockchain with VeChain SDK Network. Certificates play a crucial role in identity verification and access control within dApps. -- **Queries**: Efficiently retrieve specific data from the blockchain using VeChain SDK Network's querying system. This includes querying transaction details, contract state, and other relevant blockchain information for streamlined dApp development. -- **Provider**: Provider, with his internal wallet (ProviderInternalWallet) allows the user to exploit the standard Provider structure (EIP-1193). Thanks to this, we can have the RPC on vechain! -- **Signer**: Signer is a class that allows to sign transactions and messages. - -Vechain SDK Network is your all-in-one solution for seamlessly integrating with the VeChainThor blockchain, providing a reliable and feature-rich experience for dApp developers. Dive into the world of VeChain SDK Network and elevate your decentralized applications with ease. - -## Commands - -- **Build**: Execute `yarn build` to build the package. -- **Lint**: Execute `yarn lint` to lint the package. -- **Format**: Execute `yarn format` to format the package. -- **Test:unit**: Execute `yarn test:unit` to run unit tests. -- **Test:integration**: Execute `yarn test:integration` to run integration tests. -- **Test**: Execute `yarn test` to run all tests on the package. - - **NOTE**: Tests and Integration tests require thor-solo to be running locally. You can run and stop separately thor solo node with `yarn start-thor-solo` and `yarn stop-thor-solo` or run all tests with `yarn test:solo` which will start thor solo node, run all tests and stop thor solo at the end. Same for integration tests. You can directly run `yarn test:integration:solo` to run integration tests with thor solo. - -## Usage - -Feel free to leverage these resources and don't hesitate to reach out if you have any questions or need further assistance. - -Happy coding with the VeChain SDK! diff --git a/packages/network/eslint.config.mjs b/packages/network/eslint.config.mjs deleted file mode 100644 index b6ad51e94..000000000 --- a/packages/network/eslint.config.mjs +++ /dev/null @@ -1,21 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - rules: { - "import/no-restricted-paths": ["error", { - zones: [{ - target: "./src", - - from: [ - "../core", - "../errors", - "../logging" - ], - - message: "Please import using @vechain/sdk-", - }], - }], - }, - }]; diff --git a/packages/network/jest.browser-setup.js b/packages/network/jest.browser-setup.js deleted file mode 100644 index f5a510b90..000000000 --- a/packages/network/jest.browser-setup.js +++ /dev/null @@ -1,18 +0,0 @@ -require('whatwg-fetch'); - -const fetchMock = require('jest-fetch-mock'); - -// Don't auto-enable mocks -fetchMock.dontMock(); - -// Jest configuration for WebSocket mocking based on environment -if (typeof window === 'undefined') { - // Running in Node.js environment - jest.mock('ws', () => require('ws')); -} else { - // Running in browser environment - global.WebSocket = window.WebSocket; -} - -// Make fetch global -global.fetch = fetch; \ No newline at end of file diff --git a/packages/network/jest.config.browser.js b/packages/network/jest.config.browser.js deleted file mode 100644 index 349145031..000000000 --- a/packages/network/jest.config.browser.js +++ /dev/null @@ -1,10 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: '../../customEnv.js', - setupFiles: ['./jest.browser-setup.js'], - coverageReporters: ['html', 'lcov', 'json'], - runner: 'groups', - reporters: ['default', 'jest-junit'], - workerThreads: true -}; diff --git a/packages/network/jest.config.js b/packages/network/jest.config.js deleted file mode 100644 index 27eab725f..000000000 --- a/packages/network/jest.config.js +++ /dev/null @@ -1,23 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -// Coverage threshold would apply to yarn test, not yarn test:unit -const isUnitTest = process.env.UNIT; - -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - coverageReporters: ['html', 'lcov', 'json'], - runner: 'groups', - reporters: ['default', 'jest-junit'], - workerThreads: true, - coverageThreshold: - isUnitTest !== 'true' - ? { - global: { - branches: 98, - functions: 99, - lines: 99, - statements: 99 - } - } - : undefined -}; diff --git a/packages/network/package.json b/packages/network/package.json deleted file mode 100644 index 2a19ae0c7..000000000 --- a/packages/network/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@vechain/sdk-network", - "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", - "homepage": "https://github.com/vechain/vechain-sdk-js", - "repository": { - "type": "git", - "url": "github:vechain/vechain-sdk-js" - }, - "keywords": [ - "VeChain", - "transaction", - "block", - "contract" - ], - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "files": [ - "dist", - "src", - "package.json", - "README.md", - "LICENSE" - ], - "scripts": { - "build": "rm -rf ./dist && tsup-node src/index.ts --format cjs,esm --dts", - "check:circular-dependencies": "npx madge --json --circular --extensions ts src | jq '. | length' | awk '{if($1 > 15) exit 1}'", - "lint": "eslint", - "format": "prettier --write src/**/*.ts tests/**/*.ts solo-seeding/**/*.ts", - "start-thor-solo": "echo 'Starting thor solo node ...' && docker compose -f ../../docker-compose.thor.yml up -d --wait && echo '\nThor solo node started ...'", - "stop-thor-solo": "echo 'Stopping thor solo node ...' && docker compose -f ../../docker-compose.thor.yml down && echo 'Thor solo node stopped ...'", - "test:unit": "rm -rf ./coverageUnit && UNIT=true jest --coverage --coverageDirectory=coverageUnit --group=unit", - "test:integration": "rm -rf ./coverageIntegration && jest --coverage --coverageDirectory=coverageIntegration --group=integration", - "test:integration:solo": "(yarn start-thor-solo && yarn test:integration && yarn stop-thor-solo) || yarn stop-thor-solo", - "test:browser": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit --config ./jest.config.browser.js", - "test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit", - "test:solo": "(yarn start-thor-solo && yarn test && yarn stop-thor-solo) || yarn stop-thor-solo", - "test:browser:solo": "(yarn start-thor-solo && yarn test:browser && yarn stop-thor-solo) || yarn stop-thor-solo" - }, - "dependencies": { - "@noble/curves": "^1.7.0", - "@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.5", - "isomorphic-ws": "^5.0.0", - "viem": "^2.22.8", - "ws": "^8.18.0" - }, - "devDependencies": { - "@types/ws": "^8.5.13", - "jest-fetch-mock": "^3.0.3", - "whatwg-fetch": "^3.6.20" - } -} \ No newline at end of file diff --git a/packages/network/solo-seeding/TestingContract.sol b/packages/network/solo-seeding/TestingContract.sol deleted file mode 100644 index c9ad9fc16..000000000 --- a/packages/network/solo-seeding/TestingContract.sol +++ /dev/null @@ -1,337 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.19; - -// Import the builtin contract to access extended EVM builtin functions -import "./builtin-contracts/builtin.sol"; - - -/// @title TestingContract for VeChain SDK Integration -/// @notice This contract is designed for testing various data types, error handling, -/// and state management in Solidity, particularly for SDK integration. -contract TestingContract { - - // ---------------------------- State Variables & Custom Types ---------------------------- // - - // Builtin contract to access extended EVM builtin functions - /// @dev This is a builtin contract that provides access to extended EVM builtin functions - /// @dev See: [Thor Built-ins](https://github.com/vechain/thor-builtins) - Extension extension = Builtin.getExtension(); - - // Custom struct type - struct ExampleStruct { - uint id; - string name; - } - - // Custom enum type - enum ExampleEnum { SMALL, MEDIUM, LARGE } - - // Custom error type - error CustomError(string message); - - // State variable example - uint public stateVariable = 0; - - // Mapping example - mapping(address => uint) public balances; - - // Event example - event StateChanged(uint indexed newValue, uint indexed oldValue, address indexed sender, uint timestamp); - - // Modifier example - modifier onlyPositive(uint _value) { - require(_value > 0, "Value must be positive"); - _; - } - - // ---------------------------- Functions ---------------------------- // - - // ------ State Management Functions Start ------ // - - /// @notice Set the state variable - /// @param _newValue The new value to set - function setStateVariable(uint _newValue) public { - uint oldValue = stateVariable; - stateVariable = _newValue; - emit StateChanged(_newValue, oldValue, msg.sender, block.timestamp); - } - - /// @notice Deposit funds to the contract - /// @param _amount The amount to deposit - function deposit(uint _amount) public onlyPositive(_amount) { - balances[msg.sender] += _amount; - } - - /// @notice Withdraw funds from the contract - /// @param _amount The amount to withdraw - function withdraw(uint _amount) public { - require(balances[msg.sender] >= _amount, "Insufficient balance"); - balances[msg.sender] -= _amount; - payable(msg.sender).transfer(_amount); - } - - /// @notice Retrieve the balance of a given address - /// @param _address The address to query the balance of - /// @return The balance of the address - function getBalance(address _address) public view returns (uint) { - return balances[_address]; - } - - // ------ State Management Functions End ------ // - - // ------ Data Types Start ------ // - - /// @notice Retrieve the boolean data passed - /// @param _boolData The boolean data to return - /// @return The input boolean data - function boolData(bool _boolData) public pure returns (bool) { - return _boolData; - } - - /// @notice Retrieve the int data passed - /// @param _intData The int data to return - /// @return The input int data - function intData(int _intData) public pure returns (int) { - return _intData; - } - - /// @notice Retrieve the uint data passed - /// @param _uintData The uint data to return - /// @return The input uint data - function uintData(uint _uintData) public pure returns (uint) { - return _uintData; - } - - /// @notice Retrieve the address data passed - /// @param _addressData The address data to return - /// @return The input address data - function addressData(address _addressData) public pure returns (address) { - return _addressData; - } - - /// @notice Retrieve the bytes32 data passed - /// @param _byteData The bytes32 data to return - /// @return The input bytes32 data - function bytes32Data(bytes32 _byteData) public pure returns (bytes32) { - return _byteData; - } - - /// @notice Retrieve the string data passed - /// @param _stringData The string data to return - /// @return The input string data - function stringData(string memory _stringData) public pure returns (string memory) { - return _stringData; - } - - /// @notice Retrieve the fixed array data passed - /// @param _fixedArrayData The fixed array data to return - /// @return The input fixed array data - function fixedArrayData(uint[3] memory _fixedArrayData) public pure returns (uint[3] memory) { - return _fixedArrayData; - } - - /// @notice Retrieve the dynamic array data passed - /// @param _dynamicArrayData The dynamic array data to return - /// @return The input dynamic array data - function dynamicArrayData(uint[] memory _dynamicArrayData) public pure returns (uint[] memory) { - return _dynamicArrayData; - } - - /// @notice Retrieve the struct data passed - /// @param _structData The struct data to return - /// @return The input struct data - function structData(ExampleStruct memory _structData) public pure returns (ExampleStruct memory) { - return _structData; - } - - /// @notice Retrieve the enum data passed - /// @param _enumData The enum data to return - /// @return The input enum data - function enumData(ExampleEnum _enumData) public pure returns (ExampleEnum) { - return _enumData; - } - - /// @notice Retrieve the multiple data passed - /// @param _uintData The uint data to return - /// @param _addressData The address data to return - /// @param _byteData The bytes32 data to return - function multipleData( - uint _uintData, - address _addressData, - bytes32 _byteData, - string memory _stringData, - uint[3] memory _fixedArrayData, - uint[] memory _dynamicArrayData, - ExampleStruct memory _structData, - ExampleEnum _enumData - ) - public - pure - returns ( - uint, - address, - bytes32, - string memory, - uint[3] memory, - uint[] memory, - ExampleStruct memory, - ExampleEnum - ) - { - return ( - _uintData, - _addressData, - _byteData, - _stringData, - _fixedArrayData, - _dynamicArrayData, - _structData, - _enumData - ); - } - - /// @notice Retrieve the multiple int data passed - /// @param _uint8Data The uint8 data to return - /// @param _uint16Data The uint16 data to return - /// @param _uint32Data The uint32 data to return - function multipleIntData( - uint8 _uint8Data, - uint16 _uint16Data, - uint32 _uint32Data, - uint64 _uint64Data, - uint160 _uint160Data, - uint256 _uint256Data - ) - public - pure - returns ( - uint8, - uint16, - uint32, - uint64, - uint160, - uint256 - ) - { - return ( - _uint8Data, - _uint16Data, - _uint32Data, - _uint64Data, - _uint160Data, - _uint256Data - ); - } - - // ------ Data Types End ------ // - - // ------ Error Handling Start ------ // - - /// @notice Tests for a require condition; reverts if the condition is not met - /// @dev Demonstrates error handling using 'require' - /// @param _value The value to test against the condition - function testRequireError(uint _value) public pure { - require(_value > 10, "Value must be greater than 10"); - } - - /// @notice Tests for an assert condition; fails for any value other than 0 - /// @dev Demonstrates error handling using 'assert' - /// @param _value The value to test against the condition - function testAssertError(uint _value) public pure { - assert(_value == 0); // This will fail for any value other than 0 - } - - /// @notice Reverts the transaction if the value is less than 5 - /// @param _value The value to test the condition against - function testRevertError(uint _value) public pure { - if (_value < 5) { - revert("Value must be at least 5"); - } - } - - /// @notice Reverts the transaction with a custom error if the value is not 42 - /// @param _value The value to test the condition against - function testCustomError(uint _value) public pure { - if (_value != 42) { - revert CustomError("Value is not 42"); - } - } - - /// @notice Tests for an overflow error - /// @dev Demonstrates an overflow error, should revert if the value is 255 - /// @param _value The value to test for overflow - /// @return The value plus 1 - function testOverflowError(uint8 _value) public pure returns (uint8) { - return _value + 1; // This will overflow if _value is 255 - } - - /// @notice Demonstrates an invalid opcode error - /// @dev This will always revert with an invalid opcode error - function testInvalidOpcodeError() public pure { - assembly { - invalid() // EVM invalid opcode - } - } - - // ------ Error Handling End ------ // - - // ------ VeChainThor EVM Extension functions Start ------ // - - /// @notice Get the blockID of the given block number - /// @param blockNum The block number to query - function getBlockID(uint blockNum) public view returns (bytes32) { - return extension.blockID(blockNum); - } - - /// @notice Get the block total score of the given block defined by the block number. - /// @dev The total score is the accumulated witness number (AWN) (https://docs.vechain.org/introduction-to-vechain/about-the-vechain-blockchain/consensus-deep-dive#meta-transaction-features-3) - /// @param blockNum The block number to query - function getBlockTotalScore(uint blockNum) public view returns (uint64) { - return extension.blockTotalScore(blockNum); - } - - /// @notice Get the block time of the given block number - /// @param blockNum The block number to query - function getBlockTime(uint blockNum) public view returns (uint) { - return extension.blockTime(blockNum); - } - - /// @notice Get the block signer of the given block number - /// @param blockNum The block number to query - function getBlockSigner(uint blockNum) public view returns (address) { - return extension.blockSigner(blockNum); - } - - /// @notice Get total supply of VET - function getTotalSupply() public view returns (uint256) { - return extension.totalSupply(); - } - - /// @notice Get the `provedWork` of the current transaction - function getTxProvedWork() public view returns (uint256) { - return extension.txProvedWork(); - } - - /// @notice Get the transaction ID of the current transaction - function getTxID() public view returns (bytes32) { - return extension.txID(); - } - - /// @notice Get the `blockRef` of the current transaction - function getTxBlockRef() public view returns (bytes8) { - return extension.txBlockRef(); - } - - /// @notice Get the `expiration` of the current transaction - function getTxExpiration() public view returns (uint) { - return extension.txExpiration(); - } - - /// @notice Get the data hashed using Blake2b256 - /// @param _data The data to hash - function calculateBlake2b256(bytes memory _data) public view returns (bytes32) { - return extension._blake2b256(_data); - } - - // ------ VeChainThor EVM Extension functions End ------ // -} diff --git a/packages/network/solo-seeding/builtin-contracts/authority.sol b/packages/network/solo-seeding/builtin-contracts/authority.sol deleted file mode 100644 index cfe19b73c..000000000 --- a/packages/network/solo-seeding/builtin-contracts/authority.sol +++ /dev/null @@ -1,28 +0,0 @@ -pragma solidity 0.8.19; - -/// @title Authority is related to the POA(proof of authority) consensus mechanism. -/// The Authority contract manages a list of candidates proposers who is responsible for packing transactions into a block. -/// The proposers are authorized by a voting committee, but only the first 101 proposers in the candidates list can pack block. -/// A candidates propser include signer address, endorsor address and identity. -/// Signer address is releated to sign a block, endorsor address is used for charging miner's fee and identity is used for identifying the proposer. - -interface Authority { - - /// @return executor address - function executor() external view returns(address); - - /// @notice add a proposer to the candidates lists. - function add(address _signer, address _endorsor, bytes32 _identity) external; - - /// @notice remove proposer '_signer' from the candidates lists. - function revoke(address _signer) external; - - /// @notice get information about proposer "_signer" - function get(address _signer) external view returns(bool listed, address endorsor, bytes32 identity, bool active); - - /// @notice get the first proposer in the candidates list. - function first() external view returns(address); - - /// @notice get next one of proposer "_signer" - function next(address _signer) external view returns(address); -} \ No newline at end of file diff --git a/packages/network/solo-seeding/builtin-contracts/builtin.sol b/packages/network/solo-seeding/builtin-contracts/builtin.sol deleted file mode 100644 index 14b5ca8e0..000000000 --- a/packages/network/solo-seeding/builtin-contracts/builtin.sol +++ /dev/null @@ -1,146 +0,0 @@ -pragma solidity 0.8.19; - -import "./prototype.sol"; -import "./energy.sol"; -import "./authority.sol"; -import "./extension.sol"; -import "./params.sol"; -import "./executor.sol"; - -/** - * @title Builtin - * @dev The VeChainThor builtin contracts are encapsulated in library Builtin. - * It's very easy to use it for the developer, just need import it. - */ -library Builtin { - function bytesToAddress(bytes memory b) public pure returns (address) { - require(b.length <= 20, "Byte array must be less than or equal to 20 bytes"); - - uint160 addr; - // Take the last 20 bytes and convert them to address - assembly { - addr := mload(add(b, 32)) - } - return address(addr); - } - - /// @return the instance of the contract "Authority". - function getAuthority() internal pure returns(Authority) { - return Authority(0x0000000000000000000000417574686f72697479); - } - - /// @return the instance of the contract "Energy". - function getEnergy() internal pure returns(Energy) { - return Energy(0x0000000000000000000000000000456E65726779); - } - - /// @return the instance of the contract "Extension". - function getExtension() internal pure returns(Extension) { - return Extension(0x0000000000000000000000457874656E73696F6e); - } - - /// @return the instance of the contract "Params". - function getParams() internal pure returns(Params) { - return Params(0x0000000000000000000000000000506172616D73); - } - - /// @return the instance of the contract "Executor". - function getExecutor() internal pure returns(Executor) { - return Executor(0x0000000000000000000000004578656375746f72); - } - - Energy constant energy = Energy(0x0000000000000000000000000000456E65726779); - - /// @return amount of VeThor in account 'self'. - function $energy(address self) internal view returns(uint256 amount){ - return energy.balanceOf(self); - } - - /// @notice transfer 'amount' of VeThor from msg sender to account 'self'. - function $transferEnergy(address self, uint256 amount) internal{ - energy.transfer(self, amount); - } - - /// @notice transfer 'amount' of VeThor from account 'self' to account 'to'. - function $moveEnergyTo(address self, address to, uint256 amount) internal{ - energy.move(self, to, amount); - } - - Prototype constant prototype = Prototype(0x000000000000000000000050726f746F74797065); - - /// @return master address of self - function $master(address self) internal view returns(address){ - return prototype.master(self); - } - - /// @notice 'newMaster' will be set to contract 'self' and this function only works when msg sender is the old master. - function $setMaster(address self, address newMaster) internal { - prototype.setMaster(self, newMaster); - } - - /// @return the amount of VET at blockNumber - function $balance(address self, uint blockNumber) internal view returns(uint256){ - return prototype.balance(self, blockNumber); - } - - /// @return the amount of energy at blockNumber - function $energy(address self, uint blockNumber) internal view returns(uint256){ - return prototype.energy(self, blockNumber); - } - - /// @notice 'self' check if address self is a contract account - function $hasCode(address self) internal view returns(bool){ - return prototype.hasCode(self); - } - - /// @return value indexed by key at self storage - function $storageFor(address self, bytes32 key) internal view returns(bytes32){ - return prototype.storageFor(self, key); - } - - /// @return credit - The credit of contract 'self' - /// @return recoveryRate - The recovery rate of contract 'self' - function $creditPlan(address self) internal view returns(uint256 credit, uint256 recoveryRate){ - return prototype.creditPlan(self); - } - - /// @notice set creditPlan to contract 'self' - function $setCreditPlan(address self, uint256 credit, uint256 recoveryRate) internal{ - prototype.setCreditPlan(self, credit, recoveryRate); - } - - /// @notice check if address 'user' is the user of contract 'self'. - function $isUser(address self, address user) internal view returns(bool){ - return prototype.isUser(self, user); - } - - /// @notice return the current credit of 'user' of the contract 'self'. - function $userCredit(address self, address user) internal view returns(uint256){ - return prototype.userCredit(self, user); - } - - /// @notice add address 'user' to the user list of a contract 'self'. - function $addUser(address self, address user) internal{ - prototype.addUser(self, user); - } - - /// @notice remove 'user' from the user list of a contract 'self'. - function $removeUser(address self, address user) internal{ - prototype.removeUser(self, user); - } - - /// @notice check if 'sponsorAddress' is the sponser of contract 'self'. - function $isSponsor(address self, address sponsor) internal view returns(bool){ - return prototype.isSponsor(self, sponsor); - } - - /// @notice select 'sponsorAddress' to be current selected sponsor of contract 'self' - function $selectSponsor(address self, address sponsor) internal{ - prototype.selectSponsor(self, sponsor); - } - - /// @notice return current selected sponsor of contract 'self' - function $currentSponsor(address self) internal view returns(address){ - return prototype.currentSponsor(self); - } -} diff --git a/packages/network/solo-seeding/builtin-contracts/energy.sol b/packages/network/solo-seeding/builtin-contracts/energy.sol deleted file mode 100644 index c8abbb223..000000000 --- a/packages/network/solo-seeding/builtin-contracts/energy.sol +++ /dev/null @@ -1,47 +0,0 @@ -pragma solidity 0.8.19; - -/// @title Energy represents the sub-token in VeChainThor which conforms VIP180(ERC20) standard. -/// The name of token is "VeThor" and 1 THOR equals to 1e18 wei. The main function of VeThor is to pay for the transaction fee. -/// VeThor is generated from VET, so the initial supply of VeThor is zero in the genesis block. -/// The growth rate of VeThor is 5000000000 wei per token(VET) per second, that is to say 1 VET will produce about 0.000432 THOR per day. -/// The miner will charge 30 percent of transation fee and 70 percent will be burned. So the total supply of VeThor is dynamic. - -interface Energy { - //// @return TOKEN name: "VeThor". - function name() external pure returns (string memory); - - /// @notice 1e18 wei is equal to 1 THOR - /// @return 18 - function decimals() external pure returns (uint8); - - /// @return "VTHO" - function symbol() external pure returns (string memory); - - /// @return total supply of VeThor - function totalSupply() external view returns (uint256); - - /// @return total amount of burned VeThor - function totalBurned() external view returns(uint256); - - /// @return balance - amount of VeThor in account '_owner'. - function balanceOf(address _owner) external view returns (uint256 balance); - - /// @notice transfer '_amount' of VeThor from msg sender to account '_to' - function transfer(address _to, uint256 _amount) external returns (bool success); - - /// @notice It's not a VIP180(ERC20)'s standard method. - /// transfer '_amount' of VeThor from account '_from' to account '_to' - /// If account '_from' is an external account, '_from' must be the msg sender, or - /// if account '_from' is a contract account, msg sender must be the master of contract '_from'. - function move(address _from, address _to, uint256 _amount) external returns (bool success); - - /// @notice It's a VIP180(ERC20)'s standard method. - function transferFrom(address _from, address _to, uint256 _amount) external returns(bool success); - - /// @notice It's a VIP180(ERC20)'s standard method. - /// @return remaining - remaining amount of VeThor that the '_spender' is able to withdraw from '_owner'. - function allowance(address _owner, address _spender) external view returns (uint256 remaining); - - /// @notice It's a VIP180(ERC20)'s standard method which means approving a '_value' to be transferred to _spender from msg sender. - function approve(address _spender, uint256 _value) external returns (bool success); -} diff --git a/packages/network/solo-seeding/builtin-contracts/executor.sol b/packages/network/solo-seeding/builtin-contracts/executor.sol deleted file mode 100644 index e03ae14fa..000000000 --- a/packages/network/solo-seeding/builtin-contracts/executor.sol +++ /dev/null @@ -1,38 +0,0 @@ -pragma solidity 0.8.19; - -/// @title Executor represents core component for on-chain governance. -/// The on-chain governance params can be changed by the Executor through a voting. -/// A executive committee are composed to seven approvers who had been added to the contract Executor in the genesis block. -/// The new approver can be added and the old approver also can be removed from the executive committee. -/// The steps of executor include proposing, approving and executing voting if the voting was passed. -/// Only the approver in the executive committee has the authority to propose and approving a voting. - -interface Executor { - /// @notice proposing a voting from a approver - /// @param _target a contract address, it will be executed if the voting is passed. - /// @param _data call data, usually composed to method ID plus input data. - function propose(address _target, bytes memory _data) external returns(bytes32); - - /// @notice approving a voting from a approver - /// @param _proposalID identify a voting - function approve(bytes32 _proposalID) external; - - /// @notice If the voting is passed, the '_proposalID' will be executed. - /// If the two-thirds of approvers in the executive committee approve a voting, the voting will be passed. - /// The voting must be finished one week, or it will be faied no matter pass or not. - function execute(bytes32 _proposalID) external; - - /// @notice add new a new pprover '_approver' to the executive committee - /// @param _approver account address of the '_approver' - /// @param _identity the id of the '_approver' - function addApprover(address _approver, bytes32 _identity) external; - - /// @notice remove an old approver '_approver' from the executive committee - function revokeApprover(address _approver) external; - - /// @notice The contract which is attached can propose a voting - function attachVotingContract(address _contract) external; - - /// @notice detach a voting - function detachVotingContract(address _contract) external; -} \ No newline at end of file diff --git a/packages/network/solo-seeding/builtin-contracts/extension.sol b/packages/network/solo-seeding/builtin-contracts/extension.sol deleted file mode 100644 index 7c08c84e6..000000000 --- a/packages/network/solo-seeding/builtin-contracts/extension.sol +++ /dev/null @@ -1,29 +0,0 @@ -pragma solidity 0.8.19; - -/// @title Extension extends EVM functions. -/// Extension gives an opportunity for the developer to get information of the current transaction and any history block within the range of genesis to best block. -/// The information obtained based on block numer includes blockID, blockTotalScore, blockTime and blockSigner. -/// The developer can also get the current transaction information, including txProvedWork, txID, txBlockRef and txExpiration. - -interface Extension { - /// @notice blake2b256 computes blake2b-256 checksum for given data. - function blake2b256(bytes memory _value) external view returns(bytes32); - - /// @notice These functions return corresponding block info from genesis to best block. - function blockID(uint num) external view returns(bytes32); - function blockTotalScore(uint num) external view returns(uint64); - function blockTime(uint num) external view returns(uint); - function blockSigner(uint num) external view returns(address); - - /// @return total supply of VET - function totalSupply() external view returns(uint256); - - /// @notice These funtions return corresponding current transaction info. - function txProvedWork() external view returns(uint256); - function txID() external view returns(bytes32); - function txBlockRef() external view returns(bytes8); - function txExpiration() external view returns(uint); - - /// @notice Get the account that pays the TX fee at runtime. - function txGasPayer() external view returns(address); -} \ No newline at end of file diff --git a/packages/network/solo-seeding/builtin-contracts/params.sol b/packages/network/solo-seeding/builtin-contracts/params.sol deleted file mode 100644 index c73895aff..000000000 --- a/packages/network/solo-seeding/builtin-contracts/params.sol +++ /dev/null @@ -1,13 +0,0 @@ -pragma solidity 0.8.19; - -/// @title Params stores the governance params of VeChainThor. -/// The params can be set by the executor, a contract that is authorized to modify governance params by a voting Committee. -/// Anyone can get the params just by calling "get" funtion. -/// The governance params is written in genesis block at launch time. -/// You can check these params at source file: https://github.com/vechain/thor/blob/master/thor/params.go. - -interface Params { - function executor() external view returns(address); - function set(bytes32 _key, uint256 _value) external; - function get(bytes32 _key) external view returns(uint256); -} \ No newline at end of file diff --git a/packages/network/solo-seeding/builtin-contracts/prototype.sol b/packages/network/solo-seeding/builtin-contracts/prototype.sol deleted file mode 100644 index 886aca9b6..000000000 --- a/packages/network/solo-seeding/builtin-contracts/prototype.sol +++ /dev/null @@ -1,79 +0,0 @@ -pragma solidity 0.8.19; - -// Prototype is an account management model of VeChainThor. -// In the account management model every contract has a master account, which, by default, is the creator of a contract. -// The master account plays the role of a contract manager, which has some authorities including -// "setMaster", "setCreditPlan", "addUser", "removeUser" and "selectSponsor". -// Every contract keeps a list of users who can call the contract for free but limited by credit. -// The user of a specific contract can be either added or removed by the contract master. -// Although from a user's perspective the fee is free, it is paid by a sponsor of the contract. -// Any one can be a sponser of a contract, just by calling sponsor function, and also the sponsor identity can be cancelled by calling unsponsor funtion. -// A contract may have more than one sponsors, but only the current sponsor chosen by master need to pay the fee for the contract. -// If the current sponsor is out of energy, master can select sponser from other sponsers candidates by calling selectSponsor function. -// The creditPlan can be set by the master which includes credit and recoveryRate. Every user have the same original credit. -// Every Transaction consumes some amount of credit which is equal to the fee of the Transaction, and the user can also pay the fee by itself if the gas payer is out of the credit. -// The credit can be recovered based on recoveryRate (per block). - -interface Prototype { - /// @param self contract address - /// @return master address of self - function master(address self) external view returns(address); - - /// @notice 'newMaster' will be set to contract 'self' and this function only works when msg sender is the old master. - /// @param self contract address - /// @param newMaster new master account which will be set. - function setMaster(address self, address newMaster) external; - - /// @param self account address which may be contract account or external account address. - /// @param blockNumber balance will be calculated at blockNumber - /// @return the amount of VET at blockNumber - function balance(address self, uint blockNumber) external view returns(uint256); - - /// @param self account address which may be contract account or external account address. - /// @param blockNumber energy will be calculated at blockNumber - /// @return the amount of energy at blockNumber - function energy(address self, uint blockNumber) external view returns(uint256); - - /// @param self check if address self is a contract account - function hasCode(address self) external view returns(bool); - - /// @param self contract address - /// @return value indexed by key at self storage - function storageFor(address self, bytes32 key) external view returns(bytes32); - - /// @param self contract address - /// @return credit and recoveryRate of contract 'self' - function creditPlan(address self) external view returns(uint256 credit, uint256 recoveryRate); - - /// @param self contract address - /// @param credit original credit - /// @param recoveryRate recovery rate of credit - function setCreditPlan(address self, uint256 credit, uint256 recoveryRate) external; - - /// @notice check if address 'user' is the user of contract 'self'. - function isUser(address self, address user) external view returns(bool); - - /// @notice return the current credit of 'user' of the contract 'self'. - function userCredit(address self, address user) external view returns(uint256); - - /// @notice add address 'user' to the user list of a contract 'self'. - function addUser(address self, address user) external; - - /// @notice remove 'user' from the user list of a contract 'self'. - function removeUser(address self, address user) external; - - /// @notice msg sender volunteers to be a sponsor of the contract 'self'. - function sponsor(address self) external; - - /// @notice msg sender removes itself from the sponsor candidates list of contract 'self'. - function unsponsor(address self) external; - - /// @notice check if 'sponsorAddress' is the sponser of contract 'self'. - function isSponsor(address self, address sponsorAddress) external view returns(bool); - - /// @notice select 'sponsorAddress' to be current selected sponsor of contract 'self' - function selectSponsor(address self, address sponsorAddress) external; - - /// @notice return current selected sponsor of contract 'self' - function currentSponsor(address self) external view returns(address); -} \ No newline at end of file diff --git a/packages/network/src/http/HttpClient.ts b/packages/network/src/http/HttpClient.ts deleted file mode 100644 index 84f1dc1a4..000000000 --- a/packages/network/src/http/HttpClient.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { type HttpMethod } from './HttpMethod'; -import { type HttpParams } from './HttpParams'; - -/** - * Interface representing an HTTP client. - * - * The HttpClient interface provides methods for making HTTP requests - */ -export interface HttpClient { - /** - * The base URL for the API requests. - * This endpoint serves as the root URL for constructing all subsequent API calls. - */ - baseURL: string; - - /** - * Makes an HTTP GET request to the specified path with optional query parameters. - * - * @param {string} path - The endpoint path for the GET request. - * @param {HttpParams} [params] - Optional query parameters to include in the request. - * @return {Promise} A promise that resolves to the response of the GET request. - */ - get: (path: string, params?: HttpParams) => Promise; - - /** - * Sends an HTTP request using the specified method, path, and optional parameters. - * - * @param {HttpMethod} method - The HTTP method to be used for the request (e.g., 'GET', 'POST'). - * @param {string} path - The endpoint path for the HTTP request. - * @param {HttpParams} [params] - Optional parameters to include in the HTTP request. - * @returns {Promise} A promise that resolves with the response of the HTTP request. - */ - http: ( - method: HttpMethod, - path: string, - params?: HttpParams - ) => Promise; - - /** - * Sends a POST request to the specified path with the given parameters. - * - * @param {string} path - The endpoint to which the POST request is sent. - * @param {HttpParams} [params] - Optional parameters to be included in the POST request body. - * @returns {Promise} - A promise that resolves to the response of the POST request. - */ - post: (path: string, params?: HttpParams) => Promise; -} diff --git a/packages/network/src/http/HttpMethod.ts b/packages/network/src/http/HttpMethod.ts deleted file mode 100644 index ba7f304f1..000000000 --- a/packages/network/src/http/HttpMethod.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Enumeration for HTTP methods. - * - * @property {string} GET - The GET method requests a representation of the specified resource. - * @property {string} POST - The POST method is used to submit data to be processed to a specified resource. - */ -export enum HttpMethod { - GET = 'GET', - POST = 'POST' -} diff --git a/packages/network/src/http/HttpParams.ts b/packages/network/src/http/HttpParams.ts deleted file mode 100644 index 293ab6d97..000000000 --- a/packages/network/src/http/HttpParams.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Represents the parameters for making an HTTP request. - * - * This interface specifies options for configuring an HTTP request, - * including query parameters, request body, custom headers, - * and a function to validate response headers. - */ -export interface HttpParams { - /** - * The request body, which can be of any type. - */ - body?: unknown; - - /** - * Custom headers to be included in the request. - */ - headers?: Record; - - /** - * Query parameters to include in the request. - */ - query?: Record; - - /** - * A callback function to validate response headers. - * @param headers - The response headers to validate. - */ - validateResponseHeader?: (headers: Record) => void; -} diff --git a/packages/network/src/http/SimpleHttpClient.ts b/packages/network/src/http/SimpleHttpClient.ts deleted file mode 100644 index 39ec1c063..000000000 --- a/packages/network/src/http/SimpleHttpClient.ts +++ /dev/null @@ -1,155 +0,0 @@ -import { HttpMethod } from './HttpMethod'; -import { InvalidHTTPRequest } from '@vechain/sdk-errors'; -import { type HttpClient } from './HttpClient'; -import { type HttpParams } from './HttpParams'; - -/** - * This class implements the HttpClient interface using the Fetch API. - * - * The SimpleHttpClient allows making {@link HttpMethod} requests with timeout - * and base URL configuration. - */ -class SimpleHttpClient implements HttpClient { - /** - * Represent the default timeout duration for network requests in milliseconds. - */ - public static readonly DEFAULT_TIMEOUT = 30000; - - /** - * Return the root URL for the API endpoints. - */ - public readonly baseURL: string; - - public readonly headers: HeadersInit; - - /** - * Return the amount of time in milliseconds before a timeout occurs - * when requesting with HTTP methods. - */ - public readonly timeout: number; - - /** - * Constructs an instance of SimpleHttpClient with the given base URL, - * timeout period and HTTP headers. - * The HTTP headers are used each time this client send a request to the URL, - * if not overwritten by the {@link HttpParams} of the method sending the request. - * - * @param {string} baseURL - The base URL for HTTP requests. - * @param {HeadersInit} [headers=new Headers()] - The default headers for HTTP requests. - * @param {number} [timeout=SimpleHttpClient.DEFAULT_TIMEOUT] - The timeout duration in milliseconds. - */ - constructor( - baseURL: string, - headers: HeadersInit = new Headers(), - timeout: number = SimpleHttpClient.DEFAULT_TIMEOUT - ) { - this.baseURL = baseURL; - this.timeout = timeout; - this.headers = headers; - } - - /** - * Sends an HTTP GET request to the specified path with optional query parameters. - * - * @param {string} path - The endpoint path to which the HTTP GET request is sent. - * @param {HttpParams} [params] - Optional parameters for the request, - * including query parameters, headers, body, and response validation. - * {@link HttpParams.headers} override {@link SimpleHttpClient.headers}. - * @return {Promise} A promise that resolves with the response of the GET request. - */ - public async get(path: string, params?: HttpParams): Promise { - return await this.http(HttpMethod.GET, path, params); - } - - /** - * 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. 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}. - * @return {Promise} A promise that resolves to the response of the HTTP request. - * @throws {InvalidHTTPRequest} Throws an error if the HTTP request fails. - */ - public async http( - method: HttpMethod, - path: string, - params?: HttpParams - ): Promise { - const controller = new AbortController(); - const timeoutId = setTimeout(() => { - 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]) => { - url.searchParams.append(key, String(value)); - }); - } - const headers = new Headers(this.headers); - if (params?.headers !== undefined && params?.headers != null) { - Object.entries(params.headers).forEach(([key, value]) => { - headers.append(key, String(value)); - }); - } - const response = await fetch(url, { - method, - headers: params?.headers as HeadersInit, - body: - method !== HttpMethod.GET - ? JSON.stringify(params?.body) - : undefined, - signal: controller.signal - }); - if (response.ok) { - const responseHeaders = Object.fromEntries( - response.headers.entries() - ); - if ( - params?.validateResponseHeader != null && - responseHeaders != null - ) { - params.validateResponseHeader(responseHeaders); - } - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return await response.json(); - } - throw new Error(`HTTP ${response.status} ${response.statusText}`, { - cause: response - }); - } catch (error) { - throw new InvalidHTTPRequest( - 'HttpClient.http()', - (error as Error).message, - { - method, - url: `${this.baseURL}${path}` - }, - error - ); - } finally { - clearTimeout(timeoutId); - } - } - - /** - * Makes an HTTP POST request to the specified path with optional parameters. - * - * @param {string} path - The endpoint to which the POST request is made. - * @param {HttpParams} [params] - Optional parameters for the request, - * including query parameters, headers, body, and response validation. - * {@link HttpParams.headers} override {@link SimpleHttpClient.headers}. - * @return {Promise} A promise that resolves with the response from the server. - */ - public async post(path: string, params?: HttpParams): Promise { - return await this.http(HttpMethod.POST, path, params); - } -} - -export { SimpleHttpClient }; diff --git a/packages/network/src/http/index.ts b/packages/network/src/http/index.ts deleted file mode 100644 index 4b12bfc23..000000000 --- a/packages/network/src/http/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './SimpleHttpClient'; -export * from './HttpMethod'; -export type * from './HttpClient'; -export type * from './HttpParams'; diff --git a/packages/network/src/index.ts b/packages/network/src/index.ts deleted file mode 100644 index aa08e9b4f..000000000 --- a/packages/network/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as network from './network'; - -export { network }; - -export * from './network'; diff --git a/packages/network/src/network.ts b/packages/network/src/network.ts deleted file mode 100644 index 66510bcea..000000000 --- a/packages/network/src/network.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './http'; -export * from './provider'; -export * from './signer'; -export * from './thor-client'; -export * from './utils'; diff --git a/packages/network/src/provider/eip1193/index.ts b/packages/network/src/provider/eip1193/index.ts deleted file mode 100644 index 8b2ee98ba..000000000 --- a/packages/network/src/provider/eip1193/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type * from './types.d'; diff --git a/packages/network/src/provider/eip1193/types.d.ts b/packages/network/src/provider/eip1193/types.d.ts deleted file mode 100644 index 978e0bf45..000000000 --- a/packages/network/src/provider/eip1193/types.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -// @NOTE: Errors handling (https://eips.ethereum.org/EIPS/eip-1193#errors) will be delegated to `errors` package - -/** - * Interface for EIP-1193 provider request arguments. - * - * @see https://eips.ethereum.org/EIPS/eip-1193#request - */ -interface EIP1193RequestArguments { - readonly method: string; - readonly params?: unknown[]; -} - -/** - * Standardized provider interface for EIP-1193. - * - * @see https://eips.ethereum.org/EIPS/eip-1193#message - * - * The Final usage will be: - * - * ```typescript - * EIP1193ProviderMessage.request(args: EIP1193RequestArguments): Promise; - * ``` - */ -interface EIP1193ProviderMessage { - request: (args: EIP1193RequestArguments) => Promise; -} - -export { type EIP1193RequestArguments, type EIP1193ProviderMessage }; diff --git a/packages/network/src/provider/helpers/index.ts b/packages/network/src/provider/helpers/index.ts deleted file mode 100644 index 13580133b..000000000 --- a/packages/network/src/provider/helpers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './provider-internal-wallets'; diff --git a/packages/network/src/provider/helpers/provider-internal-wallets/abstract-wallet/abstract-provider-internal-wallet.ts b/packages/network/src/provider/helpers/provider-internal-wallets/abstract-wallet/abstract-provider-internal-wallet.ts deleted file mode 100644 index 241aa5fad..000000000 --- a/packages/network/src/provider/helpers/provider-internal-wallets/abstract-wallet/abstract-provider-internal-wallet.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { Address, HexUInt } from '@vechain/sdk-core'; -import { InvalidDataType } from '@vechain/sdk-errors'; -import { - type AvailableVeChainProviders, - VeChainPrivateKeySigner, - type VeChainSigner -} from '../../../../signer'; -import { - DelegationHandler, - type SignTransactionOptions -} from '../../../../thor-client'; -import { - type ProviderInternalWallet, - type ProviderInternalWalletAccount -} from '../types'; - -/** - * Abstract implementation of Provider internal wallet class. - */ -abstract class AbstractProviderInternalWallet - implements ProviderInternalWallet -{ - /** - * List of accounts in the wallet. - */ - readonly accounts: ProviderInternalWalletAccount[]; - - /** - * Options for signing a transaction with delegator. - */ - readonly delegator?: SignTransactionOptions; - - /** - * Create a new wallet. - * - * @param accounts List of accounts in the wallet. - * @param options Optional options for signing a transaction with delegator. - */ - constructor( - accounts: ProviderInternalWalletAccount[], - options?: { - delegator?: SignTransactionOptions; - } - ) { - this.accounts = accounts; - this.delegator = options?.delegator; - } - - /** - * Get a signer into the internal wallet provider - * for the given address. - * - * @param parentProvider - The parent provider of the Internal Wallet. - * @param addressOrIndex - Address of the account. - * @returns The signer for the given address. - */ - abstract getSigner( - parentProvider: AvailableVeChainProviders, - addressOrIndex?: string | number - ): Promise; - - /** - * SYNC Version of getSigner() - * - * Get a signer into the internal wallet provider - * for the given address. - * - * @param parentProvider - The parent provider of the Internal Wallet. - * @param addressOrIndex - Address or index of the account. - * @returns The signer for the given address. - */ - getSignerSync( - parentProvider: AvailableVeChainProviders, - addressOrIndex?: string | number - ): VeChainSigner | null { - // Get the account from the wallet - const signerAccount = this.getAccountSync(addressOrIndex); - - // Return a new signer (if exists) - if (signerAccount?.privateKey !== undefined) { - return new VeChainPrivateKeySigner( - signerAccount.privateKey, - parentProvider - ); - } - - // Return null if the account is not found - return null; - } - - /** - * Get the list of addresses in the wallet. - * - * @returns The list of addresses in the wallet. - */ - abstract getAddresses(): Promise; - - /** - * SYNC Version of getAddresses() - * - * Get the list of addresses in the wallet. - * - * @returns The list of addresses in the wallet. - */ - getAddressesSync(): string[] { - return this.accounts.map((account) => account.address); - } - - /** - * Get an account given an address or an index. - * - * @param addressOrIndex - Address or index of the account. - * @returns The account with the given address, or null if not found. - */ - abstract getAccount( - addressOrIndex?: string | number - ): Promise; - - /** - * SYNC Version of getAccount() - * - * Get an account given an address or an index. - * - * @param addressOrIndex - Address or index of the account. - * @returns The account with the given address, or null if not found. - * @throws {InvalidDataType} - */ - getAccountSync( - addressOrIndex?: string | number - ): ProviderInternalWalletAccount | null { - if ( - addressOrIndex === undefined || - typeof addressOrIndex === 'number' - ) { - return this.accounts[addressOrIndex ?? 0] ?? null; - } - - // Check if the address is valid - if (!Address.isValid(addressOrIndex)) { - throw new InvalidDataType( - 'AbstractProviderInternalWallet.getAccountSync()', - 'Invalid params expected an address.', - { addressOrIndex } - ); - } - - // Get the account by address - const account = this.accounts.find( - (account) => - Address.checksum(HexUInt.of(account.address)) === - Address.checksum(HexUInt.of(addressOrIndex)) - ); - return account ?? null; - } - - /** - * Get the options for signing a transaction with delegator (if any). - * - * @returns The options for signing a transaction with delegator. - */ - abstract getDelegator(): Promise; - - /** - * SYNC Version of getDelegator() - * - * Get the options for signing a transaction with delegator (if any). - * - * @returns The options for signing a transaction with delegator. - */ - getDelegatorSync(): SignTransactionOptions | null { - return DelegationHandler(this.delegator).delegatorOrNull(); - } -} - -export { AbstractProviderInternalWallet }; diff --git a/packages/network/src/provider/helpers/provider-internal-wallets/abstract-wallet/index.ts b/packages/network/src/provider/helpers/provider-internal-wallets/abstract-wallet/index.ts deleted file mode 100644 index 4c772e5bf..000000000 --- a/packages/network/src/provider/helpers/provider-internal-wallets/abstract-wallet/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './abstract-provider-internal-wallet'; diff --git a/packages/network/src/provider/helpers/provider-internal-wallets/base-wallet/index.ts b/packages/network/src/provider/helpers/provider-internal-wallets/base-wallet/index.ts deleted file mode 100644 index fbcfb6e11..000000000 --- a/packages/network/src/provider/helpers/provider-internal-wallets/base-wallet/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './provider-internal-base-wallet'; diff --git a/packages/network/src/provider/helpers/provider-internal-wallets/base-wallet/provider-internal-base-wallet.ts b/packages/network/src/provider/helpers/provider-internal-wallets/base-wallet/provider-internal-base-wallet.ts deleted file mode 100644 index 00d47ec33..000000000 --- a/packages/network/src/provider/helpers/provider-internal-wallets/base-wallet/provider-internal-base-wallet.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { type ProviderInternalWalletAccount } from '../types'; -import { type SignTransactionOptions } from '../../../../thor-client/transactions/types'; -import { - type AvailableVeChainProviders, - type VeChainSigner -} from '../../../../signer/signers/types'; -import { AbstractProviderInternalWallet } from '../abstract-wallet/abstract-provider-internal-wallet'; - -/** - * Provider internal Base wallet class. - * - * This is the most basic wallet implementation we can have: - * * This wallet is generated by a list of private keys - */ -class ProviderInternalBaseWallet extends AbstractProviderInternalWallet { - /** - * Get a signer into the internal wallet provider - * for the given address. - * - * @param parentProvider - The parent provider of the Internal Wallet. - * @param addressOrIndex - Address of the account. - * @returns The signer for the given address. - */ - async getSigner( - parentProvider: AvailableVeChainProviders, - addressOrIndex?: string | number - ): Promise { - return await Promise.resolve( - this.getSignerSync(parentProvider, addressOrIndex) - ); - } - - /** - * Get the list of addresses in the wallet. - * - * @returns The list of addresses in the wallet. - */ - async getAddresses(): Promise { - return await Promise.resolve(this.getAddressesSync()); - } - - /** - * Get an account given an address or an index. - * - * @param addressOrIndex - Address or index of the account. - * @returns The account with the given address, or null if not found. - */ - async getAccount( - addressOrIndex?: string | number - ): Promise { - return await Promise.resolve(this.getAccountSync(addressOrIndex)); - } - - /** - * Get the options for signing a transaction with delegator (if any). - * - * @returns The options for signing a transaction with delegator. - */ - async getDelegator(): Promise { - return await Promise.resolve(this.getDelegatorSync()); - } -} - -export { ProviderInternalBaseWallet }; diff --git a/packages/network/src/provider/helpers/provider-internal-wallets/hd-wallet/index.ts b/packages/network/src/provider/helpers/provider-internal-wallets/hd-wallet/index.ts deleted file mode 100644 index caf1fc273..000000000 --- a/packages/network/src/provider/helpers/provider-internal-wallets/hd-wallet/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './provider-internal-hd-wallet'; diff --git a/packages/network/src/provider/helpers/provider-internal-wallets/hd-wallet/provider-internal-hd-wallet.ts b/packages/network/src/provider/helpers/provider-internal-wallets/hd-wallet/provider-internal-hd-wallet.ts deleted file mode 100644 index ccb30ba83..000000000 --- a/packages/network/src/provider/helpers/provider-internal-wallets/hd-wallet/provider-internal-hd-wallet.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Address, HDKey, Secp256k1 } from '@vechain/sdk-core'; -import { type SignTransactionOptions } from '../../../../thor-client'; -import { ProviderInternalBaseWallet } from '../base-wallet'; - -class ProviderInternalHDWallet extends ProviderInternalBaseWallet { - /** - * Mnemonic of the wallet. - */ - readonly mnemonic: string[]; - - /** - * Derivation path of the wallet. - */ - readonly derivationPath: string; - - /** - * Number of accounts to generate. - */ - readonly count: number; - - /** - * Initial index of the accounts to generate. - */ - readonly initialIndex: number; - - /** - * Create a new HD wallet. - * - * @param mnemonic - Mnemonic of the wallet as an array of words. - * @param count - Number of accounts to generate. - * @param initialIndex - Initial index of the accounts to generate. - * @param derivationPath - Derivation path of the wallet. - * @param options - Options for signing a transaction with delegator. - */ - constructor( - mnemonic: string[], - count: number = 1, - initialIndex: number = 0, - derivationPath: string = HDKey.VET_DERIVATION_PATH, - options?: { - delegator?: SignTransactionOptions; - } - ) { - // Initialize the base wallet with the generated accounts - super( - [...Array(count).keys()].map((path: number) => { - // Convert the private key to a buffer - const privateKeyBuffer = HDKey.fromMnemonic( - mnemonic, - derivationPath - ).deriveChild(path + initialIndex).privateKey as Uint8Array; - - // Derive the public key and address from the private key - return { - privateKey: privateKeyBuffer, - publicKey: Secp256k1.derivePublicKey(privateKeyBuffer), - address: Address.ofPrivateKey(privateKeyBuffer).toString() - }; - }), - options - ); - - // Set the wallet properties - this.mnemonic = mnemonic; - this.derivationPath = derivationPath; - this.count = count; - this.initialIndex = initialIndex; - } -} - -export { ProviderInternalHDWallet }; diff --git a/packages/network/src/provider/helpers/provider-internal-wallets/index.ts b/packages/network/src/provider/helpers/provider-internal-wallets/index.ts deleted file mode 100644 index 9179095fc..000000000 --- a/packages/network/src/provider/helpers/provider-internal-wallets/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './base-wallet'; -export * from './hd-wallet'; -export type * from './types.d'; diff --git a/packages/network/src/provider/helpers/provider-internal-wallets/types.d.ts b/packages/network/src/provider/helpers/provider-internal-wallets/types.d.ts deleted file mode 100644 index 995b8101f..000000000 --- a/packages/network/src/provider/helpers/provider-internal-wallets/types.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { type SignTransactionOptions } from '../../../thor-client/transactions/types'; -import { - type AvailableVeChainProviders, - type VeChainSigner -} from '../../../signer/signers'; - -/** - * Represent a single account in a provider internal wallet. - * Basically an account is a triple of **address**, **private key** and **public key**. - */ -interface ProviderInternalWalletAccount { - /** - * Address of the account. - */ - address: string; - - /** - * Private key of the account. - */ - privateKey?: Uint8Array; - - /** - * Public key of the account. - */ - publicKey?: Uint8Array; -} - -/** - * Represent a provider internal base wallet. - * Basically it is a list {@link ProviderInternalWalletAccount} used to contain account data into provider. - * A provider internal wallet is able to generate a signer when it is needed by the provider. - * - * e.g., Provider can need the Signer with methods like eth_sendTransaction, ... - * - * @note To be compatible with provider-internal-wallet stack it is better - * to implement this interface for each kind of provider internal wallet you want to use. - */ -interface ProviderInternalWallet { - /** - * Options for signing a transaction with delegator. - */ - delegator?: SignTransactionOptions; - - /** - * List of accounts in the wallet. - */ - accounts: ProviderInternalWalletAccount[]; - - /** - * Get a signer into the internal wallet provider - * for the given address. - * - * @param parentProvider - The parent provider of the Internal Wallet. - * @param addressOrIndex - Address or index of the account. - * @returns The signer for the given address. - */ - getSigner: ( - parentProvider: AvailableVeChainProviders, - addressOrIndex?: string | number - ) => Promise; - - /** - * SYNC Version of getSigner() - * - * Get a signer into the internal wallet provider - * for the given address. - * - * @param parentProvider - The parent provider of the Internal Wallet. - * @param addressOrIndex - Address or index of the account. - * @returns The signer for the given address. - */ - getSignerSync: ( - parentProvider: AvailableVeChainProviders, - addressOrIndex?: string | number - ) => VeChainSigner | null; - - /** - * Get the list of addresses in the wallet. - * - * @returns The list of addresses in the wallet. - */ - getAddresses: () => Promise; - - /** - * SYNC Version of getAddresses() - * - * Get the list of addresses in the wallet. - * - * @returns The list of addresses in the wallet. - */ - getAddressesSync: () => string[]; - - /** - * Get an account given an address or an index. - * - * @param addressOrIndex - Address or index of the account. - * @returns The account with the given address, or null if not found. - */ - getAccount: ( - addressOrIndex?: string | number - ) => Promise; - - /** - * SYNC Version of getAccount() - * - * Get an account given an address or an index. - * - * @param addressOrIndex - Address or index of the account. - * @returns The account with the given address, or null if not found. - */ - getAccountSync: ( - addressOrIndex?: string | number - ) => ProviderInternalWalletAccount | null; - - /** - * Get the options for signing a transaction with delegator (if any). - * - * @returns The options for signing a transaction with delegator. - */ - getDelegator: () => Promise; - - /** - * SYNC Version of getDelegator() - * - * Get the options for signing a transaction with delegator (if any). - * - * @returns The options for signing a transaction with delegator. - */ - getDelegatorSync: () => SignTransactionOptions | null; -} - -export { type ProviderInternalWallet, type ProviderInternalWalletAccount }; diff --git a/packages/network/src/provider/index.ts b/packages/network/src/provider/index.ts deleted file mode 100644 index 4de59214e..000000000 --- a/packages/network/src/provider/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type * from './eip1193'; -export * from './helpers'; -export * from './providers'; -export * from './utils'; diff --git a/packages/network/src/provider/providers/ethers-provider/index.ts b/packages/network/src/provider/providers/ethers-provider/index.ts deleted file mode 100644 index 5c380f3c0..000000000 --- a/packages/network/src/provider/providers/ethers-provider/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './json-rpc-ethers-provider'; diff --git a/packages/network/src/provider/providers/ethers-provider/json-rpc-ethers-provider.ts b/packages/network/src/provider/providers/ethers-provider/json-rpc-ethers-provider.ts deleted file mode 100644 index acb461bad..000000000 --- a/packages/network/src/provider/providers/ethers-provider/json-rpc-ethers-provider.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { stringifyData } from '@vechain/sdk-errors'; -import { - JsonRpcApiProvider, - type JsonRpcError, - type JsonRpcPayload, - type JsonRpcResult -} from 'ethers'; -import { type HardhatVeChainProvider } from '../hardhat-provider/hardhat-provider'; - -/** - * JSON RPC provider for ethers. - * Needed to customize ethers functionality into hardhat plugin. - */ -class JSONRPCEthersProvider extends JsonRpcApiProvider { - /** - * Instance of Hardhat VeChain provider to wrap - */ - hardhatProvider: HardhatVeChainProvider; - - /** - * Constructor with parameters. - * - * @param chainId - The chain id of the network - * @param networkName - The name of the network - * @param hardhatProvider - The hardhat provider to wrap - */ - constructor( - chainId: number, - networkName: string, - hardhatProvider: HardhatVeChainProvider - ) { - super({ name: networkName, chainId }); - this.hardhatProvider = hardhatProvider; - } - - /** - * Override the send method to use the hardhat provider and to call _start method. - * - * @param method - The method to call - * @param params - The parameters of the method - */ - async send( - method: string, - params: unknown[] | Record - ): Promise { - // Call the _start method - this._start(); - - // Call the _send method - return (await super.send(method, params)) as unknown; - } - - /** - * Internal method to send the payload to the hardhat provider. - * This method is able to send multiple payloads. (send in batch) - * - * @param payload - The payload to send (request and method)'s - */ - async _send( - payload: JsonRpcPayload | JsonRpcPayload[] - ): Promise> { - // Initialize the request array - const requestPayloadArray = Array.isArray(payload) - ? payload - : [payload]; - - // Empty response array - const responses: Array = []; - - // Call the hardhat provider for each request - for (const jsonRpcPayload of requestPayloadArray) { - // Do the request - try { - const result = (await this.hardhatProvider.send( - jsonRpcPayload.method, - jsonRpcPayload.params as unknown[] - )) as JsonRpcResult; - - // Push the result to the response array - responses.push({ - id: jsonRpcPayload.id, - result - }); - } catch (e) { - // Push the error to the response array - responses.push({ - id: jsonRpcPayload.id, - error: { - code: -32603, - message: stringifyData(e) - } - }); - } - } - - return responses; - } -} - -export { JSONRPCEthersProvider }; diff --git a/packages/network/src/provider/providers/hardhat-provider/hardhat-provider.ts b/packages/network/src/provider/providers/hardhat-provider/hardhat-provider.ts deleted file mode 100644 index 6c4813d67..000000000 --- a/packages/network/src/provider/providers/hardhat-provider/hardhat-provider.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { VeChainProvider } from '../vechain-provider/vechain-provider'; -import type { EIP1193RequestArguments } from '../../eip1193'; -import { - JSONRPCInternalError, - stringifyData, - VechainSDKError -} from '@vechain/sdk-errors'; -import { - type BuildHardhatErrorFunction, - type JsonRpcRequest, - type JsonRpcResponse -} from './types'; -import { ThorClient } from '../../../thor-client'; -import { type ProviderInternalWallet } from '../../helpers'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; -import { SimpleHttpClient } from '../../../http'; - -/** - * This class is a wrapper for the VeChainProvider that Hardhat uses. - * - * It exposes the interface that Hardhat expects, and uses the VeChainProvider as wrapped provider. - */ -class HardhatVeChainProvider extends VeChainProvider { - /** - * Debug mode. - */ - debug: boolean; - - /** - * The function to use to build Hardhat errors. - */ - buildHardhatErrorFunctionCallback: BuildHardhatErrorFunction; - - /** - * RPC configuration. - */ - rpcConfiguration: { - ethGetTransactionCountMustReturn0: boolean; - }; - - /** - * Constructor with the network configuration. - * - * @param walletToUse - The wallet to use. - * @param nodeUrl - The node url to use - * @param buildHardhatErrorFunctionCallback - The function to use to build Hardhat errors. - * @param debug - Debug mode. - * @param enableDelegation - Enable fee delegation or not. - */ - constructor( - walletToUse: ProviderInternalWallet, - nodeUrl: string, - buildHardhatErrorFunctionCallback: BuildHardhatErrorFunction, - debug: boolean = false, - enableDelegation: boolean = false, - rpcConfiguration = { - // By default, the eth_getTransactionCount method returns a random number. - ethGetTransactionCountMustReturn0: false - } - ) { - // Initialize the provider with the network configuration. - super( - new ThorClient(new SimpleHttpClient(nodeUrl)), - walletToUse, - enableDelegation - ); - - // Save the debug mode. - this.debug = debug; - - // Save the RPC configuration. - this.rpcConfiguration = rpcConfiguration; - - // Save the buildHardhatErrorFunction. - this.buildHardhatErrorFunctionCallback = - buildHardhatErrorFunctionCallback; - } - - /** - * Overload off the send method - * - * @param method - The method to call. - * @param params - The parameters to pass to the method. - */ - async send(method: string, params?: unknown[]): Promise { - return await this.request({ - method, - params - }); - } - - /** - * Overload off the sendAsync method. - * It is the same of the send method, but with a callback. - * Instead of returning the result, it calls the callback with the result. - * - * @param payload - The request payload (it contains method and params as 'send' method). - * @param callback - The callback to call with the result. - */ - async sendAsync( - payload: JsonRpcRequest, - callback: (error: unknown, response: JsonRpcResponse) => void - ): Promise { - try { - const result = await this.request({ - method: payload.method, - params: payload.params - }); - - // Execute the callback with the result - callback(null, { - id: payload.id, - jsonrpc: '2.0', - result - }); - } catch (e) { - // Execute the callback with the error - callback(e, { - id: payload.id, - jsonrpc: '2.0' - }); - } - } - - /** - * It sends the request through the VeChainProvider. - * - * @param args - The request arguments. - */ - async request(args: EIP1193RequestArguments): Promise { - // Must return 0 with the eth_getTransactionCount method - const mustReturn0 = - this.rpcConfiguration.ethGetTransactionCountMustReturn0 && - args.method === 'eth_getTransactionCount'; - - try { - // Debug mode - get the request and the accounts - if (this.debug) { - const accounts = await ( - this.wallet as ProviderInternalWallet - ).getAddresses(); - const delegator = await ( - this.wallet as ProviderInternalWallet - ).getDelegator(); - - VeChainSDKLogger('log').log({ - title: `Sending request - ${args.method}`, - messages: [ - `params: ${stringifyData(args.params)}`, - `accounts: ${stringifyData(accounts)}`, - `delegator: ${stringifyData(delegator)}`, - `url: ${this.thorClient.httpClient.baseURL}` - ] - }); - } - // Send the request - const result = mustReturn0 - ? '0x0' - : await super.request({ - method: args.method, - params: args.params as never - }); - - // Debug mode - get the result - if (this.debug) { - VeChainSDKLogger('log').log({ - title: `Get request - ${args.method} result`, - messages: [`result: ${stringifyData(result)}`] - }); - } - - return result; - } catch (error) { - // Debug the error - if (this.debug) { - VeChainSDKLogger('error').log( - new JSONRPCInternalError( - args.method, - `Error on request - ${args.method}`, - { - args - } - ) - ); - } - - if (error instanceof VechainSDKError) { - // Throw the error - throw this.buildHardhatErrorFunctionCallback( - `Error on request ${args.method}: ${error.innerError}`, - error - ); - } - } - } -} - -export { HardhatVeChainProvider }; diff --git a/packages/network/src/provider/providers/hardhat-provider/index.ts b/packages/network/src/provider/providers/hardhat-provider/index.ts deleted file mode 100644 index 24ac358c3..000000000 --- a/packages/network/src/provider/providers/hardhat-provider/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './hardhat-provider'; -export type * from './types.d'; diff --git a/packages/network/src/provider/providers/hardhat-provider/types.d.ts b/packages/network/src/provider/providers/hardhat-provider/types.d.ts deleted file mode 100644 index f9d644441..000000000 --- a/packages/network/src/provider/providers/hardhat-provider/types.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Type for a JSON-RPC request. - * It is a wrapped JsonRpcRequest of hardhat. - * you can find the original into "hardhat/types". - * - * @note we wrap here the original type to avoid - * the usage of hardhat dependency for provider package. - */ -interface JsonRpcRequest { - jsonrpc: string; - method: string; - params: unknown[]; - id: number; -} - -/** - * Type for a JSON-RPC response. - * It is a wrapped JsonRpcResponse of hardhat. - * you can find the original into "hardhat/types". - * - * @note we wrap here the original type to avoid - * the usage of hardhat dependency for provider package. - */ -interface JsonRpcResponse { - jsonrpc: string; - id: number; - result?: unknown; - error?: { - code: number; - message: string; - data?: unknown; - }; -} - -/** - * Type for hardhat error function callback - * - * @note we use this callback to delegate the hardhat import - * to the final code who will use provider - */ -type BuildHardhatErrorFunction = (message: string, parent?: Error) => Error; - -export { - type JsonRpcRequest, - type JsonRpcResponse, - type BuildHardhatErrorFunction -}; diff --git a/packages/network/src/provider/providers/index.ts b/packages/network/src/provider/providers/index.ts deleted file mode 100644 index 269735a1c..000000000 --- a/packages/network/src/provider/providers/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './ethers-provider'; -export * from './vechain-provider'; -export * from './hardhat-provider'; diff --git a/packages/network/src/provider/providers/vechain-provider/index.ts b/packages/network/src/provider/providers/vechain-provider/index.ts deleted file mode 100644 index 8500137d6..000000000 --- a/packages/network/src/provider/providers/vechain-provider/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { VeChainProvider } from './vechain-provider'; -export type * from './types.d'; diff --git a/packages/network/src/provider/providers/vechain-provider/types.d.ts b/packages/network/src/provider/providers/vechain-provider/types.d.ts deleted file mode 100644 index d73d3a0b6..000000000 --- a/packages/network/src/provider/providers/vechain-provider/types.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Represents the parameters for a subscription. - * This interface includes all necessary details for managing a subscription. - */ -interface SubscriptionParams { - /** - * The unique identifier for the subscription. - * This string uniquely identifies the subscription instance. - */ - readonly subscription: string; - - /** - * The result associated with the subscription. - * This can be of any type and contains the data or outcome that the subscription yields. - */ - readonly result: unknown; -} - -/** - * Describes an event related to a subscription. - * This interface encapsulates the method invoked and the parameters associated with the subscription event. - */ -interface SubscriptionEvent { - /** - * The name of the method associated with the subscription event. - */ - readonly method: string; - - /** - * The parameters associated with the subscription event. - * This includes all necessary details such as the subscription identifier and the result. - */ - readonly params: SubscriptionParams; -} - -/** - * Defines the options used to filter events in a subscription. These options can specify which events to include based on various blockchain parameters. - */ -interface FilterOptions { - /** - * The contract address or addresses to filter for events. - */ - address?: string | string[]; - - /** - * The starting block number (inclusive) from which to begin filtering events. - */ - fromBlock?: string; - - /** - * The ending block number (inclusive) at which to stop filtering events. - */ - toBlock?: string; - - /** - * An array of topic identifiers to filter events. Each event must match all specified topics to be included. - */ - topics?: string[]; - - /** - * The hash of a specific block. If defined, only events from this block are included. - */ - blockhash?: string; -} - -/** - * Represents a subscription to a specific type of data or event within a system. - * This could be used for subscribing to updates or changes in the data. - */ -interface Subscription { - /** - * The type of subscription, indicating what kind of data or events this subscription pertains to. - */ - type: string; - - /** - * Optional configuration options for the subscription that can filter or modify the data received. - */ - options?: FilterOptions; -} - -interface NewHeadsSubscription { - readonly subscriptionId: string; - readonly subscription: Subscription; -} - -/** - * Manages multiple subscriptions within a system, keeping track of active subscriptions and the current block number. - */ -interface SubscriptionManager { - /** - * A map of subscription identifiers to Subscription objects, keeping track of all log-related subscriptions. - */ - logSubscriptions: Map; - - /** - * An optional collection of subscriptions specifically for new block headers, indexed by a unique identifier. - */ - newHeadsSubscription?: NewHeadsSubscription; - - /** - * The most recent block number that has been processed or observed by the manager, serving as a point of reference for new events. - */ - currentBlockNumber: number; -} - -export { type SubscriptionEvent, type SubscriptionManager, type FilterOptions }; diff --git a/packages/network/src/provider/providers/vechain-provider/vechain-provider.ts b/packages/network/src/provider/providers/vechain-provider/vechain-provider.ts deleted file mode 100644 index c5bc3263e..000000000 --- a/packages/network/src/provider/providers/vechain-provider/vechain-provider.ts +++ /dev/null @@ -1,302 +0,0 @@ -import { HexInt } from '@vechain/sdk-core'; -import { JSONRPCMethodNotFound } from '@vechain/sdk-errors'; -import { EventEmitter } from 'events'; -import { type VeChainSigner } from '../../../signer'; -import { - type CompressedBlockDetail, - type ThorClient -} from '../../../thor-client'; -import { type EventPoll, Poll, vnsUtils } from '../../../utils'; -import { - type EIP1193ProviderMessage, - type EIP1193RequestArguments -} from '../../eip1193'; -import { type ProviderInternalWallet } from '../../helpers'; -import { - ethGetLogs, - POLLING_INTERVAL, - RPC_METHODS, - RPCMethodsMap -} from '../../utils'; -import { - type FilterOptions, - type SubscriptionEvent, - type SubscriptionManager -} from './types'; - -/** - * Our core provider class for VeChain - */ -class VeChainProvider extends EventEmitter implements EIP1193ProviderMessage { - public readonly subscriptionManager: SubscriptionManager = { - logSubscriptions: new Map(), - currentBlockNumber: 0 - }; - - /** - * Poll instance for subscriptions - * - * @private - */ - private pollInstance?: EventPoll; - - /** - * Constructor for VeChainProvider - * - * @param thorClient - ThorClient instance. - * @param wallet - ProviderInternalWallet instance. It is optional because the majority of the methods do not require a wallet. - * @param enableDelegation - Enable fee delegation or not. - * @throws {JSONRPCInvalidParams} - * - */ - constructor( - readonly thorClient: ThorClient, - readonly wallet?: ProviderInternalWallet, - readonly enableDelegation: boolean = false - ) { - super(); - } - - /** - * Destroys the provider by closing the thorClient and stopping the provider poll instance if present. - * This is because thorClient and the provider might be initialized with a polling interval. - */ - public destroy(): void { - this.thorClient.destroy(); - if (this.pollInstance !== undefined) { - this.pollInstance.stopListen(); - this.pollInstance = undefined; - } - } - - /** - * This method is used to send a request to the provider. - * Basically, it is a wrapper around the RPCMethodsMap. - * - * @param args - Method and parameters to be used for the request. - * @returns The result of the request. - * @throws {JSONRPCMethodNotFound} - */ - public async request(args: EIP1193RequestArguments): Promise { - // Check if the method is supported - if ( - !Object.values(RPC_METHODS) - .map((key) => key.toString()) - .includes(args.method) - ) { - throw new JSONRPCMethodNotFound( - 'VeChainProvider.request()', - 'Method not found. Invalid RPC method given as input.', - { method: args.method } - ); - } - - // Get the method from the RPCMethodsMap and call it - return await RPCMethodsMap(this.thorClient, this)[args.method]( - args.params as unknown[] - ); - } - - /** - * Initializes and starts the polling mechanism for subscription events. - * This method sets up an event poll that periodically checks for new events related to active - * subscriptions, such as 'newHeads' or log subscriptions. When new data is available, it emits - * these events to listeners. - * - * This method leverages the `Poll.createEventPoll` utility to create the polling mechanism, - * which is then started by invoking `startListen` on the poll instance. - */ - public startSubscriptionsPolling(): boolean { - let result = false; - if (this.pollInstance === undefined) { - this.pollInstance = Poll.createEventPoll(async () => { - const data: SubscriptionEvent[] = []; - - const currentBlock = await this.getCurrentBlock(); - - if (currentBlock !== null) { - if ( - this.subscriptionManager.newHeadsSubscription !== - undefined - ) { - data.push({ - method: 'eth_subscription', - params: { - subscription: - this.subscriptionManager - .newHeadsSubscription.subscriptionId, - result: currentBlock - } - }); - } - if (this.subscriptionManager.logSubscriptions.size > 0) { - const logs = await this.getLogsRPC(); - data.push(...logs); - } - - this.subscriptionManager.currentBlockNumber++; - } - return data; - }, POLLING_INTERVAL).onData( - (subscriptionEvents: SubscriptionEvent[]) => { - subscriptionEvents.forEach((event) => { - this.emit('message', event); - }); - } - ); - - this.pollInstance.startListen(); - result = true; - } - return result; - } - - /** - * Stops the polling mechanism for subscription events. - * This method stops the polling mechanism for subscription events, if it is active. - * - * @returns {boolean} A boolean indicating whether the polling mechanism was stopped. - */ - public stopSubscriptionsPolling(): boolean { - let result = false; - if (this.pollInstance !== undefined) { - this.pollInstance.stopListen(); - this.pollInstance = undefined; - result = true; - } - return result; - } - - /** - * Checks if there are active subscriptions. - * This method checks if there are any active log subscriptions or a new heads subscription. - * - * @returns {boolean} A boolean indicating whether there are active subscriptions. - */ - public isThereActiveSubscriptions(): boolean { - return ( - this.subscriptionManager.logSubscriptions.size > 0 || - this.subscriptionManager.newHeadsSubscription !== undefined - ); - } - - /** - * Returns the poll instance for subscriptions. - */ - public getPollInstance(): EventPoll | undefined { - return this.pollInstance; - } - - /** - * Fetches logs for all active log subscriptions managed by `subscriptionManager`. - * This method iterates over each log subscription, constructs filter options based on the - * subscription details, and then queries for logs using these filter options. - * - * Each log query is performed asynchronously, and the method waits for all queries to complete - * before returning. The result for each subscription is encapsulated in a `SubscriptionEvent` - * object, which includes the subscription ID and the fetched logs. - * - * This function is intended to be called when there's a need to update or fetch the latest - * logs for all active subscriptions, typically in response to a new block being mined or - * at regular intervals to keep subscription data up to date. - * - * @returns {Promise} A promise that resolves to an array of `SubscriptionEvent` - * objects, each containing the subscription ID and the corresponding logs fetched for that - * subscription. The promise resolves to an empty array if there are no active log subscriptions. - */ - private async getLogsRPC(): Promise { - // Convert the logSubscriptions Map to an array of promises, each promise corresponds to a log fetch operation - const promises = Array.from( - this.subscriptionManager.logSubscriptions.entries() - ).map(async ([subscriptionId, subscriptionDetails]) => { - const currentBlock = HexInt.of( - this.subscriptionManager.currentBlockNumber - ).toString(); - // Construct filter options for the Ethereum logs query based on the subscription details - const filterOptions: FilterOptions = { - address: subscriptionDetails.options?.address, // Contract address to filter the logs by - fromBlock: currentBlock, - toBlock: currentBlock, - topics: subscriptionDetails.options?.topics // Topics to filter the logs by - }; - - // Fetch logs based on the filter options and construct a SubscriptionEvent object - return { - method: 'eth_subscription', - params: { - subscription: subscriptionId, // Subscription ID - result: await ethGetLogs(this.thorClient, [filterOptions]) // The actual log data fetched from Ethereum node - } - }; - }); - - // Wait for all log fetch operations to complete and return an array of SubscriptionEvent objects - const subscriptionEvents = await Promise.all(promises); - // Filter out empty results - return subscriptionEvents.filter( - (event) => event.params.result.length > 0 - ); - } - - /** - * Fetches the current block details from the VeChain node. - * - * @private - */ - private async getCurrentBlock(): Promise { - // Initialize the result to null, indicating no block found initially - let result: CompressedBlockDetail | null = null; - - // Proceed only if there are active log subscriptions or a new heads subscription is present - if (this.isThereActiveSubscriptions()) { - // Fetch the block details for the current block number - const block = await this.thorClient.blocks.getBlockCompressed( - this.subscriptionManager.currentBlockNumber - ); - - // If the block is successfully fetched (not undefined or null), update the result and increment the block number - if (block !== undefined && block !== null) { - result = block; // Set the fetched block as the result - } - } - - // Return the fetched block details or null if no block was fetched - return result; - } - - /** - * Get a signer into the internal wallet provider - * for the given address. - * - * @param addressOrIndex - Address of index of the account. - * @returns The signer for the given address. - */ - async getSigner( - addressOrIndex?: string | number - ): Promise { - if (this.wallet === undefined) { - return null; - } - return await this.wallet?.getSigner(this, addressOrIndex); - } - - /** - * Use vet.domains to resolve name to address - * @param vnsName - The name to resolve - * @returns the address for a name or null - */ - async resolveName(vnsName: string): Promise { - return await vnsUtils.resolveName(this.thorClient, vnsName); - } - - /** - * Use vet.domains to look up a verified primary name for an address - * @param address - The address to lookup - * @returns the primary name for an address or null - */ - async lookupAddress(address: string): Promise { - return await vnsUtils.lookupAddress(this.thorClient, address); - } -} - -export { VeChainProvider }; diff --git a/packages/network/src/provider/utils/const/blocks/blocks.ts b/packages/network/src/provider/utils/const/blocks/blocks.ts deleted file mode 100644 index 465a05bcc..000000000 --- a/packages/network/src/provider/utils/const/blocks/blocks.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Hex } from '@vechain/sdk-core'; -import { type BlockQuantityInputRPC } from '../../rpc-mapper/types'; - -/** - * Get the correct block number for the given block number. - * - * @param block - The block tag to get. - * 'latest' or 'earliest' or 'pending' or 'safe' or 'finalized' - * or an object: { blockNumber: number } or { blockHash: string } - * - * @note - * * Currently VeChainThor supports 'earliest', 'latest' and 'finalized' as block tags. - * So 'pending' and 'safe' are converted to 'best' which is the alias for 'latest' and 'finalized' in VeChainThor. - */ -const getCorrectBlockNumberRPCToVeChain = ( - block: BlockQuantityInputRPC -): string => { - // Tag block number - if (typeof block === 'string') { - // Latest, Finalized, Safe blocks - if ( - block === 'latest' || - block === 'finalized' || - block === 'safe' || - block === 'pending' - ) - // 'best' is the alias for 'latest', 'finalized' and 'safe' in VeChainThor - return 'best'; - - // Earliest block - if (block === 'earliest') return Hex.of(0).toString(); - - // Hex number of block - return block; - } - - // Object with block number - if (block.blockNumber !== undefined) { - return Hex.of(block.blockNumber).toString(); - } - - // Object with block hash - Default case - return block.blockHash; -}; - -export { getCorrectBlockNumberRPCToVeChain }; diff --git a/packages/network/src/provider/utils/const/blocks/index.ts b/packages/network/src/provider/utils/const/blocks/index.ts deleted file mode 100644 index 91bf7d9c7..000000000 --- a/packages/network/src/provider/utils/const/blocks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './blocks'; diff --git a/packages/network/src/provider/utils/const/chain-id/chain-id.ts b/packages/network/src/provider/utils/const/chain-id/chain-id.ts deleted file mode 100644 index a4113345b..000000000 --- a/packages/network/src/provider/utils/const/chain-id/chain-id.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Chain ID's - * - * @link [Chain IDs](https://chainlist.org/?search=vechain&testnets=true) - */ -const CHAIN_ID = { - MAINNET: '0x186a9', - TESTNET: '0x186aa' -}; - -export { CHAIN_ID }; diff --git a/packages/network/src/provider/utils/const/chain-id/index.ts b/packages/network/src/provider/utils/const/chain-id/index.ts deleted file mode 100644 index 81ee1ecaf..000000000 --- a/packages/network/src/provider/utils/const/chain-id/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './chain-id'; diff --git a/packages/network/src/provider/utils/const/index.ts b/packages/network/src/provider/utils/const/index.ts deleted file mode 100644 index 2386f4a8a..000000000 --- a/packages/network/src/provider/utils/const/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './rpc-mapper'; -export * from './providers'; -export * from './blocks'; -export * from './chain-id'; diff --git a/packages/network/src/provider/utils/const/providers/const.ts b/packages/network/src/provider/utils/const/providers/const.ts deleted file mode 100644 index a4355bbe1..000000000 --- a/packages/network/src/provider/utils/const/providers/const.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Polling interval for the subscription events polling mechanism for the VeChain provider. - */ -const POLLING_INTERVAL: number = 5000; - -export { POLLING_INTERVAL }; diff --git a/packages/network/src/provider/utils/const/providers/index.ts b/packages/network/src/provider/utils/const/providers/index.ts deleted file mode 100644 index e47ea3a46..000000000 --- a/packages/network/src/provider/utils/const/providers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './const'; diff --git a/packages/network/src/provider/utils/const/rpc-mapper/index.ts b/packages/network/src/provider/utils/const/rpc-mapper/index.ts deleted file mode 100644 index 5faf2d6a5..000000000 --- a/packages/network/src/provider/utils/const/rpc-mapper/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './rpc-methods'; diff --git a/packages/network/src/provider/utils/const/rpc-mapper/rpc-methods.ts b/packages/network/src/provider/utils/const/rpc-mapper/rpc-methods.ts deleted file mode 100644 index 58782a356..000000000 --- a/packages/network/src/provider/utils/const/rpc-mapper/rpc-methods.ts +++ /dev/null @@ -1,100 +0,0 @@ -/** - * List of all valid ethereum RPC methods - * - * @note following links for more details: - * * https://eth.wiki/json-rpc/API - * * https://ethereum.github.io/execution-apis/api-documentation/ - */ -enum RPC_METHODS { - /** - * IMPLEMENTED METHODS: - */ - eth_blockNumber = 'eth_blockNumber', - eth_chainId = 'eth_chainId', - eth_getBalance = 'eth_getBalance', - eth_getCode = 'eth_getCode', - eth_getStorageAt = 'eth_getStorageAt', - eth_estimateGas = 'eth_estimateGas', - eth_call = 'eth_call', - eth_sendRawTransaction = 'eth_sendRawTransaction', - eth_getLogs = 'eth_getLogs', - eth_getBlockByHash = 'eth_getBlockByHash', - eth_getBlockByNumber = 'eth_getBlockByNumber', - eth_accounts = 'eth_accounts', - eth_requestAccounts = 'eth_requestAccounts', - eth_gasPrice = 'eth_gasPrice', - eth_getTransactionByHash = 'eth_getTransactionByHash', - eth_getTransactionCount = 'eth_getTransactionCount', - eth_getTransactionReceipt = 'eth_getTransactionReceipt', - eth_getTransactionByBlockNumberAndIndex = 'eth_getTransactionByBlockNumberAndIndex', - eth_getTransactionByBlockHashAndIndex = 'eth_getTransactionByBlockHashAndIndex', - eth_getBlockTransactionCountByHash = 'eth_getBlockTransactionCountByHash', - eth_getBlockTransactionCountByNumber = 'eth_getBlockTransactionCountByNumber', - eth_sendTransaction = 'eth_sendTransaction', - eth_syncing = 'eth_syncing', - net_version = 'net_version', - web3_clientVersion = 'web3_clientVersion', - eth_subscribe = 'eth_subscribe', - eth_unsubscribe = 'eth_unsubscribe', - debug_traceTransaction = 'debug_traceTransaction', - debug_traceCall = 'debug_traceCall', - evm_mine = 'evm_mine', - web3_sha3 = 'web3_sha3', - net_peerCount = 'net_peerCount', - net_listening = 'net_listening', - eth_getUncleByBlockNumberAndIndex = 'eth_getUncleByBlockNumberAndIndex', - eth_getUncleByBlockHashAndIndex = 'eth_getUncleByBlockHashAndIndex', - txpool_inspect = 'txpool_inspect', - txpool_contentFrom = 'txpool_contentFrom', - txpool_content = 'txpool_content', - txpool_status = 'txpool_status', - eth_signTransaction = 'eth_signTransaction', - debug_traceBlockByHash = 'debug_traceBlockByHash', - debug_traceBlockByNumber = 'debug_traceBlockByNumber', - eth_getUncleCountByBlockHash = 'eth_getUncleCountByBlockHash', - eth_getUncleCountByBlockNumber = 'eth_getUncleCountByBlockNumber', - eth_signTypedData_v4 = 'eth_signTypedData_v4', - - /** - * TO BE IMPLEMENTED METHODS: - */ - eth_coinbase = 'eth_coinbase', - eth_feeHistory = 'eth_feeHistory', - eth_getWork = 'eth_getWork', - eth_mining = 'eth_mining', - eth_hashrate = 'eth_hashrate', - eth_protocolVersion = 'eth_protocolVersion', - eth_sign = 'eth_sign', - eth_submitWork = 'eth_submitWork', - parity_nextNonce = 'parity_nextNonce', - eth_newFilter = 'eth_newFilter', - eth_newBlockFilter = 'eth_newBlockFilter', - eth_newPendingTransactionFilter = 'eth_newPendingTransactionFilter', - eth_getFilterLogs = 'eth_getFilterLogs', - eth_getFilterChanges = 'eth_getFilterChanges', - eth_uninstallFilter = 'eth_uninstallFilter', - debug_getBadBlocks = 'debug_getBadBlocks', - debug_getRawBlock = 'debug_getRawBlock', - debug_getRawHeader = 'debug_getRawHeader', - debug_getRawReceipts = 'debug_getRawReceipts', - debug_getRawTransaction = 'debug_getRawTransaction', - engine_exchangeCapabilities = 'engine_exchangeCapabilities', - engine_exchangeTransitionConfigurationV1 = 'engine_exchangeTransitionConfigurationV1', - engine_forkchoiceUpdatedV1 = 'engine_forkchoiceUpdatedV1', - engine_forkchoiceUpdatedV2 = 'engine_forkchoiceUpdatedV2', - engine_forkchoiceUpdatedV3 = 'engine_forkchoiceUpdatedV3', - engine_getPayloadBodiesByHashV1 = 'engine_getPayloadBodiesByHashV1', - engine_getPayloadBodiesByRangeV1 = 'engine_getPayloadBodiesByRangeV1', - engine_getPayloadV1 = 'engine_getPayloadV1', - engine_getPayloadV2 = 'engine_getPayloadV2', - engine_getPayloadV3 = 'engine_getPayloadV3', - engine_newPayloadV1 = 'engine_newPayloadV1', - engine_newPayloadV2 = 'engine_newPayloadV2', - engine_newPayloadV3 = 'engine_newPayloadV3', - eth_createAccessList = 'eth_createAccessList', - eth_getBlockReceipts = 'eth_getBlockReceipts', - eth_getProof = 'eth_getProof', - eth_maxPriorityFeePerGas = 'eth_maxPriorityFeePerGas' -} - -export { RPC_METHODS }; diff --git a/packages/network/src/provider/utils/formatter/blocks/formatter.ts b/packages/network/src/provider/utils/formatter/blocks/formatter.ts deleted file mode 100644 index fc54cc1ee..000000000 --- a/packages/network/src/provider/utils/formatter/blocks/formatter.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { type BlocksRPC } from './types'; -import { HexUInt, Quantity, ZERO_BYTES } from '@vechain/sdk-core'; -import { transactionsFormatter } from '../transactions'; -import { - type CompressedBlockDetail, - type ExpandedBlockDetail, - type TransactionsExpandedBlockDetail -} from '../../../../thor-client'; - -/** - * Output formatter for block details. - * It converts the block details into the RPC standard. - * - * @param block - The block details to be formatted. - * @param chainId - The chain id to use for the transaction formatting. - */ -const formatToRPCStandard = ( - block: CompressedBlockDetail | ExpandedBlockDetail, - chainId: string -): BlocksRPC => { - // Return the transactions array formatted based on the requested expanded flag - const transactions = - typeof block.transactions[0] === 'string' - ? (block.transactions as string[]) - : block.transactions.map((tx, index) => { - return transactionsFormatter.formatExpandedBlockToRPCStandard( - tx as TransactionsExpandedBlockDetail, - block as ExpandedBlockDetail, - index, - chainId - ); - }); - - return { - // Supported fields converted to RPC standard - hash: block.id, - parentHash: block.parentID, - number: Quantity.of(block.number).toString(), - size: Quantity.of(block.size).toString(), - stateRoot: block.stateRoot, - receiptsRoot: block.receiptsRoot, - transactionsRoot: block.txsRoot, - timestamp: Quantity.of(block.timestamp).toString(), - gasLimit: Quantity.of(block.gasLimit).toString(), - gasUsed: Quantity.of(block.gasUsed).toString(), - transactions, - miner: block.beneficiary, - - // Unsupported fields - difficulty: '0x0', - totalDifficulty: '0x0', - uncles: [], - sha3Uncles: HexUInt.of(ZERO_BYTES(32)).toString(), - nonce: HexUInt.of(ZERO_BYTES(8)).toString(), - logsBloom: HexUInt.of(ZERO_BYTES(256)).toString(), - extraData: '0x', - baseFeePerGas: '0x0', - mixHash: HexUInt.of(ZERO_BYTES(32)).toString() - }; -}; - -export { formatToRPCStandard }; diff --git a/packages/network/src/provider/utils/formatter/blocks/index.ts b/packages/network/src/provider/utils/formatter/blocks/index.ts deleted file mode 100644 index 910f0bbb7..000000000 --- a/packages/network/src/provider/utils/formatter/blocks/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { formatToRPCStandard } from './formatter'; -export type * from './types.d'; - -export const blocksFormatter = { formatToRPCStandard }; diff --git a/packages/network/src/provider/utils/formatter/blocks/types.d.ts b/packages/network/src/provider/utils/formatter/blocks/types.d.ts deleted file mode 100644 index 525fbbb33..000000000 --- a/packages/network/src/provider/utils/formatter/blocks/types.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { type TransactionRPC } from '../transactions/types'; - -/** - * Return type of block header for RPC standard. - */ -interface BlockHeaderRPC { - /** - * Header number in hex string format - */ - number: string; - - /** - * Hash in bytes32 format - */ - hash: string; - - /** - * Parent hash in bytes32 format - */ - parentHash: string; - - /** - * Transactions root in bytes32 format - */ - transactionsRoot: string; - - /** - * State root in bytes32 format - */ - stateRoot: string; - /** - * Receipts root in bytes32 format - */ - receiptsRoot: string; - - /** - * Miner address in bytes20 format - */ - miner: string; - - /** - * Gas limit in hex string format - */ - gasLimit: string; - - /** - * Gas used in hex string format - */ - gasUsed: string; - - /** - * Timestamp in hex string format - */ - timestamp: string; - - /** - * Unsupported fields - */ - sha3Uncles: string; - nonce: string; - logsBloom: string; - extraData: string; -} - -/** - * Return type of blocks for RPC standard. - * - * Our SDK uses `BlockDetail` type from `@vechain/sdk-network` package. - * - * @link [Ethereum JSON RPC Block Object](https://docs.infura.io/networks/ethereum/json-rpc-methods/eth_getblockbynumber#returns) - */ -interface BlocksRPC extends BlockHeaderRPC { - /** - * Block number in hex string format - */ - size: string; - - /** - * List of transactions as bytes32 array or TransactionRPC array - */ - transactions: string[] | TransactionRPC[]; - - /** - * Unsupported fields - */ - difficulty: string; - totalDifficulty: string; - uncles: string[]; - baseFeePerGas: string; - mixHash: string; -} - -/** - * Return type of eth_syncing for RPC method. - */ -interface SyncBlockRPC { - startingBlock: null; - currentBlock: BlocksRPC | null; - highestBlock: string | null; -} - -export { type BlockHeaderRPC, type BlocksRPC, type SyncBlockRPC }; diff --git a/packages/network/src/provider/utils/formatter/debug/formatter.ts b/packages/network/src/provider/utils/formatter/debug/formatter.ts deleted file mode 100644 index bfba537ae..000000000 --- a/packages/network/src/provider/utils/formatter/debug/formatter.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { type TracerNameRPC, type TracerReturnTypeRPC } from './types'; -import { type TraceReturnType } from '../../../../thor-client'; - -/** - * Output formatter for RPC debug endpoints: - * * debug_traceTransaction - * * debug_traceCall - * It converts our endpoint calls output to the RPC standard output. - * - * @param tracerName - Tracer name used for the debug endpoint. - * @param debugDetails - Debug details to be formatted. - */ -function formatToRPCStandard( - tracerName: TDebugType, - debugDetails: TraceReturnType -): TracerReturnTypeRPC<'call'> | TracerReturnTypeRPC<'prestate'> { - if (tracerName === 'call') { - return { - ...(debugDetails as TraceReturnType<'call'>), - - // Empty revert reason - revertReason: '' - } satisfies TracerReturnTypeRPC<'call'>; - } - - return Object.fromEntries( - Object.entries(debugDetails as TraceReturnType<'prestate'>).map( - ([key, value]) => { - const valueWithoutEnergy = { - balance: value.balance, - code: value.code, - storage: value.storage - } satisfies Omit< - { - balance: string; - energy: string; - code?: string; - storage?: Record; - }, - 'energy' - >; - - return [key, { ...valueWithoutEnergy, nonce: 0 }]; - } - ) - ) satisfies TracerReturnTypeRPC<'prestate'>; -} - -export { formatToRPCStandard }; diff --git a/packages/network/src/provider/utils/formatter/debug/index.ts b/packages/network/src/provider/utils/formatter/debug/index.ts deleted file mode 100644 index f44973ac8..000000000 --- a/packages/network/src/provider/utils/formatter/debug/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { formatToRPCStandard } from './formatter'; - -export * from './formatter'; -export type * from './types.d'; - -export const debugFormatter = { - formatToRPCStandard -}; diff --git a/packages/network/src/provider/utils/formatter/debug/types.d.ts b/packages/network/src/provider/utils/formatter/debug/types.d.ts deleted file mode 100644 index ab0eb178f..000000000 --- a/packages/network/src/provider/utils/formatter/debug/types.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { type TraceReturnType } from '../../../../thor-client'; - -/** - * Available tracers for the RPC standard. - */ -type TracerNameRPC = 'call' | 'prestate'; - -/** - * Return type for the following RPC endpoints: - * * debug_traceTransaction - * * debug_traceCall - */ -type TracerReturnTypeRPC = - TracerNameType extends 'call' ? CallTracerRPC : PrestateTracerRPC; - -/** - * The return type of the 'call' tracer for the RPC standard. - */ -type CallTracerRPC = TraceReturnType<'call'> & { - /** - * Same of the 'call' tracer of VeChain, - * BUT with the addition of the revertReason field. - * - * @note This is not part of the VeChain's 'call' tracer. - * For this reason, it will have a default value of ''. - */ - revertReason?: ''; -}; - -/** - * The return type of the 'prestate' tracer for the RPC standard. - */ -type PrestateTracerRPC = Record< - string, - { - balance: string; - code?: string; - storage?: Record; - - /** - * Same of the 'prestate' tracer of VeChain, - * BUT with the addition of the nonce field. - * This field substitutes the 'energy' field - * of the VeChain's 'prestate' tracer. - * - * @note This is not part of the VeChain's 'prestate' tracer. - * For this reason, it will have a default value of 0. - */ - nonce: 0; - } ->; - -export type { - TracerReturnTypeRPC, - TracerNameRPC, - CallTracerRPC, - PrestateTracerRPC -}; diff --git a/packages/network/src/provider/utils/formatter/index.ts b/packages/network/src/provider/utils/formatter/index.ts deleted file mode 100644 index 23cf25df2..000000000 --- a/packages/network/src/provider/utils/formatter/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './blocks'; -export * from './debug'; -export * from './logs'; -export * from './transactions'; diff --git a/packages/network/src/provider/utils/formatter/logs/formatter.ts b/packages/network/src/provider/utils/formatter/logs/formatter.ts deleted file mode 100644 index f40843956..000000000 --- a/packages/network/src/provider/utils/formatter/logs/formatter.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { HexInt } from '@vechain/sdk-core'; -import { type EventCriteria, type EventLogs } from '../../../../thor-client'; -import { type LogsRPC } from './types'; - -/** - * Output formatter for Event logs. - * It converts the Event logs into the RPC standard. - * - * @param eventLogs - The Event logs to be formatted. - */ -const formatToLogsRPC = (eventLogs: EventLogs[]): LogsRPC[] => { - // Final RPC event logs formatted - return eventLogs.map((eventLog: EventLogs) => { - return { - address: eventLog.address, - blockHash: eventLog.meta.blockID, - blockNumber: HexInt.of(eventLog.meta.blockNumber).toString(), - data: eventLog.data, - logIndex: '0x0', - // Always false for now - removed: false, - topics: eventLog.topics, - transactionHash: eventLog.meta.txID, - transactionIndex: '0x0' - - // @NOTE: logIndex and transactionIndex are not implemented yet. This for performance reasons. - // - /** - * @NOTE: These two fields are not implemented yet. - * This for performance reasons. - * We can implement them later if needed. - * - * To have these two fields, we need to query a block for each entry into the logs. - * After from the block, we can get the transaction index and the log index. - * This is a performance issue because we have to query a block for each entry into the logs. - */ - } satisfies LogsRPC; - }); -}; - -/** - * Convert the criteria topics into an array of topics. - * - * This because the criteria topics are not an array of topics in VeChain, - * but they are directly enumerated (topic0, topic1, topic2, topic3, topic4). - * - * RPC standard requires an array of topics instead. - * - * @param criteriaTopicsArray - The criteria topics array. - * @param address - The address to filter. - */ -const _scatterArrayTopic = ( - criteriaTopicsArray: string[], - address?: string -): EventCriteria => { - return { - address, - topic0: criteriaTopicsArray[0] ?? undefined, - topic1: criteriaTopicsArray[1] ?? undefined, - topic2: criteriaTopicsArray[2] ?? undefined, - topic3: criteriaTopicsArray[3] ?? undefined, - topic4: criteriaTopicsArray[4] ?? undefined - }; -}; - -/** - * Function to generate a set of event criteria based on input criteria. - * The function takes an object with optional address and topics properties, - * and returns an array of EventCriteria objects. - * - * @param {Object} criteria - The input criteria object. - * @param {string|string[]} [criteria.address] - A single address string or an array of address strings. - * @param {string[]|string[][]} [criteria.topics] - A single array of topics or an array of arrays of topics. - * @returns {EventCriteria[]} An array of EventCriteria objects. - */ -const getCriteriaSetForInput = (criteria: { - address?: string | string[]; - topics?: string[] | string[][]; -}): EventCriteria[] => { - // String to an array of addresses and topics - let criteriaAddress: string[] | undefined[] = []; - - // Convert in any case to an array of addresses - if (criteria.address !== undefined) { - criteriaAddress = - typeof criteria.address === 'string' - ? [criteria.address] - : criteria.address; - } else { - criteriaAddress = [undefined]; - } - - const eventsCriteriaToFlat: EventCriteria[][] = criteriaAddress.map( - (addr) => { - return getTopicsPerAddress(addr, criteria.topics ?? []); - } - ); - - // Flat the array - return eventsCriteriaToFlat.flat(); -}; - -/** - * Function to generate a set of event criteria based on input topics and address. - * The function takes an address and an array of topics and returns an array of EventCriteria objects. - * - * @param {string} address - The address to filter. - * @param {string[]|string[][]} topics - A single array of topics or an array of arrays of topics. - * @returns {EventCriteria[]} An array of EventCriteria objects. - */ -const getTopicsPerAddress = ( - address: string | undefined, - topics: string[] | string[][] -): EventCriteria[] => { - const notArrayTopics: string[] = []; - const arrayTopics: string[][] = []; - - topics.forEach((topic) => { - if (!Array.isArray(topic)) { - notArrayTopics.push(topic); - } - if (Array.isArray(topic)) { - arrayTopics.push(topic); - } - }); - - const criteriaSet: EventCriteria[] = []; - - if (notArrayTopics.length > 0) { - criteriaSet.push(_scatterArrayTopic(notArrayTopics, address)); - } - - arrayTopics.forEach((topics) => { - topics.forEach((topic) => { - criteriaSet.push({ - address, - topic0: topic, - topic1: undefined, - topic2: undefined, - topic3: undefined, - topic4: undefined - }); - }); - }); - - // If no topics are provided, we add an empty criteria set - if (criteriaSet.length === 0) { - criteriaSet.push({ - address, - topic0: undefined, - topic1: undefined, - topic2: undefined, - topic3: undefined, - topic4: undefined - }); - } - - return criteriaSet; -}; - -export { formatToLogsRPC, getCriteriaSetForInput }; diff --git a/packages/network/src/provider/utils/formatter/logs/index.ts b/packages/network/src/provider/utils/formatter/logs/index.ts deleted file mode 100644 index 419b54f95..000000000 --- a/packages/network/src/provider/utils/formatter/logs/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './formatter'; -export type * from './types.d'; diff --git a/packages/network/src/provider/utils/formatter/logs/types.d.ts b/packages/network/src/provider/utils/formatter/logs/types.d.ts deleted file mode 100644 index 099f0658b..000000000 --- a/packages/network/src/provider/utils/formatter/logs/types.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Return type of logs according to the Ethereum RPC standard. - */ -interface LogsRPC { - /** - * (boolean) true when the log was removed, due to a chain reorganization. false if it's a valid log. - */ - removed: boolean; - - /** - * Hexadecimal of the log index position in the block. Null when it is a pending log. - */ - logIndex: string; - - /** - * Hexadecimal of the transaction index position from which the log created. Null when it is a pending log. - */ - transactionIndex: string; - - /** - * 32 bytes. Hash of the transactions from which this log was created. Null when it is a pending log. - */ - transactionHash: string; - - /** - * 32 bytes. Hash of the block where this log was in. Null when it is a pending log. - */ - blockHash: string; - - /** - * Block number where this log was in. Null when it is a pending log. - */ - blockNumber: string; - - /** - * 20 bytes. Address from which this log originated. - */ - address: string; - - /** - * Contains one or more 32-bytes non-indexed arguments of the log. - */ - data: string; - - /** - * An array of 0 to 4 indexed log arguments, each 32 bytes. In solidity the first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except when you declared the event with the anonymous specifier. - */ - topics: string[]; -} - -export { type LogsRPC }; diff --git a/packages/network/src/provider/utils/formatter/transactions/formatter.ts b/packages/network/src/provider/utils/formatter/transactions/formatter.ts deleted file mode 100644 index 78feb861c..000000000 --- a/packages/network/src/provider/utils/formatter/transactions/formatter.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { - type TransactionReceiptLogsRPC, - type TransactionReceiptRPC, - type TransactionRPC -} from './types'; -import { Hex, HexUInt, Quantity, ZERO_BYTES } from '@vechain/sdk-core'; -import { - getNumberOfLogsAheadOfTransactionIntoBlockExpanded, - getTransactionIndexIntoBlock -} from '../../helpers/transaction/transaction-helpers'; -import { blocksFormatter } from '../blocks'; -import { - type ExpandedBlockDetail, - type TransactionDetailNoRaw, - type TransactionReceipt, - type TransactionsExpandedBlockDetail -} from '../../../../thor-client'; - -/** - * Output formatter for Transaction details. - * - * @param tx - The Transaction details to be formatted. - * @param blockHash - The hash of the block where the transaction is in. - * @param blockNumber - The number of the block where the transaction is in. - * @param chainId - The chain ID of the network. - * @param txIndex - The index of the transaction in the block. - * - * @returns The RPC standard formatted transaction. - */ -const _formatTransactionToRPC = ( - tx: TransactionDetailNoRaw | TransactionsExpandedBlockDetail, - blockHash: string, - blockNumber: number, - chainId: string, - txIndex: number -): TransactionRPC => { - return { - // Supported fields - blockHash, - blockNumber: Quantity.of(blockNumber).toString(), - from: tx.origin, - gas: Quantity.of(HexUInt.of(tx.gas).bi).toString(), - chainId, - hash: tx.id, - nonce: tx.nonce as string, - transactionIndex: Quantity.of(txIndex).toString(), - - /** - * `input`, `to`, `value` are being referred to the first clause. - * VeChain supports multiple clauses in one transaction, thus the actual data should be obtained by looking into each clause. - * Due to the single clause limitation of Ethereum, we assume the first clause is the clause from which we obtain the data. - */ - input: tx.clauses[0]?.data !== undefined ? tx.clauses[0].data : '', - to: tx.clauses[0]?.to !== undefined ? tx.clauses[0].to : null, - value: - tx.clauses[0]?.value !== undefined - ? Quantity.of(HexUInt.of(tx.clauses[0].value).bi).toString() - : '', - - // Unsupported fields - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - }; -}; - -/** - * Output formatter for Transaction details. - * It converts the Transaction details into the RPC standard. - * - * @param tx - The Transaction details to be formatted. - * @param chainId - The chain ID of the network. - * @param txIndex - The index of the transaction in the block. - * - * @returns The RPC standard formatted transaction. - */ -const formatToRPCStandard = ( - tx: TransactionDetailNoRaw, - chainId: string, - txIndex: number -): TransactionRPC => { - return _formatTransactionToRPC( - tx, - tx.meta.blockID, - tx.meta.blockNumber, - chainId, - txIndex - ); -}; - -/** - * Output formatter for Transaction details from expanded block. - * It converts the Transaction details into the RPC standard. - * - * @param tx - The Transaction details to be formatted. - * @param block - The block details to be formatted. - * @param chainId - The chain ID of the network. - * @param txIndex - The index of the transaction in the block. - * - * @returns The RPC standard formatted transaction. - */ -const formatExpandedBlockToRPCStandard = ( - tx: TransactionsExpandedBlockDetail, - block: ExpandedBlockDetail, - txIndex: number, - chainId: string -): TransactionRPC => { - return _formatTransactionToRPC( - tx, - block.id, - block.number, - chainId, - txIndex - ); -}; - -/** - * Output formatter for Transaction Receipt details. - * It converts the Transaction Receipt details, Transaction details and block into the RPC standard. - * - * @param transactionHash - The hash of the transaction to be formatted. - * @param receipt - The Transaction Receipt to be formatted. - * @param transaction - The Transaction details to be formatted. - * @param blockContainsTransaction - The block contains the transaction to be formatted. - * @param chainId - The chain ID of the network. - */ -function formatTransactionReceiptToRPCStandard( - transactionHash: string, - receipt: TransactionReceipt, - transaction: TransactionDetailNoRaw, - blockContainsTransaction: ExpandedBlockDetail, - chainId: string -): TransactionReceiptRPC { - // Get transaction index - const transactionIndex = getTransactionIndexIntoBlock( - blocksFormatter.formatToRPCStandard(blockContainsTransaction, chainId), - transactionHash - ); - - // Format transaction receipt logs - const logIndexOffset = getNumberOfLogsAheadOfTransactionIntoBlockExpanded( - blockContainsTransaction, - transactionHash, - chainId - ); - - const logs: TransactionReceiptLogsRPC[] = []; - let logIndex = logIndexOffset; - receipt.outputs.forEach((output) => { - output.events.forEach((event) => { - logs.push({ - blockHash: receipt.meta.blockID, - blockNumber: Quantity.of(receipt.meta.blockNumber).toString(), - transactionHash: receipt.meta.txID as string, - address: event.address, - topics: event.topics.map((topic) => topic), - data: event.data, - removed: false, - transactionIndex: Quantity.of(transactionIndex).toString(), - logIndex: Quantity.of(logIndex).toString() - }); - logIndex++; - }); - }); - - return { - blockHash: receipt.meta.blockID, - blockNumber: Quantity.of(receipt.meta.blockNumber).toString(), - contractAddress: - receipt.outputs.length > 0 - ? receipt.outputs[0].contractAddress - : null, - from: transaction.origin, - gasUsed: Quantity.of(receipt.gasUsed).toString(), - logs, - status: receipt.reverted ? '0x0' : '0x1', - to: transaction.clauses[0].to, - transactionHash: receipt.meta.txID as string, - transactionIndex: Quantity.of(transactionIndex).toString(), - - // Incompatible fields - logsBloom: Hex.of(ZERO_BYTES(256)).toString(), - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - type: '0x0' - }; -} - -export { - formatToRPCStandard, - formatExpandedBlockToRPCStandard, - formatTransactionReceiptToRPCStandard -}; diff --git a/packages/network/src/provider/utils/formatter/transactions/index.ts b/packages/network/src/provider/utils/formatter/transactions/index.ts deleted file mode 100644 index 5c01b4d9e..000000000 --- a/packages/network/src/provider/utils/formatter/transactions/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { - formatExpandedBlockToRPCStandard, - formatTransactionReceiptToRPCStandard, - formatToRPCStandard -} from './formatter'; - -export type * from './types.d'; - -export const transactionsFormatter = { - formatToRPCStandard, - formatExpandedBlockToRPCStandard, - formatTransactionReceiptToRPCStandard -}; diff --git a/packages/network/src/provider/utils/formatter/transactions/types.d.ts b/packages/network/src/provider/utils/formatter/transactions/types.d.ts deleted file mode 100644 index 18737dd20..000000000 --- a/packages/network/src/provider/utils/formatter/transactions/types.d.ts +++ /dev/null @@ -1,201 +0,0 @@ -/** - * The return type of transaction according to the Ethereum RPC standard. - * - * @link [Ethereum JSON RPC Transaction Object](https://docs.infura.io/networks/ethereum/json-rpc-methods/eth_gettransactionbyhash#returns) - */ -interface TransactionRPC { - /** - * Hash of the transaction. - */ - hash: string; - /** - * Hash of the block where this transaction is included. - */ - blockHash: string; - /** - * Number of the block where this transaction is included. - */ - blockNumber: string; - /** - * Address of the sender of this transaction. - */ - from: string; - /** - * The address of the receiver. null when it's a contract creation transaction - */ - to: string | null; - /** - * The value transferred in wei encoded as hexadecimal - */ - value: string; - /** - * The gas provided by the sender, encoded as hexadecimal - */ - gas: string; - /** - * The data sent along with the transaction - */ - input: string; - /** - * The integer of the transaction's index position that the log was created from. null when it's a pending log - */ - transactionIndex: string; - /** - * The chain id of the transaction - */ - chainId: string; - /** - * The nonce of the transaction. - * - * @note Differs from Ethereum as it's not the sequential nonce. - */ - nonce: string; - - // incompatible fields - r: string; - s: string; - v: string; - type: string; - gasPrice: string; - maxFeePerGas: string; - maxPriorityFeePerGas: string; - accessList: Array<{ address: string; storageKeys: string[] }>; - yParity: string; -} - -/** - * The return type of transaction receipt logs according to the Ethereum RPC standard. - * - * @link [Ethereum JSON RPC Transaction Receipt Log Object](https://docs.infura.io/networks/ethereum/json-rpc-methods/eth_gettransactionreceipt#returns) - */ -interface TransactionReceiptLogsRPC { - /** - * The address from which this log was generated - */ - address: string; - - /** - * The hash of the block where this log was in - */ - blockHash: string; - - /** - * The block number where this log was in - */ - blockNumber: string; - - /** - * The 32 byte non-indexed argument of the log - */ - data: string; - - /** - * The integer of log index position in the block encoded as hexadecimal. null if the log is pending - */ - logIndex: string; - - /** - * It is true if log was removed, due to a chain reorganization and false if it's a valid log - */ - removed: false; - - /** - * An array of zero to four 32 Bytes DATA of indexed log arguments. - * In Solidity, the first topic is the hash of the signature of the event (e.g. Deposit(address, bytes32, uint256)), - * except you declare the event with the anonymous specifier - */ - topics: string[]; - - /** - * The hash of the transaction from which this log was created from. null if the log is pending - */ - transactionHash: string; - - /** - * The transactions index position from which this log was created from. null if the log is pending - */ - transactionIndex: string; -} - -/** - * Return type of transaction receipt according to the Ethereum RPC standard. - * - * @link [Ethereum JSON RPC Transaction Receipt Object](https://docs.infura.io/networks/ethereum/json-rpc-methods/eth_gettransactionreceipt#returns) - */ -interface TransactionReceiptRPC { - /** - * 32 bytes. Hash of the block including this transaction. - */ - blockHash: string; - /** - * Block number including this transaction. - */ - blockNumber: string; - - /** - * 20 bytes. The address of the contract created, if the transaction was a contract creation, otherwise null. - */ - contractAddress: string | null; - - /** - * The total amount of gas used when this transaction was executed in the block. - */ - cumulativeGasUsed: string; - - /** - * The actual value per gas deducted from the sender's account. Before EIP-1559, equal to the gas price. - */ - effectiveGasPrice: string; - - /** - * 20 bytes. The address of the sender. - */ - from: string; - - /** - * The total amount of gas used when this transaction was executed in the block. - */ - gasUsed: string; - - /** - * Array of log objects, which this transaction generated. - */ - logs: TransactionReceiptLogsRPC[]; - - /** - * 256 bytes. Bloom filter for light clients to quickly retrieve related logs. - */ - logsBloom: string; - - /** - * Either 1 (success) or 0 (failure) - */ - status: '0x0' | '0x1'; - - /** - * 20 bytes. The address of the receiver. null when it's a contract creation transaction - */ - to: string | null; - - /** - * 32 bytes. Hash of the transaction. - */ - transactionHash: string; - - /** - * Hexadecimal of the transaction's index position in the block. - */ - transactionIndex: string; - - /** - * The transaction type. - * @see https://docs.infura.io/networks/ethereum/concepts/transaction-types - */ - type: '0x0' | '0x1' | '0x2'; -} - -export { - type TransactionRPC, - type TransactionReceiptLogsRPC, - type TransactionReceiptRPC -}; diff --git a/packages/network/src/provider/utils/helpers/index.ts b/packages/network/src/provider/utils/helpers/index.ts deleted file mode 100644 index e8f45da2d..000000000 --- a/packages/network/src/provider/utils/helpers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './transaction'; diff --git a/packages/network/src/provider/utils/helpers/transaction/index.ts b/packages/network/src/provider/utils/helpers/transaction/index.ts deleted file mode 100644 index f8a31f179..000000000 --- a/packages/network/src/provider/utils/helpers/transaction/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './transaction-helpers'; diff --git a/packages/network/src/provider/utils/helpers/transaction/transaction-helpers.ts b/packages/network/src/provider/utils/helpers/transaction/transaction-helpers.ts deleted file mode 100644 index b8ff90485..000000000 --- a/packages/network/src/provider/utils/helpers/transaction/transaction-helpers.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; -import { - blocksFormatter, - type BlocksRPC, - type TransactionRPC -} from '../../formatter'; -import { type ExpandedBlockDetail } from '../../../../thor-client'; - -/** - * Get the index of the transaction in the specified block. - * - * @param block - The block to search in. - * @param hash - The hash of the transaction to search for. - * @returns the index of the transaction in the block or null if the transaction is not in the block. - * @throws {InvalidDataType} - */ -const getTransactionIndexIntoBlock = ( - block: BlocksRPC, - hash: string -): number => { - const idx = - typeof block.transactions[0] === 'string' - ? (block.transactions as string[]).findIndex( - (tx: string) => tx === hash - ) - : block.transactions.findIndex( - (tx) => (tx as TransactionRPC).hash === hash - ); - - if (idx === -1) { - throw new InvalidDataType( - 'getTransactionIndexIntoBlock()', - 'Transaction not found in block.', - { block, hash } - ); - } - - return idx; -}; - -/** - * Get the number of logs ahead of a transaction into a block. - * - * @param blockExpanded - The block to search in. - * @param transactionId - The hash of the transaction to search for. - * @param chainId - The chain ID of the network. - */ -const getNumberOfLogsAheadOfTransactionIntoBlockExpanded = ( - blockExpanded: ExpandedBlockDetail, - transactionId: string, - chainId: string -): number => { - // Get transaction index into the block - const transactionIndex = getTransactionIndexIntoBlock( - blocksFormatter.formatToRPCStandard(blockExpanded, chainId), - transactionId - ); - - // Count the number of logs in the txs whose number is lower than txId - let logIndex: number = 0; - - // Iterate over the transactions into the block bounded by the transaction index - for (let i = 0; i < transactionIndex; i++) { - const currentTransaction = blockExpanded.transactions[i]; - - // Iterate over the outputs of the current transaction - for (const output of currentTransaction.outputs) { - logIndex += output.events.length; - } - } - - return logIndex; -}; - -export { - getTransactionIndexIntoBlock, - getNumberOfLogsAheadOfTransactionIntoBlockExpanded -}; diff --git a/packages/network/src/provider/utils/index.ts b/packages/network/src/provider/utils/index.ts deleted file mode 100644 index 951ca15b2..000000000 --- a/packages/network/src/provider/utils/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './const'; -export * from './formatter'; -export * from './rpc-mapper'; -export * from './helpers'; diff --git a/packages/network/src/provider/utils/rpc-mapper/index.ts b/packages/network/src/provider/utils/rpc-mapper/index.ts deleted file mode 100644 index 6a3dce332..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './methods'; -export * from './rpc-mapper'; -export type * from './types.d'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getBadBlocks/debug_getBadBlocks.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getBadBlocks/debug_getBadBlocks.ts deleted file mode 100644 index b3167cc1d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getBadBlocks/debug_getBadBlocks.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method debug_getBadBlocks implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const debugGetBadBlocks = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'debug_getBadBlocks', - messages: ['Method "debug_getBadBlocks" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { debugGetBadBlocks }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getBadBlocks/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getBadBlocks/index.ts deleted file mode 100644 index 30514cf7f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getBadBlocks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './debug_getBadBlocks'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawBlock/debug_getRawBlock.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawBlock/debug_getRawBlock.ts deleted file mode 100644 index dc84ff541..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawBlock/debug_getRawBlock.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method debug_getRawBlock implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const debugGetRawBlock = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'debug_getRawBlock', - messages: ['Method "debug_getRawBlock" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { debugGetRawBlock }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawBlock/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawBlock/index.ts deleted file mode 100644 index 7f3dc602a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawBlock/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './debug_getRawBlock'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawHeader/debug_getRawHeader.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawHeader/debug_getRawHeader.ts deleted file mode 100644 index c636d7131..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawHeader/debug_getRawHeader.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method debug_getRawHeader implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const debugGetRawHeader = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'debug_getRawHeader', - messages: ['Method "debug_getRawHeader" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { debugGetRawHeader }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawHeader/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawHeader/index.ts deleted file mode 100644 index e8158f6a8..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawHeader/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './debug_getRawHeader'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawReceipts/debug_getRawReceipts.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawReceipts/debug_getRawReceipts.ts deleted file mode 100644 index 187c3c1d2..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawReceipts/debug_getRawReceipts.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method debug_getRawReceipts implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const debugGetRawReceipts = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'debug_getRawReceipts', - messages: [ - 'Method "debug_getRawReceipts" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { debugGetRawReceipts }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawReceipts/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawReceipts/index.ts deleted file mode 100644 index 175e9f4b5..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawReceipts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './debug_getRawReceipts'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawTransaction/debug_getRawTransaction.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawTransaction/debug_getRawTransaction.ts deleted file mode 100644 index 082d15326..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawTransaction/debug_getRawTransaction.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method debug_getRawTransaction implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const debugGetRawTransaction = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'debug_getRawTransaction', - messages: [ - 'Method "debug_getRawTransaction" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { debugGetRawTransaction }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawTransaction/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawTransaction/index.ts deleted file mode 100644 index 2b0d573e7..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_getRawTransaction/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './debug_getRawTransaction'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.ts deleted file mode 100644 index 15ef09813..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { ThorId } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; -import { - debugTraceTransaction, - type TraceOptionsRPC -} from '../debug_traceTransaction'; -import { ethGetBlockByHash } from '../eth_getBlockByHash'; -import { type TracerReturnTypeRPC } from '../../../formatter/debug/types'; - -/** - * RPC Method debug_traceBlockByHash implementation - * - * @link [debug_traceBlockByHash](https://www.quicknode.com/docs/ethereum/debug_traceBlockByHash) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The block hash of block to get. - * * params[1]: options - object - This describes the options for the trace. It has the following parameters: - * * tracer - string to specify the type of tracer. Currently, it supports callTracer and prestateTracer. - * * tracerConfig - Object to specify configurations for the tracer. It has the following parameter: - * * onlyTopCall - boolean Setting this to true will only trace the main (top-level) call and none of the sub-calls. - * This avoids extra processing for each call frame if only the top-level call info are required (useful for getting revertReason). - * - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const debugTraceBlockByHash = async ( - thorClient: ThorClient, - params: unknown[] -): Promise< - Array<{ - txHash: string; - result: TracerReturnTypeRPC<'call'> | TracerReturnTypeRPC<'prestate'>; - }> -> => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - !ThorId.isValid(params[0]) || - typeof params[1] !== 'object' - ) - throw new JSONRPCInvalidParams( - 'debug_traceBlockByHash', - `Invalid input params for "debug_traceBlockByHash" method. See https://www.quicknode.com/docs/ethereum/debug_traceBlockByHash for details.`, - { params } - ); - - // Init params - const [blockHash, traceOptions] = params as [ - string, - Omit - ]; - - try { - // Get block and transaction receipts - const block = await ethGetBlockByHash(thorClient, [blockHash, false]); - - // if block does not exist - if (block === null) { - return []; - } - - // Block exist, get traces - const traces = []; - - // Trace each transaction in the block - for (const transaction of block.transactions as string[]) { - const trace = await debugTraceTransaction(thorClient, [ - transaction, - { ...traceOptions, timeout: '5s' } - ]); - traces.push({ - txHash: transaction, - result: trace - }); - } - - // Return traces - return traces; - } catch (e) { - throw new JSONRPCInternalError( - 'debug_traceBlockByHash()', - 'Method "debug_traceBlockByHash" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { debugTraceBlockByHash }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByHash/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByHash/index.ts deleted file mode 100644 index 4a1a5603f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByHash/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './debug_traceBlockByHash'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.ts deleted file mode 100644 index 429947261..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; -import { - debugTraceTransaction, - type TraceOptionsRPC -} from '../debug_traceTransaction'; -import { type TracerReturnTypeRPC } from '../../../formatter'; -import { ethGetBlockByNumber } from '../eth_getBlockByNumber'; - -/** - * RPC Method debug_traceBlockByNumber implementation - * - * @link [debug_traceBlockByNumber](https://www.quicknode.com/docs/ethereum/debug_traceBlockByNumber) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The block number to get as a hex string or "latest" or "finalized". - * * params[1]: options - object - This describes the options for the trace. It has the following parameters: - * * tracer - string to specify the type of tracer. Currently, it supports callTracer and prestateTracer. - * * tracerConfig - Object to specify configurations for the tracer. It has the following parameter: - * * onlyTopCall - boolean Setting this to true will only trace the main (top-level) call and none of the sub-calls. - * This avoids extra processing for each call frame if only the top-level call info are required (useful for getting revertReason). - * - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const debugTraceBlockByNumber = async ( - thorClient: ThorClient, - params: unknown[] -): Promise< - Array<{ - txHash: string; - result: TracerReturnTypeRPC<'call'> | TracerReturnTypeRPC<'prestate'>; - }> -> => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - typeof params[1] !== 'object' - ) - throw new JSONRPCInvalidParams( - 'debug_traceBlockByNumber', - `Invalid input params for "debug_traceBlockByNumber" method. See https://www.quicknode.com/docs/ethereum/debug_traceBlockByNumber for details.`, - { params } - ); - - // Init params - const [blockNumber, traceOptions] = params as [ - string, - Omit - ]; - - try { - // Get block and transaction receipts - const block = await ethGetBlockByNumber(thorClient, [ - blockNumber, - false - ]); - - // if block does not exist - if (block === null) { - return []; - } - - // Block exist, get traces - const traces = []; - - // Trace each transaction in the block - for (const transaction of block.transactions as string[]) { - const trace = await debugTraceTransaction(thorClient, [ - transaction, - { ...traceOptions, timeout: '5s' } - ]); - traces.push({ - txHash: transaction, - result: trace - }); - } - - // Return traces - return traces; - } catch (e) { - throw new JSONRPCInternalError( - 'debug_traceBlockByNumber()', - 'Method "debug_traceBlockByNumber" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { debugTraceBlockByNumber }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByNumber/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByNumber/index.ts deleted file mode 100644 index f0879a101..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceBlockByNumber/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './debug_traceBlockByNumber'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/debug_traceCall.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/debug_traceCall.ts deleted file mode 100644 index ca23ddcc6..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/debug_traceCall.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { - type ThorClient, - type TraceReturnType, - type TracerName -} from '../../../../../thor-client'; -import { debugFormatter, type TracerReturnTypeRPC } from '../../../formatter'; - -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { type TraceCallRPC, type TransactionObjectInput } from './types'; -import { Address, HexUInt } from '@vechain/sdk-core'; - -/** - * RPC Method debug_traceCall implementation - * - * @link [debug_traceCall](https://www.quicknode.com/docs/ethereum/debug_traceCall) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: transaction - object - This describes the transaction info with following properties: - * * from - 20 bytes - Address the transaction is sent from. - * * to - 20 bytes [Required] - Address the transaction is directed to. - * * gas - Hexadecimal value of the gas provided for the transaction execution as hex string. - * * gasPrice - Hexadecimal value of the gasPrice used for each paid gas. - * * value - Hexadecimal of the value sent with this transaction. - * * data - Hash of the method signature and encoded parameters. - * * params[1]: blockNumber - string - The block number parameter. A hexadecimal number or (latest, earliest or pending). (NOT SUPPORTED YET) - * * params[2]: options - object - This describes the options for the trace. It has the following parameters: - * * tracer - string to specify the type of tracer. Currently, it supports callTracer and prestateTracer. - * * tracerConfig - Object to specify configurations for the tracer. It has the following parameters: - * * onlyTopCall - boolean Setting this to true will only trace the main (top-level) call and none of the sub-calls. This avoids extra processing for each call frame if only the top-level call info are required (useful for getting revertReason). - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const debugTraceCall = async ( - thorClient: ThorClient, - params: unknown[] -): Promise | TracerReturnTypeRPC<'prestate'>> => { - // Input validation - if ( - params.length !== 3 || - typeof params[0] !== 'object' || - typeof params[1] !== 'string' || - typeof params[2] !== 'object' - ) - throw new JSONRPCInvalidParams( - 'debug_traceCall', - `Invalid input params for "debug_traceCall" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - // Init params - const transactionOptions = params[0] as TransactionObjectInput; - const tracerOptions = params[2] as TraceCallRPC; - - // Tracer to use - const tracerToUse: TracerName = - tracerOptions.tracer === 'callTracer' ? 'call' : 'prestate'; - - try { - const trace = (await thorClient.debug.traceContractCall( - { - options: { - caller: transactionOptions.from, - gas: - transactionOptions.gas !== undefined - ? parseInt(transactionOptions.gas, 16) - : undefined, - gasPrice: transactionOptions.gasPrice - }, - target: { - to: - typeof transactionOptions.to === 'string' - ? Address.of(transactionOptions.to) - : transactionOptions.to, - data: - typeof transactionOptions.data === 'string' - ? HexUInt.of(transactionOptions.data) - : undefined - }, - config: tracerOptions.tracerConfig - }, - tracerToUse - )) as TraceReturnType<'call'> | TraceReturnType<'prestate'>; - - return debugFormatter.formatToRPCStandard(tracerToUse, trace); - } catch (e) { - throw new JSONRPCInternalError( - 'debug_traceCall()', - 'Method "debug_traceCall" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { debugTraceCall }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/index.ts deleted file mode 100644 index d80c26862..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './debug_traceCall'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/types.d.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/types.d.ts deleted file mode 100644 index efcd150de..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceCall/types.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { type BaseTransactionObjectInput } from '../types'; - -/** - * Type for trace options - */ -interface TraceCallRPC { - tracer: 'callTracer' | 'prestateTracer'; - tracerConfig?: { onlyTopCall?: boolean }; -} - -/** - * Transaction object input type - */ -interface TransactionObjectInput extends BaseTransactionObjectInput { - from?: string; - to: string; -} - -export type { TraceCallRPC, TransactionObjectInput }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.ts deleted file mode 100644 index 87516ad70..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { ThorId } from '@vechain/sdk-core'; -import { - InvalidDataType, - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { - type ThorClient, - type TraceReturnType, - type TracerName -} from '../../../../../thor-client'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { debugFormatter, type TracerReturnTypeRPC } from '../../../formatter'; -import { ethGetTransactionReceipt } from '../eth_getTransactionReceipt'; -import { type TraceOptionsRPC } from './types'; - -/** - * RPC Method debug_traceTransaction implementation - * - * @link [debug_traceTransaction](https://www.quicknode.com/docs/ethereum/debug_traceTransaction) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: transactionHash - hex string - This describes the transaction hash of the transaction that needs to be traced. - * * params[1]: options - object - This describes the options for the trace. It has the following parameters: - * * tracer - string to specify the type of tracer. Currently, it supports callTracer and prestateTracer. - * * timeout - string - A duration string of decimal numbers that overrides the default timeout of 5 seconds for JavaScript-based tracing calls. - * Max timeout is "10s". Valid time units are "ns", "us", "ms", "s" each with an optional fraction, such as "300ms" or "2s45ms" - * * tracerConfig - Object to specify configurations for the tracer. It has the following parameter: - * * onlyTopCall - boolean Setting this to true will only trace the main (top-level) call and none of the sub-calls. - * This avoids extra processing for each call frame if only the top-level call info are required (useful for getting revertReason). - * - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const debugTraceTransaction = async ( - thorClient: ThorClient, - params: unknown[] -): Promise | TracerReturnTypeRPC<'prestate'>> => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - typeof params[1] !== 'object' - ) - throw new JSONRPCInvalidParams( - 'debug_traceTransaction', - `Invalid input params for "debug_traceTransaction" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - // Init params - const [transactionId, traceOptions] = params as [string, TraceOptionsRPC]; - - // Invalid transaction ID - if (!ThorId.isValid(transactionId)) { - throw new InvalidDataType( - 'debug_traceTransaction()', - 'Invalid transaction ID given as input. Input must be an hex string of length 64.', - { transactionId } - ); - } - - // Tracer to use - const tracerToUse: TracerName = - traceOptions.tracer === 'callTracer' ? 'call' : 'prestate'; - - try { - const transactionReceipt = await ethGetTransactionReceipt(thorClient, [ - transactionId - ]); - - const trace = (await thorClient.debug.traceTransactionClause( - { - target: { - blockId: ThorId.of(transactionReceipt?.blockHash as string), - transaction: ThorId.of( - transactionReceipt?.transactionHash as string - ), - clauseIndex: 0 - }, - config: {} - }, - tracerToUse - )) as TraceReturnType<'call'> | TraceReturnType<'prestate'>; - - return debugFormatter.formatToRPCStandard(tracerToUse, trace); - } catch (e) { - throw new JSONRPCInternalError( - 'debug_traceTransaction()', - 'Method "debug_traceTransaction" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { debugTraceTransaction }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/index.ts deleted file mode 100644 index 37144de8f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './debug_traceTransaction'; -export type * from './types.d'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/types.d.ts b/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/types.d.ts deleted file mode 100644 index 510f503a2..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/debug_traceTransaction/types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Type for trace options - */ -interface TraceOptionsRPC { - tracer: 'callTracer' | 'prestateTracer'; - tracerConfig?: { onlyTopCall?: boolean }; - // Not supported yet - timeout?: string; -} - -export type { TraceOptionsRPC }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeCapabilities/engine_exchangeCapabilities.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeCapabilities/engine_exchangeCapabilities.ts deleted file mode 100644 index 7900fdb55..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeCapabilities/engine_exchangeCapabilities.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_exchangeCapabilities implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineExchangeCapabilities = - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_exchangeCapabilities', - messages: [ - 'Method "engine_exchangeCapabilities" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); - }; - -export { engineExchangeCapabilities }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeCapabilities/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeCapabilities/index.ts deleted file mode 100644 index 40d8b1f81..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeCapabilities/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_exchangeCapabilities'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/engine_exchangeTransitionConfigurationV1.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/engine_exchangeTransitionConfigurationV1.ts deleted file mode 100644 index c9d667406..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/engine_exchangeTransitionConfigurationV1.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_exchangeTransitionConfigurationV1 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineExchangeTransitionConfigurationV1 = - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_exchangeTransitionConfigurationV1', - messages: [ - 'Method "engine_exchangeTransitionConfigurationV1" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); - }; - -export { engineExchangeTransitionConfigurationV1 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/index.ts deleted file mode 100644 index 8acc2aaaf..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_exchangeTransitionConfigurationV1'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV1/engine_forkchoiceUpdatedV1.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV1/engine_forkchoiceUpdatedV1.ts deleted file mode 100644 index 2e6cf8541..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV1/engine_forkchoiceUpdatedV1.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_forkchoiceUpdatedV1 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineForkchoiceUpdatedV1 = - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_forkchoiceUpdatedV1', - messages: [ - 'Method "engine_forkchoiceUpdatedV1" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); - }; - -export { engineForkchoiceUpdatedV1 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV1/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV1/index.ts deleted file mode 100644 index 4b4258bcc..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV1/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_forkchoiceUpdatedV1'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV2/engine_forkchoiceUpdatedV2.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV2/engine_forkchoiceUpdatedV2.ts deleted file mode 100644 index 5c921556d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV2/engine_forkchoiceUpdatedV2.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_forkchoiceUpdatedV2 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineForkchoiceUpdatedV2 = - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_forkchoiceUpdatedV2', - messages: [ - 'Method "engine_forkchoiceUpdatedV2" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); - }; - -export { engineForkchoiceUpdatedV2 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV2/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV2/index.ts deleted file mode 100644 index 8d2591632..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV2/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_forkchoiceUpdatedV2'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV3/engine_forkchoiceUpdatedV3.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV3/engine_forkchoiceUpdatedV3.ts deleted file mode 100644 index e6002c789..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV3/engine_forkchoiceUpdatedV3.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_forkchoiceUpdatedV3 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineForkchoiceUpdatedV3 = - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_forkchoiceUpdatedV3', - messages: [ - 'Method "engine_forkchoiceUpdatedV3" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); - }; - -export { engineForkchoiceUpdatedV3 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV3/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV3/index.ts deleted file mode 100644 index 252bf230e..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_forkchoiceUpdatedV3/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_forkchoiceUpdatedV3'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/engine_getPayloadBodiesByHashV1.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/engine_getPayloadBodiesByHashV1.ts deleted file mode 100644 index c7b5d3b9f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/engine_getPayloadBodiesByHashV1.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_getPayloadBodiesByHashV1 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineGetPayloadBodiesByHashV1 = - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_getPayloadBodiesByHashV1', - messages: [ - 'Method "engine_getPayloadBodiesByHashV1" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); - }; - -export { engineGetPayloadBodiesByHashV1 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/index.ts deleted file mode 100644 index ddcb3b91a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_getPayloadBodiesByHashV1'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/engine_getPayloadBodiesByRangeV1.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/engine_getPayloadBodiesByRangeV1.ts deleted file mode 100644 index 6c2bc9843..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/engine_getPayloadBodiesByRangeV1.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_getPayloadBodiesByRangeV1 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineGetPayloadBodiesByRangeV1 = - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_getPayloadBodiesByRangeV1', - messages: [ - 'Method "engine_getPayloadBodiesByRangeV1" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); - }; - -export { engineGetPayloadBodiesByRangeV1 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/index.ts deleted file mode 100644 index a34590195..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_getPayloadBodiesByRangeV1'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV1/engine_getPayloadV1.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV1/engine_getPayloadV1.ts deleted file mode 100644 index 4c5b92ff3..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV1/engine_getPayloadV1.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_getPayloadV1 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineGetPayloadV1 = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_getPayloadV1', - messages: ['Method "engine_getPayloadV1" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { engineGetPayloadV1 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV1/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV1/index.ts deleted file mode 100644 index 9150ed3be..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV1/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_getPayloadV1'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV2/engine_getPayloadV2.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV2/engine_getPayloadV2.ts deleted file mode 100644 index 998742a92..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV2/engine_getPayloadV2.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_getPayloadV2 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineGetPayloadV2 = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_getPayloadV2', - messages: ['Method "engine_getPayloadV2" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { engineGetPayloadV2 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV2/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV2/index.ts deleted file mode 100644 index 408b14a4f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV2/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_getPayloadV2'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV3/engine_getPayloadV3.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV3/engine_getPayloadV3.ts deleted file mode 100644 index 35925f5be..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV3/engine_getPayloadV3.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_getPayloadV3 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineGetPayloadV3 = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_getPayloadV3', - messages: ['Method "engine_getPayloadV3" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { engineGetPayloadV3 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV3/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV3/index.ts deleted file mode 100644 index e91af5d65..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_getPayloadV3/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_getPayloadV3'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV1/engine_newPayloadV1.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV1/engine_newPayloadV1.ts deleted file mode 100644 index c2df443d5..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV1/engine_newPayloadV1.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_newPayloadV1 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineNewPayloadV1 = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_newPayloadV1', - messages: ['Method "engine_newPayloadV1" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { engineNewPayloadV1 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV1/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV1/index.ts deleted file mode 100644 index 65ca8cd92..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV1/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_newPayloadV1'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV2/engine_newPayloadV2.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV2/engine_newPayloadV2.ts deleted file mode 100644 index 2f795c6b6..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV2/engine_newPayloadV2.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_newPayloadV2 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineNewPayloadV2 = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_newPayloadV2', - messages: ['Method "engine_newPayloadV2" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { engineNewPayloadV2 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV2/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV2/index.ts deleted file mode 100644 index e391fa61b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV2/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_newPayloadV2'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV3/engine_newPayloadV3.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV3/engine_newPayloadV3.ts deleted file mode 100644 index 549550ced..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV3/engine_newPayloadV3.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method engine_newPayloadV3 implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const engineNewPayloadV3 = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'engine_newPayloadV3', - messages: ['Method "engine_newPayloadV3" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { engineNewPayloadV3 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV3/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV3/index.ts deleted file mode 100644 index 7f66702d0..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/engine_newPayloadV3/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './engine_newPayloadV3'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_accounts/eth_accounts.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_accounts/eth_accounts.ts deleted file mode 100644 index 9cfea09a8..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_accounts/eth_accounts.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { type VeChainProvider } from '../../../../providers/vechain-provider'; - -/** - * RPC Method eth_accounts implementation - * - * @param provider - Provider with ProviderInternalWallet instance to use. - */ -const ethAccounts = async (provider?: VeChainProvider): Promise => { - // ProviderInternalWallet exists - if (provider?.wallet !== undefined) - return await provider?.wallet.getAddresses(); - - // In error case (if wallet is not defined), return an empty array - return []; -}; - -export { ethAccounts }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_accounts/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_accounts/index.ts deleted file mode 100644 index 7aeea9aa7..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_accounts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_accounts'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.ts deleted file mode 100644 index 269d187fa..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { JSONRPCInternalError, stringifyData } from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; - -/** - * RPC Method eth_blockNumber implementation - * - * @link [eth_blockNumber](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @returns the latest block number as a hex string. If the block number cannot be retrieved, it will return '0x0' - * @throws {JSONRPCInternalError} - */ -const ethBlockNumber = async (thorClient: ThorClient): Promise => { - try { - // 'best' is the alias for 'latest' in VeChainThorest - const latestBlock = await thorClient.blocks.getBestBlockCompressed(); - - return latestBlock?.number !== undefined - ? `0x${latestBlock.number.toString(16)}` - : '0x0'; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_blockNumber()', - 'Method "eth_blockNumber" failed.', - { - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethBlockNumber }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_blockNumber/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_blockNumber/index.ts deleted file mode 100644 index c1931c933..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_blockNumber/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_blockNumber'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/eth_call.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/eth_call.ts deleted file mode 100644 index f7e6cbf80..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/eth_call.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { getCorrectBlockNumberRPCToVeChain } from '../../../const'; -import { type TransactionObjectInput } from './types'; -import { type BlockQuantityInputRPC } from '../../types'; -import { - type SimulateTransactionClause, - type SimulateTransactionOptions, - type ThorClient -} from '../../../../../thor-client'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_call implementation - * - * @link [eth_call](https://ethereum.github.io/execution-apis/api-documentation/) - * @param thorClient - The thor client instance to use. - * @param params - The transaction call object - * @returns The return value of executed contract. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethCall = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'object' || - (typeof params[1] !== 'object' && typeof params[1] !== 'string') - ) - throw new JSONRPCInvalidParams( - 'eth_call', - `Invalid input params for "eth_call" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - const [inputOptions, block] = params as [ - TransactionObjectInput, - BlockQuantityInputRPC - ]; - - // Simulate transaction - const simulatedTx = await thorClient.transactions.simulateTransaction( - [ - { - to: inputOptions.to ?? null, - value: inputOptions.value ?? '0x0', - data: inputOptions.data ?? '0x0' - } satisfies SimulateTransactionClause - ], - { - revision: getCorrectBlockNumberRPCToVeChain(block), - gas: - inputOptions.gas !== undefined - ? parseInt(inputOptions.gas, 16) - : undefined, - gasPrice: inputOptions.gasPrice ?? inputOptions.gasPrice, - caller: inputOptions.from - } satisfies SimulateTransactionOptions - ); - - // Return simulated transaction data - return simulatedTx[0].data; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_call()', - 'Method "eth_call" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethCall }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/index.ts deleted file mode 100644 index 6aec9d1cb..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_call'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/types.d.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/types.d.ts deleted file mode 100644 index 03a6e17d1..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_call/types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { type BaseTransactionObjectInput } from '../types'; - -/** - * Transaction object input type - */ -interface TransactionObjectInput extends BaseTransactionObjectInput { - from: string; - to?: string; -} - -export type { TransactionObjectInput }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_chainId/eth_chainId.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_chainId/eth_chainId.ts deleted file mode 100644 index c1e46047f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_chainId/eth_chainId.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { CHAIN_ID } from '../../../const'; -import { networkInfo } from '@vechain/sdk-core'; - -/** - * RPC Method eth_chainId implementation - * - * @link [eth_chainId](https://ethereum.github.io/execution-apis/api-documentation/) - * @link [Chain IDs](https://chainlist.org/?search=vechain&testnets=true) - * - * @param thorClient - ThorClient instance. - * @returns The chain id - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethChainId = async (thorClient: ThorClient): Promise => { - try { - const genesisBlock = await thorClient.blocks.getGenesisBlock(); - - if (genesisBlock?.id === null || genesisBlock?.id === undefined) { - throw new JSONRPCInvalidParams( - 'eth_chainId()', - 'The genesis block id is null or undefined. Unable to get the chain id.', - { - url: thorClient.httpClient.baseURL - } - ); - } - - // We are on Mainnet - if (genesisBlock.id === networkInfo.mainnet.genesisBlock.id) - return CHAIN_ID.MAINNET; - - // Testnet OR Solo OR some other network - return CHAIN_ID.TESTNET; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_chainId()', - 'Method "eth_chainId" failed.', - { - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethChainId }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_chainId/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_chainId/index.ts deleted file mode 100644 index f2c518bef..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_chainId/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_chainId'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_coinbase/eth_coinbase.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_coinbase/eth_coinbase.ts deleted file mode 100644 index 82a66cc28..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_coinbase/eth_coinbase.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_coinbase implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethCoinbase = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_coinbase', - messages: ['Method "eth_coinbase" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethCoinbase }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_coinbase/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_coinbase/index.ts deleted file mode 100644 index c65a5504c..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_coinbase/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_coinbase'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_createAccessList/eth_createAccessList.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_createAccessList/eth_createAccessList.ts deleted file mode 100644 index 3e9be3e71..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_createAccessList/eth_createAccessList.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_createAccessList implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethCreateAccessList = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_createAccessList', - messages: [ - 'Method "eth_createAccessList" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethCreateAccessList }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_createAccessList/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_createAccessList/index.ts deleted file mode 100644 index 464fadf6a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_createAccessList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_createAccessList'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.ts deleted file mode 100644 index 9fd101caf..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type TransactionObjectInput } from './types'; -import { - type SimulateTransactionClause, - type ThorClient -} from '../../../../../thor-client'; -import { getCorrectBlockNumberRPCToVeChain } from '../../../const'; -import { type BlockQuantityInputRPC } from '../../types'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_estimateGas implementation - * - * @link [eth_estimateGas](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @note At the moment only the `to`, `value` and `data` fields are supported. - * - * @param thorClient - ThorClient instance. - * @param params - The standard array of rpc call parameters. - * * params[0]: The transaction call object. - * * params[1]: A string representing a block number, or one of the string tags latest, earliest, or pending. - * @returns A hexadecimal number representing the estimation of the gas for a given transaction. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethEstimateGas = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if (![1, 2].includes(params.length) || typeof params[0] !== 'object') - throw new JSONRPCInvalidParams( - 'eth_estimateGas', - `Invalid input params for "eth_estimateGas" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - // NOTE: The standard requires block parameter. - // Here it is ignored and can be added in the future compatibility reasons. - // (INPUT CHECK TAKE CARE OF THIS) - const [inputOptions, revision] = params as [ - TransactionObjectInput, - BlockQuantityInputRPC? - ]; - - const estimatedGas = await thorClient.gas.estimateGas( - [ - { - to: inputOptions.to ?? null, - value: inputOptions.value ?? '0x0', - data: inputOptions.data ?? '0x0' - } satisfies SimulateTransactionClause - ], - inputOptions.from, - { - revision: - revision !== undefined - ? getCorrectBlockNumberRPCToVeChain(revision) - : undefined - } - ); - - // Convert intrinsic gas to hex string and return - return await Promise.resolve('0x' + estimatedGas.totalGas.toString(16)); - } catch (e) { - throw new JSONRPCInternalError( - 'eth_estimateGas()', - 'Method "eth_estimateGas" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethEstimateGas }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/index.ts deleted file mode 100644 index 85498ec17..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_estimateGas'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/types.d.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/types.d.ts deleted file mode 100644 index d8d3550a1..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { type BaseTransactionObjectInput } from '../types'; - -/** - * Transaction object input type - */ -interface TransactionObjectInput extends BaseTransactionObjectInput { - from?: string; - to: string; -} - -export type { TransactionObjectInput }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_feeHistory/eth_feeHistory.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_feeHistory/eth_feeHistory.ts deleted file mode 100644 index fcbf74764..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_feeHistory/eth_feeHistory.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_feeHistory implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethFeeHistory = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_feeHistory', - messages: ['Method "eth_feeHistory" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethFeeHistory }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_feeHistory/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_feeHistory/index.ts deleted file mode 100644 index be8578d87..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_feeHistory/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_feeHistory'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.ts deleted file mode 100644 index 15e196c12..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; - -/** - * RPC Method eth_gasPrice implementation - * @link [ethGasPrice](https://ethereum.github.io/execution-apis/api-documentation/) - * @returns The current gas price in Wei unit considering that 1 VTHO equals 1e18 Wei. - */ -const ethGasPrice = async (thorClient: ThorClient): Promise => { - const { - result: { plain } - } = await thorClient.contracts.getBaseGasPrice(); - - return '0x' + BigInt(plain as bigint).toString(16); -}; - -export { ethGasPrice }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_gasPrice/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_gasPrice/index.ts deleted file mode 100644 index 414f67f72..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_gasPrice/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_gasPrice'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBalance/eth_getBalance.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBalance/eth_getBalance.ts deleted file mode 100644 index b8a0b5684..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBalance/eth_getBalance.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import type { BlockQuantityInputRPC } from '../../types'; -import { getCorrectBlockNumberRPCToVeChain } from '../../../const'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { Address, Revision } from '@vechain/sdk-core'; - -/** - * RPC Method eth_getBalance implementation - * - * @link [eth_getBalance](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @note Only 'latest' and 'finalized' block numbers are supported. - * - * @param thorClient - ThorClient instance. - * @param params - The standard array of rpc call parameters. - * * params[0]: The address to get the balance for as a hex string. - * * params[1]: The block number to get the balance at as a hex string or "latest". - * @returns the balance of the account at the given address formatted to the RPC standard. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetBalance = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - (typeof params[1] !== 'object' && typeof params[1] !== 'string') - ) - throw new JSONRPCInvalidParams( - 'eth_getBalance', - `Invalid input params for "eth_getBalance" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - const [address, block] = params as [string, BlockQuantityInputRPC]; - - // Get the account details - const accountDetails = await thorClient.accounts.getAccount( - Address.of(address), - { - revision: Revision.of(getCorrectBlockNumberRPCToVeChain(block)) - } - ); - - return accountDetails.balance; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getBalance()', - 'Method "eth_getBalance" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetBalance }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBalance/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBalance/index.ts deleted file mode 100644 index d3c8ab0d1..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBalance/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getBalance'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.ts deleted file mode 100644 index 972aed4b1..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { ThorId } from '@vechain/sdk-core'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { ethGetBlockByNumber } from '../eth_getBlockByNumber'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type BlocksRPC } from '../../../formatter'; -import { type ThorClient } from '../../../../../thor-client'; - -/** - * RPC Method eth_getBlockByHash implementation - * - * @link [eth_getBlockByHash](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The block hash of block to get. - * * params[1]: The transaction hydrated detail flag. If true, the block will contain the transaction details, otherwise it will only contain the transaction hashes. - * @returns the block at the given block hash formatted to the RPC standard or null if the block does not exist. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetBlockByHash = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - !ThorId.isValid(params[0]) || - typeof params[1] !== 'boolean' - ) - throw new JSONRPCInvalidParams( - 'eth_getBlockByHash', - `Invalid input params for "eth_getBlockByHash" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - // Return the block by number (in this case, the block hash is the block number) - return await ethGetBlockByNumber(thorClient, params); - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getBlockByHash()', - 'Method "eth_getBlockByHash" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetBlockByHash }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByHash/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByHash/index.ts deleted file mode 100644 index 104e8d23b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByHash/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getBlockByHash'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByNumber/eth_getBlockByNumber.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByNumber/eth_getBlockByNumber.ts deleted file mode 100644 index 01c03b9a2..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByNumber/eth_getBlockByNumber.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { getCorrectBlockNumberRPCToVeChain } from '../../../const'; -import { blocksFormatter, type BlocksRPC } from '../../../formatter'; -import { ethChainId } from '../eth_chainId'; - -/** - * RPC Method eth_getBlockByNumber implementation - * - * @link [eth_getBlockByNumber](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @note - * * Standard RPC method `eth_getBlockByNumber` support following block numbers: hex number of block, 'earliest', 'latest', 'safe', 'finalized', 'pending'. (@see https://ethereum.org/en/developers/docs/apis/json-rpc#default-block) - * * Currently, VeChainonly supports hex number of block, 'latest' and 'finalized'. - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The block number to get as a hex string or "latest" or "finalized". - * * params[1]: The transaction detail flag. If true, the block will contain the transaction details, otherwise it will only contain the transaction hashes. - * @returns the block at the given block number formatted to the RPC standard or null if the block does not exist. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetBlockByNumber = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - typeof params[1] !== 'boolean' - ) - throw new JSONRPCInvalidParams( - 'eth_getBlockByNumber', - `Invalid input params for "eth_getBlockByNumber" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - const [blockNumber, isTxDetail] = params as [string, boolean]; - - let chainId: string = '0x0'; - - // If the transaction detail flag is set, we need to get the chain id - if (isTxDetail) { - chainId = await ethChainId(thorClient); - } - - const block = isTxDetail - ? await thorClient.blocks.getBlockExpanded( - getCorrectBlockNumberRPCToVeChain(blockNumber) - ) - : await thorClient.blocks.getBlockCompressed( - getCorrectBlockNumberRPCToVeChain(blockNumber) - ); - - return block !== null - ? blocksFormatter.formatToRPCStandard(block, chainId) - : null; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getBlockByNumber()', - 'Method "eth_getBlockByNumber" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetBlockByNumber }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByNumber/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByNumber/index.ts deleted file mode 100644 index 450569bef..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockByNumber/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getBlockByNumber'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.ts deleted file mode 100644 index d10235c4c..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { - type TransactionReceiptRPC, - type TransactionRPC -} from '../../../formatter'; -import { ethGetBlockByNumber } from '../eth_getBlockByNumber'; -import { ethGetTransactionReceipt } from '../eth_getTransactionReceipt'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_getBlockReceipts implementation - * - * @link [eth_getBlockReceipts](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: blockNumber - The block number to get the receipts for as a hex string or "latest". - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetBlockReceipts = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'string') - throw new JSONRPCInvalidParams( - 'eth_getBlockReceipts', - `Invalid input params for "eth_getBlockReceipts" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - // Initialize the block number from the params - const [blockNumber] = params as [string]; - - // Get the block by number - const block = await ethGetBlockByNumber(thorClient, [ - blockNumber, - true - ]); - - // Return the block receipts - - // Block is null, return null - if (block === null) return null; - - // Block is not null, return the block receipts - const transactionsIntoTheBlock: TransactionRPC[] = - block.transactions as TransactionRPC[]; - - const transactionReceipts: TransactionReceiptRPC[] = []; - - for (const tx of transactionsIntoTheBlock) { - const receipt = (await ethGetTransactionReceipt(thorClient, [ - tx.hash - ])) as TransactionReceiptRPC; - - transactionReceipts.push(receipt); - } - - return transactionReceipts; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getBlockReceipts()', - 'Method "eth_getBlockReceipts" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetBlockReceipts }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockReceipts/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockReceipts/index.ts deleted file mode 100644 index 09b2d7060..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockReceipts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getBlockReceipts'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByHash/eth_getBlockTransactionCountByHash.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByHash/eth_getBlockTransactionCountByHash.ts deleted file mode 100644 index 8943cb246..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByHash/eth_getBlockTransactionCountByHash.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { ThorClient } from '../../../../../thor-client'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { ethGetBlockByHash } from '../eth_getBlockByHash'; -import { ThorId } from '@vechain/sdk-core'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_getBlockTransactionCountByHash implementation - * - * @link [eth_getBlockTransactionCountByHash](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The block hash of block to get. - * @returns The number of transactions in the block with the given block hash. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetBlockTransactionCountByHash = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 1 || - typeof params[0] !== 'string' || - !ThorId.isValid(params[0]) - ) - throw new JSONRPCInvalidParams( - 'eth_getBlockTransactionCountByHash', - `Invalid input params for "eth_getBlockTransactionCountByHash" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - const block = await ethGetBlockByHash(thorClient, [params[0], false]); - if (block !== null) return block.transactions.length; - return 0; -}; - -export { ethGetBlockTransactionCountByHash }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByHash/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByHash/index.ts deleted file mode 100644 index b61e413b7..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByHash/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getBlockTransactionCountByHash'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/eth_getBlockTransactionCountByNumber.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/eth_getBlockTransactionCountByNumber.ts deleted file mode 100644 index 50749f28b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/eth_getBlockTransactionCountByNumber.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import type { ThorClient } from '../../../../../thor-client'; -import { ethGetBlockByNumber } from '../eth_getBlockByNumber'; - -/** - * RPC Method eth_getBlockTransactionCountByNumber implementation - * - * @link [eth_getBlockTransactionCountByNumber](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The block hash of block to get. - * @returns The number of transactions in the block with the given block hash. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetBlockTransactionCountByNumber = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'string') - throw new JSONRPCInvalidParams( - 'eth_getBlockTransactionCountByNumber', - `Invalid input params for "eth_getBlockTransactionCountByNumber" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - const block = await ethGetBlockByNumber(thorClient, [params[0], false]); - if (block !== null) return block.transactions.length; - return 0; -}; - -export { ethGetBlockTransactionCountByNumber }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/index.ts deleted file mode 100644 index d4dedd264..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getBlockTransactionCountByNumber'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getCode/eth_getCode.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getCode/eth_getCode.ts deleted file mode 100644 index d1a55c0e7..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getCode/eth_getCode.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import type { BlockQuantityInputRPC } from '../../types'; -import { getCorrectBlockNumberRPCToVeChain } from '../../../const'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { Address, Revision } from '@vechain/sdk-core'; - -/** - * RPC Method eth_getCode implementation - * - * @link [eth_getCode](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @note Only 'latest' and 'finalized' block numbers are supported. - * - * @param thorClient - ThorClient instance. - * @param params - The standard array of rpc call parameters. - * * params[0]: The address to get the code for as a hex string. - * * params[1]: The block number to get the code at as a hex string or "latest". - * @returns The code of the account at the given address formatted to the RPC standard. - * @throws {JSONRPCInternalError} - */ -const ethGetCode = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - (typeof params[1] !== 'object' && typeof params[1] !== 'string') - ) - throw new JSONRPCInvalidParams( - 'eth_getCode', - `Invalid input params for "eth_getCode" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - const [address, block] = params as [string, BlockQuantityInputRPC]; - - // Get the account bytecode - const bytecode = await thorClient.accounts.getBytecode( - Address.of(address), - { - revision: Revision.of(getCorrectBlockNumberRPCToVeChain(block)) - } - ); - return bytecode.toString(); - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getCode()', - 'Method "eth_getCode" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetCode }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getCode/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getCode/index.ts deleted file mode 100644 index 27cbdc8c0..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getCode/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getCode'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterChanges/eth_getFilterChanges.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterChanges/eth_getFilterChanges.ts deleted file mode 100644 index 5bce04e64..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterChanges/eth_getFilterChanges.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_getFilterChanges implementation - * - * @link [eth_getFilterChanges](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethGetFilterChanges = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_getFilterChanges', - messages: [ - 'Method "eth_getFilterChanges" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethGetFilterChanges }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterChanges/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterChanges/index.ts deleted file mode 100644 index 5107c01eb..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterChanges/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getFilterChanges'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterLogs/eth_getFilterLogs.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterLogs/eth_getFilterLogs.ts deleted file mode 100644 index 89bc3763b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterLogs/eth_getFilterLogs.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_getFilterLogs implementation - * - * @link [eth_getFilterLogs](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethGetFilterLogs = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_getFilterLogs', - messages: ['Method "eth_getFilterLogs" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethGetFilterLogs }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterLogs/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterLogs/index.ts deleted file mode 100644 index 5c0db6540..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getFilterLogs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getFilterLogs'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getLogs/eth_getLogs.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getLogs/eth_getLogs.ts deleted file mode 100644 index 7fe5c47bb..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getLogs/eth_getLogs.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { - formatToLogsRPC, - getCriteriaSetForInput, - type LogsRPC -} from '../../../formatter'; -import { - type CompressedBlockDetail, - type EventCriteria, - type EventLogs, - type ThorClient -} from '../../../../../thor-client'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_getLogs implementation - * - * @link [eth_getLogs](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @returns An array of log objects, or an empty array if nothing has changed since last poll - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetLogs = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'object') - throw new JSONRPCInvalidParams( - 'eth_getLogs', - `Invalid input params for "eth_getLogs" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - // Block max limit - const MAX_LIMIT = 1000; - - // Input params - const [filterOptions] = params as [ - { - address?: string | string[] | null; - fromBlock?: string; - toBlock?: string; - topics?: string[] | string[][]; - blockhash?: string; - } - ]; - - try { - // Get the latest block (if fromBlock or toBlock is not defined, we will use the latest block) - const latestBlock = - (await thorClient.blocks.getBestBlockCompressed()) as CompressedBlockDetail; - - // Get criteria set from input - const criteriaSet: EventCriteria[] = getCriteriaSetForInput({ - address: - filterOptions.address !== null - ? filterOptions.address - : undefined, - topics: filterOptions.topics - }); - - // Call thor client to get logs - const logs: EventLogs[] = await thorClient.logs.filterRawEventLogs({ - range: { - unit: 'block', - from: - filterOptions.fromBlock !== undefined - ? parseInt(filterOptions.fromBlock, 16) - : latestBlock.number, - to: - filterOptions.toBlock !== undefined - ? parseInt(filterOptions.toBlock, 16) - : latestBlock.number - }, - criteriaSet, - order: 'asc', - options: { - offset: 0, - limit: MAX_LIMIT - } - }); - - // Format logs to RPC - return formatToLogsRPC(logs); - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getLogs()', - 'Method "eth_getLogs" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetLogs }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getLogs/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getLogs/index.ts deleted file mode 100644 index a789417a2..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getLogs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getLogs'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getProof/eth_getProof.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getProof/eth_getProof.ts deleted file mode 100644 index dbf6021ee..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getProof/eth_getProof.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_getProof implementation - * - * @link [eth_getProof](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethGetProof = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_getProof', - messages: ['Method "eth_getProof" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethGetProof }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getProof/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getProof/index.ts deleted file mode 100644 index e92b7954a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getProof/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getProof'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getStorageAt/eth_getStorageAt.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getStorageAt/eth_getStorageAt.ts deleted file mode 100644 index 3ace9e08d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getStorageAt/eth_getStorageAt.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Address, Revision, ThorId } from '@vechain/sdk-core'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { getCorrectBlockNumberRPCToVeChain } from '../../../const'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import type { BlockQuantityInputRPC } from '../../types'; -import { type ThorClient } from '../../../../../thor-client'; - -/** - * RPC Method eth_getStorageAt implementation - * - * @link [eth_getStorageAt](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @note Only 'latest' and 'finalized' block numbers are supported. - * - * @param thorClient - ThorClient instance. - * @param params - The standard array of rpc call parameters. - * * params[0]: The address to get the storage slot for as a hex string. - * * params[1]: The storage position to get as a hex string. - * * params[2]: The block number to get the storage slot at as a hex string or "latest". - * @returns The storage slot of the account at the given address formatted to the RPC standard. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetStorageAt = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 3 || - typeof params[0] !== 'string' || - typeof params[1] !== 'string' || - (typeof params[2] !== 'object' && typeof params[2] !== 'string') - ) - throw new JSONRPCInvalidParams( - 'eth_getStorageAt', - `Invalid input params for "eth_getStorageAt" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - const [address, storagePosition, block] = params as [ - string, - string, - BlockQuantityInputRPC - ]; - - // Get the account details - const storage = await thorClient.accounts.getStorageAt( - Address.of(address), - ThorId.of(storagePosition), - { - revision: Revision.of(getCorrectBlockNumberRPCToVeChain(block)) - } - ); - return storage.toString(); - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getStorageAt()', - 'Method "eth_getStorageAt" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetStorageAt }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getStorageAt/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getStorageAt/index.ts deleted file mode 100644 index 99c1d1277..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getStorageAt/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getStorageAt'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockHashAndIndex.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockHashAndIndex.ts deleted file mode 100644 index c2600c033..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockHashAndIndex.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { type BlocksRPC, type TransactionRPC } from '../../../formatter'; -import { ethGetBlockByHash } from '../eth_getBlockByHash'; -import { ethGetTransactionByHash } from '../eth_getTransactionByHash'; - -/** - * RPC Method eth_getTransactionByBlockHashAndIndex implementation - * - * @link [eth_getTransactionByBlockHashAndIndex](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethGetTransactionByBlockHashAndIndex = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - typeof params[1] !== 'string' - ) - throw new JSONRPCInvalidParams( - 'eth_getTransactionByBlockHashAndIndex', - `Invalid input params for "eth_getTransactionByBlockHashAndIndex" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - const [blockHash, index] = params as [string, string]; - - // Get the block containing the transactions - const block = (await ethGetBlockByHash(thorClient, [ - blockHash, - false - ])) as BlocksRPC; - - for (const transactionHash of block.transactions) { - const transaction = (await ethGetTransactionByHash(thorClient, [ - transactionHash - ])) as TransactionRPC; - if (transaction.transactionIndex === index) { - return transaction; - } - } - - return null; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getTransactionByBlockHashAndIndex()', - 'Method "eth_getTransactionByBlockHashAndIndex" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetTransactionByBlockHashAndIndex }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/index.ts deleted file mode 100644 index 55c0476ed..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getTransactionByBlockHashAndIndex'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.ts deleted file mode 100644 index 9869b5446..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { type BlocksRPC, type TransactionRPC } from '../../../formatter'; -import { ethGetBlockByNumber } from '../eth_getBlockByNumber'; -import { ethGetTransactionByHash } from '../eth_getTransactionByHash'; - -/** - * RPC Method eth_getTransactionByBlockNumberAndIndex implementation - * - * @link [eth_getTransactionByBlockNumberAndIndex](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: block parameter, a hexadecimal block number (or best, latest, finalized). - * * params[1]: transaction index position, a hexadecimal of the integer representing the position in the block. - * @returns A transaction object, or null when no transaction was found. - */ -const ethGetTransactionByBlockNumberAndIndex = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - typeof params[1] !== 'string' - ) - throw new JSONRPCInvalidParams( - 'eth_getTransactionByBlockNumberAndIndex', - `Invalid input params for "eth_getTransactionByBlockNumberAndIndex" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - const [blockHash, index] = params as [string, string]; - - // Get the block containing the transactions - const block = (await ethGetBlockByNumber(thorClient, [ - blockHash, - false - ])) as BlocksRPC; - - for (const transactionHash of block.transactions) { - const transaction = (await ethGetTransactionByHash(thorClient, [ - transactionHash - ])) as TransactionRPC; - if (transaction.transactionIndex === index) { - return transaction; - } - } - - return null; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getTransactionByBlockNumberAndIndex()', - 'Method "eth_getTransactionByBlockNumberAndIndex" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetTransactionByBlockNumberAndIndex }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/index.ts deleted file mode 100644 index 93002e16a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getTransactionByBlockNumberAndIndex'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByHash/eth_getTransactionByHash.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByHash/eth_getTransactionByHash.ts deleted file mode 100644 index 0ba29ec4a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByHash/eth_getTransactionByHash.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import { type TransactionRPC, transactionsFormatter } from '../../../formatter'; -import { getTransactionIndexIntoBlock } from '../../../helpers'; -import { ethChainId } from '../eth_chainId'; -import { ethGetBlockByNumber } from '../eth_getBlockByNumber'; - -/** - * RPC Method eth_getTransactionByHash implementation - * - * @link [eth_getTransactionByHash](https://docs.infura.io/networks/ethereum/json-rpc-methods/eth_gettransactionbyhash) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The transaction hash to get as a hex string. - * @returns the transaction at the given hash formatted to the RPC standard or null if the transaction does not exist. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetTransactionByHash = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'string') - throw new JSONRPCInvalidParams( - 'eth_getTransactionByHash', - `Invalid input params for "eth_getTransactionByHash" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - try { - const [hash] = params as [string]; - - // Get the VeChainThor transaction - const tx = await thorClient.transactions.getTransaction(hash); - - if (tx === null) return null; - - // Get the block containing the transaction - const block = await ethGetBlockByNumber(thorClient, [ - tx.meta.blockID, - false - ]); - - if (block === null) return null; - - // Get the index of the transaction in the block - const txIndex = getTransactionIndexIntoBlock(block, hash); - - // Get the chain id - const chainId = await ethChainId(thorClient); - - return transactionsFormatter.formatToRPCStandard(tx, chainId, txIndex); - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getTransactionByHash()', - 'Method "eth_getTransactionByHash" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetTransactionByHash }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByHash/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByHash/index.ts deleted file mode 100644 index c8a2c1e2a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionByHash/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getTransactionByHash'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionCount/eth_getTransactionCount.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionCount/eth_getTransactionCount.ts deleted file mode 100644 index eca9d05ab..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionCount/eth_getTransactionCount.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { Address, Hex, Secp256k1 } from '@vechain/sdk-core'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_getTransactionCount implementation - * - * @link [eth_getTransactionCount](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @note: To respect differences between VeChain and Ethereum, in this function we will give a random number as output. - * Basically Ethereum to get nonce to use the number of transactions sent from an address, - * while VeChain uses a random number. - * - * @param params - The standard array of rpc call parameters. - * * params[0]: address: string, is the address to get the number of transactions from. - * * params[1]: A string representing a block number, or one of the string tags latest, earliest, or pending. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethGetTransactionCount = async (params: unknown[]): Promise => { - // Input validation - if ( - typeof params[0] !== 'string' || - (typeof params[1] !== 'object' && typeof params[1] !== 'string') - ) - throw new JSONRPCInvalidParams( - 'eth_getTransactionCount', - `Invalid input params for "eth_getTransactionCount" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - // Invalid address - if (!Address.isValid(params[0])) { - throw new JSONRPCInvalidParams( - 'eth_getTransactionCount', - 'Invalid address, expected a 20 bytes address string.', - { params } - ); - } - - // Return a random number - return await Promise.resolve(Hex.of(Secp256k1.randomBytes(6)).toString()); -}; - -export { ethGetTransactionCount }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionCount/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionCount/index.ts deleted file mode 100644 index 7ccb9fccb..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionCount/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getTransactionCount'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.ts deleted file mode 100644 index 8c11f47d9..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { ThorId } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { - type ExpandedBlockDetail, - type ThorClient -} from '../../../../../thor-client'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils/const/rpc/rpc'; -import { - type TransactionReceiptRPC, - transactionsFormatter -} from '../../../formatter'; -import { ethChainId } from '../eth_chainId'; - -/** - * RPC Method eth_getTransactionReceipt implementation - * - * @link [eth_getTransactionReceipt](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * - * @param params - The standard array of rpc call parameters. - * * params[0]: The transaction hash to get as a hex string. - * - * @throws {ProviderRpcError} - Will throw an error if the retrieval of the transaction fails. - */ -const ethGetTransactionReceipt = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'string') - throw new JSONRPCInvalidParams( - 'eth_getTransactionReceipt', - `Invalid input params for "eth_getTransactionReceipt" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - // Invalid transaction ID - if (!ThorId.isValid(params[0])) { - throw new JSONRPCInvalidParams( - 'eth_getTransactionReceipt', - 'Invalid transaction ID given as input. Input must be an hex string of length 64.', - { params } - ); - } - - try { - // Get hash by params - const [hash] = params as [string]; - - // Get transaction receipt - const receipt = - await thorClient.transactions.getTransactionReceipt(hash); - - // Receipt is not null (transaction exists. This implies: Block exists and Transaction details exists) - if (receipt !== null) { - // Get the block containing the transaction. @note: It cannot be null!. If some error occurs, it will be thrown. - const blockContainsTransaction = - (await thorClient.blocks.getBlockExpanded( - receipt.meta.blockID - )) as ExpandedBlockDetail; - - // Get transaction detail. @note: It cannot be null!. If some error occurs, it will be thrown. - const transactionDetail = - await thorClient.transactions.getTransaction(hash); - - // Get the chain id - const chainId = await ethChainId(thorClient); - - // Initialize the result - if (transactionDetail !== null) - return transactionsFormatter.formatTransactionReceiptToRPCStandard( - hash, - receipt, - transactionDetail, - blockContainsTransaction, - chainId - ); - else return null; - } else { - return null; - } - } catch (e) { - throw new JSONRPCInternalError( - 'eth_getTransactionReceipt()', - 'Method "eth_getTransactionReceipt" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethGetTransactionReceipt }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionReceipt/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionReceipt/index.ts deleted file mode 100644 index 54e1b7ba3..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getTransactionReceipt/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getTransactionReceipt'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.ts deleted file mode 100644 index e64cefef1..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { ThorId } from '@vechain/sdk-core'; - -/** - * RPC Method eth_getUncleByBlockHashAndIndex implementation - * - * @link [eth_getUncleByBlockHashAndIndex](https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_getunclebyblockhashandindex) - * - * @note - * * Standard RPC method `eth_getUncleByBlockHashAndIndex` support following block numbers: hex number of block, 'earliest', 'latest', 'safe', 'finalized', 'pending'. (@see https://ethereum.org/en/developers/docs/apis/json-rpc#default-block) - * * Currently, VeChain only supports hex number of block, 'latest' and 'finalized'. - * * We return a constant empty object for now. - * - * @param params - The standard array of rpc call parameters. - * * params[0]: The block hash to get as a hex string. - * * params[1]: A hexadecimal equivalent of the integer indicating the uncle's index position. - * @returns The uncle block at the given block number and index. - * @throws {JSONRPCInvalidParams} - */ -const ethGetUncleByBlockHashAndIndex = async ( - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - !ThorId.isValid(params[0]) || - typeof params[1] !== 'string' - ) - throw new JSONRPCInvalidParams( - 'eth_getUncleByBlockHashAndIndex', - 'Invalid input params for "eth_getUncleByBlockHashAndIndex" method. See https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_getunclebyblockhashandindex for details.', - { params } - ); - - return await Promise.resolve(null); -}; - -export { ethGetUncleByBlockHashAndIndex }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/index.ts deleted file mode 100644 index a7297bb8b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getUncleByBlockHashAndIndex'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.ts deleted file mode 100644 index 32adfdd31..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Method eth_getUncleByBlockNumberAndIndex implementation - * - * @link [eth_getUncleByBlockNumberAndIndex](https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_getunclebyblocknumberandindex) - * - * @note - * * Standard RPC method `eth_getUncleByBlockNumberAndIndex` support following block numbers: hex number of block, 'earliest', 'latest', 'safe', 'finalized', 'pending'. (@see https://ethereum.org/en/developers/docs/apis/json-rpc#default-block) - * * Currently, VeChain only supports hex number of block, 'latest' and 'finalized'. - * * We return a constant empty object for now. - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The block number to get as a hex string or "latest" or "finalized". - * * params[1]: A hexadecimal equivalent of the integer indicating the uncle's index position. - * @returns The uncle block at the given block number and index. - * @throws {JSONRPCInvalidParams} - */ -const ethGetUncleByBlockNumberAndIndex = async ( - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - typeof params[1] !== 'string' - ) - throw new JSONRPCInvalidParams( - 'eth_getUncleByBlockNumberAndIndex', - 'Invalid input params for "eth_getUncleByBlockNumberAndIndex" method. See https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_getunclebyblocknumberandindex for details.', - { params } - ); - - return await Promise.resolve(null); -}; - -export { ethGetUncleByBlockNumberAndIndex }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/index.ts deleted file mode 100644 index 53381d997..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getUncleByBlockNumberAndIndex'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockHash/eth_getUncleCountByBlockHash.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockHash/eth_getUncleCountByBlockHash.ts deleted file mode 100644 index 65bbb0e69..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockHash/eth_getUncleCountByBlockHash.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { ThorId } from '@vechain/sdk-core'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_getUncleCountByBlockHash implementation - * - * @param params - The standard array of rpc call parameters. - * * params[0]: The block hash to get as a hex string. - */ -const ethGetUncleCountByBlockHash = async ( - params: unknown[] -): Promise => { - // Input validation - if ( - params.length !== 1 || - typeof params[0] !== 'string' || - !ThorId.isValid(params[0]) - ) - throw new JSONRPCInvalidParams( - 'eth_getUncleCountByBlockHash', - `Invalid input params for "eth_getUncleCountByBlockHash" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - return await Promise.resolve(0); -}; - -export { ethGetUncleCountByBlockHash }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockHash/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockHash/index.ts deleted file mode 100644 index b27ad3e8d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockHash/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getUncleCountByBlockHash'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockNumber/eth_getUncleCountByBlockNumber.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockNumber/eth_getUncleCountByBlockNumber.ts deleted file mode 100644 index 684c1330f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockNumber/eth_getUncleCountByBlockNumber.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_getUncleCountByBlockNumber implementation - * - * @param params - The standard array of rpc call parameters. - * * params[0]: The block number to get as a hex string or "latest" or "finalized". - */ -const ethGetUncleCountByBlockNumber = async ( - params: unknown[] -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'string') - throw new JSONRPCInvalidParams( - 'eth_getUncleCountByBlockNumber', - `Invalid input params for "eth_getUncleCountByBlockNumber" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - return await Promise.resolve(0); -}; - -export { ethGetUncleCountByBlockNumber }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockNumber/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockNumber/index.ts deleted file mode 100644 index 2a7dec673..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getUncleCountByBlockNumber/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getUncleCountByBlockNumber'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getWork/eth_getWork.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getWork/eth_getWork.ts deleted file mode 100644 index 267022e44..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getWork/eth_getWork.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_getWork implementation - * - * @link [eth_getWork](https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_getwork) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethGetWork = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_getWork', - messages: ['Method "eth_getWork" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethGetWork }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getWork/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_getWork/index.ts deleted file mode 100644 index 27a4637ec..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_getWork/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_getWork'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_hashrate/eth_hashrate.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_hashrate/eth_hashrate.ts deleted file mode 100644 index 070aa9b6b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_hashrate/eth_hashrate.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_hashrate implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethHashrate = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_hashrate', - messages: ['Method "eth_hashrate" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethHashrate }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_hashrate/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_hashrate/index.ts deleted file mode 100644 index 329cd8a43..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_hashrate/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_hashrate'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_maxPriorityFeePerGas/eth_maxPriorityFeePerGas.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_maxPriorityFeePerGas/eth_maxPriorityFeePerGas.ts deleted file mode 100644 index f55dddc1f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_maxPriorityFeePerGas/eth_maxPriorityFeePerGas.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_maxPriorityFeePerGas implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethMaxPriorityFeePerGas = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_maxPriorityFeePerGas', - messages: [ - 'Method "eth_maxPriorityFeePerGas" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethMaxPriorityFeePerGas }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_maxPriorityFeePerGas/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_maxPriorityFeePerGas/index.ts deleted file mode 100644 index 59964a7b0..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_maxPriorityFeePerGas/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_maxPriorityFeePerGas'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_mining/eth_mining.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_mining/eth_mining.ts deleted file mode 100644 index 17e2ab49b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_mining/eth_mining.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_mining implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethMining = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_mining', - messages: ['Method "eth_mining" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethMining }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_mining/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_mining/index.ts deleted file mode 100644 index 564ca9774..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_mining/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_mining'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newBlockFilter/eth_newBlockFilter.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_newBlockFilter/eth_newBlockFilter.ts deleted file mode 100644 index 417ddd96f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newBlockFilter/eth_newBlockFilter.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_newBlockFilter implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethNewBlockFilter = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_newBlockFilter', - messages: ['Method "eth_newBlockFilter" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethNewBlockFilter }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newBlockFilter/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_newBlockFilter/index.ts deleted file mode 100644 index 505c66ea4..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newBlockFilter/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_newBlockFilter'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newFilter/eth_newFilter.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_newFilter/eth_newFilter.ts deleted file mode 100644 index d9e5af446..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newFilter/eth_newFilter.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_newFilter implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethNewFilter = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_newFilter', - messages: ['Method "eth_newFilter" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethNewFilter }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newFilter/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_newFilter/index.ts deleted file mode 100644 index b9995541e..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newFilter/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_newFilter'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newPendingTransactionFilter/eth_newPendingTransactionFilter.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_newPendingTransactionFilter/eth_newPendingTransactionFilter.ts deleted file mode 100644 index 7ddfd097b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newPendingTransactionFilter/eth_newPendingTransactionFilter.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_newPendingTransactionFilter implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethNewPendingTransactionFilter = - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_newPendingTransactionFilter', - messages: [ - 'Method "eth_newPendingTransactionFilter" has not been implemented yet.' - ] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); - }; - -export { ethNewPendingTransactionFilter }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newPendingTransactionFilter/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_newPendingTransactionFilter/index.ts deleted file mode 100644 index 6e83f4eeb..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_newPendingTransactionFilter/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_newPendingTransactionFilter'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_protocolVersion/eth_protocolVersion.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_protocolVersion/eth_protocolVersion.ts deleted file mode 100644 index d9d2ad53b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_protocolVersion/eth_protocolVersion.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_protocolVersion implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethProtocolVersion = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_protocolVersion', - messages: ['Method "eth_protocolVersion" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethProtocolVersion }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_protocolVersion/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_protocolVersion/index.ts deleted file mode 100644 index ce73cde6a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_protocolVersion/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_protocolVersion'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_requestAccounts/eth_requestAccounts.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_requestAccounts/eth_requestAccounts.ts deleted file mode 100644 index 18dd741b5..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_requestAccounts/eth_requestAccounts.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { JSONRPCInvalidParams, stringifyData } from '@vechain/sdk-errors'; -import { type VeChainProvider } from '../../../../providers/vechain-provider'; -import { ethAccounts } from '../eth_accounts/eth_accounts'; - -/** - * RPC Method eth_requestAccounts implementation - * - * @param provider - Provider with ProviderInternalWallet instance to use. - * @throws {JSONRPCInvalidParams} - */ -const ethRequestAccounts = async ( - provider?: VeChainProvider -): Promise => { - // Get the accounts from the wallet - const accounts = await ethAccounts(provider); - - // If there are no accounts, throw error - // @NOTE: eth_accounts returns an empty array if there are no accounts OR wallet is not defined. - // Here, instead, if there are no accounts into wallet OR wallet is not defined, we throw an error - if (accounts.length === 0) - throw new JSONRPCInvalidParams( - 'eth_requestAccounts()', - 'Method "eth_requestAccounts" failed.', - { - provider: stringifyData(provider) - } - ); - - // Otherwise, return the accounts - return accounts; -}; - -export { ethRequestAccounts }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_requestAccounts/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_requestAccounts/index.ts deleted file mode 100644 index e783074e7..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_requestAccounts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_requestAccounts'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.ts deleted file mode 100644 index e32eeba3d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { Hex } from '@vechain/sdk-core'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_sendRawTransaction implementation - * - * @link [eth_sendrawtransaction](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The signed transaction data as a hex string. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethSendRawTransaction = async ( - thorClient: ThorClient, - params: unknown[] -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'string') - throw new JSONRPCInvalidParams( - 'eth_sendRawTransaction()', - `Invalid input params for "eth_sendRawTransaction" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - // Invalid transaction encoded data - if (!Hex.isValid0x(params[0])) { - throw new JSONRPCInvalidParams( - 'eth_sendRawTransaction()', - 'Invalid transaction encoded data given as input. Input must be a hex string.', - { params } - ); - } - - try { - const [signedTransactionData] = params as [string]; - - const sentTransaction = - await thorClient.transactions.sendRawTransaction( - signedTransactionData - ); - - return sentTransaction.id; - } catch (error) { - throw new JSONRPCInternalError( - 'eth_sendRawTransaction()', - 'Method "eth_sendRawTransaction" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL - }, - error - ); - } -}; - -export { ethSendRawTransaction }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendRawTransaction/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendRawTransaction/index.ts deleted file mode 100644 index 6c940d5ab..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendRawTransaction/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_sendRawTransaction'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/eth_sendTransaction.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/eth_sendTransaction.ts deleted file mode 100644 index b5308831a..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/eth_sendTransaction.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { type VeChainProvider } from '../../../../providers/vechain-provider'; -import { type TransactionObjectInput } from './types'; -import { type VeChainSigner } from '../../../../../signer'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; - -/** - * RPC Method eth_sendTransaction implementation - * - * @link [eth_sendTransaction](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @NOTE: If 'to' address is not provided. - * It will be assumed that the transaction is a contract creation transaction. - * The 'data' field of the transaction will be used as the contract initialization code. - * - * @NOTE: 'gasPrice' cannot be used together with 'maxPriorityFeePerGas' and 'maxFeePerGas'. - * 'maxPriorityFeePerGas' and 'maxFeePerGas' are not supported in the current version. - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: transaction - object - This describes the transaction info with following properties: - * * to: 20 bytes - Address the transaction is directed to. - * * from: 20 bytes [Required] - Address the transaction is sent from. - * * gas: Hexadecimal value of the gas provided for the transaction execution as hex string. - * * gasPrice: Hexadecimal value of the gasPrice used for each paid gas. - * * value: Hexadecimal of the value sent with this transaction. - * * data: Hash of the method signature and encoded parameters. - * * maxPriorityFeePerGas: Maximum fee per gas the sender is willing to pay to miners in wei. Used in 1559 transactions. - * * maxFeePerGas: The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei. Used in 1559 transactions. - * @param provider - The provider instance to use. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethSendTransaction = async ( - thorClient: ThorClient, - params: unknown[], - provider?: VeChainProvider -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'object') - throw new JSONRPCInvalidParams( - 'eth_sendTransaction', - `Invalid input params for "eth_sendTransaction" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - // Provider must be defined - if (provider?.wallet === undefined) { - throw new JSONRPCInvalidParams( - 'eth_sendTransaction', - 'Provider must be defined with a wallet. Ensure that the provider is defined and connected to the network.', - { provider } - ); - } - - // From field is required - if ((params[0] as TransactionObjectInput).from === undefined) { - throw new JSONRPCInvalidParams( - 'eth_sendTransaction', - 'From field is required in the transaction object.', - { provider } - ); - } - - // Input params - const [transaction] = params as [TransactionObjectInput]; - - try { - // Get the signer of the provider - const signer = (await provider.getSigner( - transaction.from - )) as VeChainSigner; - - // Return the result - return await signer.sendTransaction(transaction); - } catch (error) { - throw new JSONRPCInternalError( - 'eth_sendTransaction()', - 'Method "eth_sendTransaction" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL - }, - error - ); - } -}; - -export { ethSendTransaction }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/index.ts deleted file mode 100644 index 6d12a1e72..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './eth_sendTransaction'; -export type * from './types.d'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/types.d.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/types.d.ts deleted file mode 100644 index 03a6e17d1..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sendTransaction/types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { type BaseTransactionObjectInput } from '../types'; - -/** - * Transaction object input type - */ -interface TransactionObjectInput extends BaseTransactionObjectInput { - from: string; - to?: string; -} - -export type { TransactionObjectInput }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sign/eth_sign.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_sign/eth_sign.ts deleted file mode 100644 index 1bef0c2b5..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sign/eth_sign.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_sign implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethSign = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_sign', - messages: ['Method "eth_sign" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethSign }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sign/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_sign/index.ts deleted file mode 100644 index b6074747c..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_sign/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_sign'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTransaction/eth_signTransaction.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTransaction/eth_signTransaction.ts deleted file mode 100644 index 1ebfd9285..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTransaction/eth_signTransaction.ts +++ /dev/null @@ -1,85 +0,0 @@ -import type { ThorClient } from '../../../../../thor-client'; -import type { VeChainProvider } from '../../../../providers/vechain-provider'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import { RPC_DOCUMENTATION_URL } from '../../../../../utils'; -import type { TransactionObjectInput } from '../eth_sendTransaction'; -import type { VeChainSigner } from '../../../../../signer'; - -/** - * RPC Method eth_signTransaction implementation - * - * @link [eth_signTransaction](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: transaction - object - This describes the transaction info with following properties: - * * to: 20 bytes - Address the transaction is directed to. - * * from: 20 bytes [Required] - Address the transaction is sent from. - * * gas: Hexadecimal value of the gas provided for the transaction execution as hex string. - * * gasPrice: Hexadecimal value of the gasPrice used for each paid gas. - * * value: Hexadecimal of the value sent with this transaction. - * * data: Hash of the method signature and encoded parameters. - * * nonce: The nonce of the transaction. - * @param provider - The provider instance to use. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethSignTransaction = async ( - thorClient: ThorClient, - params: unknown[], - provider?: VeChainProvider -): Promise => { - // Input validation - if (params.length !== 1 || typeof params[0] !== 'object') - throw new JSONRPCInvalidParams( - 'eth_signTransaction', - `Invalid input params for "eth_signTransaction" method. See ${RPC_DOCUMENTATION_URL} for details.`, - { params } - ); - - // Provider must be defined - if (provider?.wallet === undefined) { - throw new JSONRPCInvalidParams( - 'eth_signTransaction', - 'Provider must be defined with a wallet. Ensure that the provider is defined and connected to the network.', - { provider } - ); - } - - // From field is required - if ((params[0] as TransactionObjectInput).from === undefined) { - throw new JSONRPCInvalidParams( - 'eth_signTransaction', - 'From field is required in the transaction object.', - { provider } - ); - } - - // Input params - const [transaction] = params as [TransactionObjectInput]; - - try { - // Get the signer of the provider - const signer = (await provider.getSigner( - transaction.from - )) as VeChainSigner; - - // Return the result - return await signer.signTransaction(transaction); - } catch (error) { - throw new JSONRPCInternalError( - 'eth_signTransaction()', - 'Method "eth_signTransaction" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL - }, - error - ); - } -}; - -export { ethSignTransaction }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTransaction/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTransaction/index.ts deleted file mode 100644 index 3b38a7b3d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTransaction/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_signTransaction'; 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 deleted file mode 100644 index 9ae31685b..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { Address } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - stringifyData -} from '@vechain/sdk-errors'; -import type { - TypedDataDomain, - TypedDataParameter, - VeChainSigner -} from '../../../../../signer/signers'; -import type { ThorClient } from '../../../../../thor-client'; -import type { VeChainProvider } from '../../../../providers/vechain-provider'; - -/** - * RPC Method eth_signTypedDataV4 implementation - * - * @link [eth_signTypedDataV4](https://docs.metamask.io/wallet/reference/eth_signtypeddata_v4/) - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * * params[0]: The hex encoded address of the account to sign the typed message. - * * params[1] An object containing: - * * types - An array of EIP712Domain object. It is an array specifying one or more (name, version, chainId, verifyingContract) tuples. - * * domain - Contains the domain separator values specified in the EIP712Domain type. - * * primaryType: A string specifying the name of the primary type for the message. - * * message: An object containing the data to sign. - * @param provider - The provider instance to use. - * @throws {JSONRPCInvalidParams, JSONRPCInternalError} - */ -const ethSignTypedDataV4 = async ( - thorClient: ThorClient, - params: unknown[], - provider?: VeChainProvider -): Promise => { - // Input validation - if ( - params.length !== 2 || - typeof params[0] !== 'string' || - !Address.isValid(params[0]) || - typeof params[1] !== 'object' - ) - throw new JSONRPCInvalidParams( - 'eth_signTypedDataV4', - `Invalid input params for "eth_signTypedDataV4" method. See https://docs.metamask.io/wallet/reference/eth_signtypeddata_v4/ for details.`, - { params } - ); - - // Provider must be defined - if ( - provider?.wallet === undefined || - (await provider.getSigner(params[0])) === null - ) { - throw new JSONRPCInvalidParams( - 'eth_signTypedDataV4', - `Provider must be defined with a wallet. Ensure that the provider is defined, connected to the network and has the wallet with the address ${params[0]} into it.`, - { provider } - ); - } - - // Input params - const [address, typedData] = params as [ - string, - { - primaryType: string; - domain: TypedDataDomain; - types: Record; - message: Record; - } - ]; - - try { - // Get the signer of the provider - const signer = (await provider.getSigner(address)) as VeChainSigner; - - // Return the result - return await signer.signTypedData( - typedData.domain, - typedData.types, - typedData.message, - typedData.primaryType - ); - } catch (error) { - throw new JSONRPCInternalError( - 'eth_signTypedDataV4', - 'Method "eth_signTypedDataV4" failed.', - { - params: stringifyData(params), - url: thorClient.httpClient.baseURL - }, - error - ); - } -}; - -export { ethSignTypedDataV4 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/index.ts deleted file mode 100644 index d0fdba0f5..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_signTypedData_v4/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_signTypedData_v4'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_submitWork/eth_submitWork.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_submitWork/eth_submitWork.ts deleted file mode 100644 index a1d898ddf..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_submitWork/eth_submitWork.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_submitWork implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethSubmitWork = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_submitWork', - messages: ['Method "eth_submitWork" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethSubmitWork }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_submitWork/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_submitWork/index.ts deleted file mode 100644 index fd853e9fc..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_submitWork/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_submitWork'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_subscribe/eth_subscribe.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_subscribe/eth_subscribe.ts deleted file mode 100644 index 90fba018e..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_subscribe/eth_subscribe.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { Hex } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - JSONRPCServerError, - stringifyData -} from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; -import { - type FilterOptions, - type VeChainProvider -} from '../../../../providers/vechain-provider'; - -/** - * Enumerates the types of subscriptions supported by the`eth_subscribe` RPC method. - */ -enum SUBSCRIPTION_TYPE { - /** - * Subscription type for receiving notifications about new blocks added to the blockchain. - */ - NEW_HEADS = 'newHeads', - - /** - * Subscription type for receiving log entries that match specific filter criteria, - * allowing clients to listen for specific events emitted by smart contracts. - */ - LOGS = 'logs' -} - -/** - * Defines the parameter types accepted by the `eth_subscribe` RPC method. - */ -type ethSubscribeParams = [SUBSCRIPTION_TYPE, string | string[]] | unknown[]; - -/** - * Initiates a subscription to the blockchain events based on the specified parameters. - * This function supports subscriptions to new block headers ('newHeads') and log entries ('logs') - * that match given filter criteria. It ensures that the provided parameters are valid and that - * the provider is available before setting up the subscription and generating a unique subscription ID. - * - * @link [eth_subscribe](https://docs.infura.io/api/networks/ethereum/json-rpc-methods/subscription-methods/eth_subscribe) - * - * @param thorClient - An instance of `ThorClient` used to interact with the blockchain, such as - * retrieving the current best block when setting up a new subscription. - * @param params - Parameters for the subscription, conforming to `ethSubscribeParams`. The first - * element of the array specifies the type of subscription, and the second element - * (if present) provides additional options, such as filter criteria for log subscriptions. - * @param provider - An optional `VeChainProvider` instance that contains the subscription manager. - * The subscription manager is used to store and manage active subscriptions. - * If the provider is not provided or is undefined, the function throws an error. - * - * @returns A `Promise` that resolves to a string representing the unique ID of the created subscription. - * @throws {JSONRPCInternalError, JSONRPCInvalidParams, JSONRPCServerError} - */ -const ethSubscribe = async ( - thorClient: ThorClient, - params: ethSubscribeParams, - provider?: VeChainProvider -): Promise => { - if (provider === undefined) { - throw new JSONRPCInternalError( - 'eth_subscribe()', - 'Method "eth_subscribe" failed. Provider is not defined.', - { - url: thorClient.httpClient.baseURL, - params: stringifyData(params) - } - ); - } - if ( - params[0] !== SUBSCRIPTION_TYPE.NEW_HEADS && - params[0] !== SUBSCRIPTION_TYPE.LOGS - ) { - throw new JSONRPCInvalidParams( - 'eth_subscribe()', - 'Method "eth_subscribe" failed. Invalid subscription type param.', - { - url: thorClient.httpClient.baseURL, - params: stringifyData(params) - } - ); - } - - // I check if a poll instance is already active, if not I set a new starting block number for the subscription - if (provider.getPollInstance() === undefined) { - const block = await thorClient.blocks.getBestBlockCompressed(); - - if (block !== undefined && block !== null) { - provider.subscriptionManager.currentBlockNumber = block.number; - } else - throw new JSONRPCServerError( - 'eth_subscribe()', - 'Method "eth_subscribe" failed. Best block not available.', - { - url: thorClient.httpClient.baseURL, - params: stringifyData(params) - } - ); - - provider.startSubscriptionsPolling(); - } - const subscriptionId: string = Hex.random(16).digits; - - if (params.includes(SUBSCRIPTION_TYPE.NEW_HEADS)) { - provider.subscriptionManager.newHeadsSubscription = { - subscriptionId, - subscription: { - type: SUBSCRIPTION_TYPE.NEW_HEADS - } - }; - } - - if (params.includes(SUBSCRIPTION_TYPE.LOGS)) { - provider.subscriptionManager.logSubscriptions.set(subscriptionId, { - type: SUBSCRIPTION_TYPE.LOGS, - options: params[1] as FilterOptions - }); - } - return subscriptionId; -}; - -export { ethSubscribe }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_subscribe/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_subscribe/index.ts deleted file mode 100644 index cbd95a782..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_subscribe/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_subscribe'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_syncing/eth_syncing.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_syncing/eth_syncing.ts deleted file mode 100644 index 8be7aaeed..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_syncing/eth_syncing.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { HexInt } from '@vechain/sdk-core'; -import { JSONRPCInternalError, stringifyData } from '@vechain/sdk-errors'; -import { - type CompressedBlockDetail, - type ThorClient -} from '../../../../../thor-client'; -import { blocksFormatter, type SyncBlockRPC } from '../../../formatter'; -import { ethChainId } from '../eth_chainId'; - -/** - * Check if the block is out of sync in time. - * A block is considered out of sync if the difference between the current time and the block timestamp is GREATER than 11 seconds. - * - * @param block - Block to check - */ -const _isBlockNotOutOfSyncInTime = (block: CompressedBlockDetail): boolean => { - return Math.floor(Date.now() / 1000) - block.timestamp < 11000; -}; - -/** - * RPC Method eth_syncing implementation - * - * @link [eth_syncing](https://ethereum.github.io/execution-apis/api-documentation/) - * - * @param thorClient - The thor client instance to use. - * - * @note The startingBlock parameter is not supported. - * - * @returns Returns an object with the sync status of the node if the node is out-of-sync and is syncing. Returns false when the node is already in sync. - */ -const ethSyncing = async ( - thorClient: ThorClient -): Promise => { - try { - // Get the best block and the genesis block - const bestBlock = await thorClient.blocks.getBestBlockCompressed(); - const genesisBlock = await thorClient.blocks.getGenesisBlock(); - - // Get the highest block number - const highestBlockNumber: string | null = - genesisBlock !== null - ? HexInt.of( - Math.floor((Date.now() - genesisBlock.timestamp) / 10000) - ).toString() - : null; - - // Check the latest block - if (bestBlock !== null) { - // Check if the node is out of sync - if (_isBlockNotOutOfSyncInTime(bestBlock)) return false; - - // Calculate the chainId - const chainId = await ethChainId(thorClient); - - return { - currentBlock: blocksFormatter.formatToRPCStandard( - bestBlock, - chainId - ), - highestBlock: highestBlockNumber, - - // Not supported field - startingBlock: null - }; - } - - // Strange cases when the fetched best block is null - return { - currentBlock: null, - highestBlock: highestBlockNumber, - - // Not supported field - startingBlock: null - }; - } catch (e) { - throw new JSONRPCInternalError( - 'eth_syncing()', - 'Method "eth_syncing" failed.', - { - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { ethSyncing }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_syncing/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_syncing/index.ts deleted file mode 100644 index 268ae3077..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_syncing/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_syncing'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_uninstallFilter/eth_uninstallFilter.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_uninstallFilter/eth_uninstallFilter.ts deleted file mode 100644 index 8e09092b1..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_uninstallFilter/eth_uninstallFilter.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method eth_uninstallFilter implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const ethUninstallFilter = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'eth_uninstallFilter', - messages: ['Method "eth_uninstallFilter" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { ethUninstallFilter }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_uninstallFilter/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_uninstallFilter/index.ts deleted file mode 100644 index ad5ec55e6..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_uninstallFilter/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_uninstallFilter'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_unsubscribe/eth_unsubscribe.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_unsubscribe/eth_unsubscribe.ts deleted file mode 100644 index 046a85efb..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_unsubscribe/eth_unsubscribe.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { JSONRPCInternalError, stringifyData } from '@vechain/sdk-errors'; -import type { VeChainProvider } from '../../../../providers/vechain-provider'; - -/** - * Asynchronously unsubscribes from a VeChain event subscription. - * This function attempts to unsubscribe from either 'newHeads' or log subscriptions - * based on the provided `subscriptionId`. If the provider is not available or the - * `subscriptionId` does not match any active subscriptions, it may throw an error - * or return `false`, respectively. - * - * @link [eth_unsubscribe](https://docs.infura.io/api/networks/ethereum/json-rpc-methods/subscription-methods/eth_unsubscribe) - * - * @param params - An array containing the subscription ID as its first element. - * The subscription ID is used to identify and unsubscribe from the corresponding - * Ethereum event subscription. - * @param provider - An optional `VeChainProvider` instance that contains the - * subscription manager. This manager holds the active subscriptions and is used - * to unsubscribe from them. If the provider is not provided or is undefined, - * the function throws an error indicating that the provider is not available. - * @returns A `Promise` that resolves to `true` if the unsubscription was successful, - * or `false` if the specified subscription ID does not match any active subscriptions. - * @throws {JSONRPCInternalError} - */ -const ethUnsubscribe = async ( - params: unknown[], - provider?: VeChainProvider -): Promise => { - let result: boolean = false; - - if (provider === undefined) { - throw new JSONRPCInternalError( - 'eth_unsubscribe()', - 'Method "eth_unsubscribe" failed. Provider is not defined.', - { - params: stringifyData(params) - } - ); - } - - const subscriptionId = params[0] as string; - - // Unsubscribe from 'newHeads' events if the subscription ID matches the newHeads subscription - if ( - provider.subscriptionManager.newHeadsSubscription !== undefined && - subscriptionId === - provider.subscriptionManager.newHeadsSubscription.subscriptionId - ) { - provider.subscriptionManager.newHeadsSubscription = undefined; - result = true; - } - // Unsubscribe from log events if the subscription ID matches a log subscription - else { - result = - provider.subscriptionManager.logSubscriptions.delete( - subscriptionId - ); - } - - if (!provider.isThereActiveSubscriptions()) { - provider.stopSubscriptionsPolling(); - } - - return await Promise.resolve(result); -}; - -export { ethUnsubscribe }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/eth_unsubscribe/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/eth_unsubscribe/index.ts deleted file mode 100644 index 2b00b7219..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/eth_unsubscribe/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './eth_unsubscribe'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/evm_mine/evm_mine.ts b/packages/network/src/provider/utils/rpc-mapper/methods/evm_mine/evm_mine.ts deleted file mode 100644 index 5afd75ca2..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/evm_mine/evm_mine.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { JSONRPCInternalError, stringifyData } from '@vechain/sdk-errors'; -import { type ThorClient } from '../../../../../thor-client'; -import { blocksFormatter, type BlocksRPC } from '../../../formatter'; -import { ethChainId } from '../eth_chainId'; - -/** - * RPC Method evm_mine implementation - * - * @link [evm_mine](https://hardhat.org/hardhat-network/docs/explanation/mining-modes) - * - * @param thorClient - The thor client instance to use. - * @returns The new block or null if the block is not available. - * @throws {JSONRPCInternalError} - */ -const evmMine = async (thorClient: ThorClient): Promise => { - try { - // Get best block - const bestBlock = await thorClient.blocks.getBestBlockExpanded(); - const newBlock = - bestBlock !== null - ? await thorClient.blocks.waitForBlockCompressed( - bestBlock.number + 1 - ) - : null; - - const chainId = await ethChainId(thorClient); - - return newBlock !== null - ? blocksFormatter.formatToRPCStandard(newBlock, chainId) - : null; - } catch (e) { - throw new JSONRPCInternalError( - 'evm_mine()', - 'Method "evm_mine" failed.', - { - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { evmMine }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/evm_mine/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/evm_mine/index.ts deleted file mode 100644 index d45aba2c2..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/evm_mine/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './evm_mine'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/index.ts deleted file mode 100644 index 10c8bca1d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/index.ts +++ /dev/null @@ -1,82 +0,0 @@ -export * from './debug_getBadBlocks'; -export * from './debug_getRawBlock'; -export * from './debug_getRawHeader'; -export * from './debug_getRawReceipts'; -export * from './debug_getRawTransaction'; -export * from './debug_traceBlockByHash'; -export * from './debug_traceBlockByNumber'; -export * from './debug_traceCall'; -export * from './debug_traceTransaction'; -export * from './engine_exchangeCapabilities'; -export * from './engine_exchangeTransitionConfigurationV1'; -export * from './engine_forkchoiceUpdatedV1'; -export * from './engine_forkchoiceUpdatedV2'; -export * from './engine_forkchoiceUpdatedV3'; -export * from './engine_getPayloadBodiesByHashV1'; -export * from './engine_getPayloadBodiesByRangeV1'; -export * from './engine_getPayloadV1'; -export * from './engine_getPayloadV2'; -export * from './engine_getPayloadV3'; -export * from './engine_newPayloadV1'; -export * from './engine_newPayloadV2'; -export * from './engine_newPayloadV3'; -export * from './eth_accounts'; -export * from './eth_blockNumber'; -export * from './eth_call'; -export * from './eth_chainId'; -export * from './eth_coinbase'; -export * from './eth_createAccessList'; -export * from './eth_estimateGas'; -export * from './eth_feeHistory'; -export * from './eth_gasPrice'; -export * from './eth_getBalance'; -export * from './eth_getBlockByHash'; -export * from './eth_getBlockByNumber'; -export * from './eth_getBlockReceipts'; -export * from './eth_getBlockTransactionCountByHash'; -export * from './eth_getBlockTransactionCountByNumber'; -export * from './eth_getCode'; -export * from './eth_getFilterChanges'; -export * from './eth_getFilterLogs'; -export * from './eth_getLogs'; -export * from './eth_getProof'; -export * from './eth_getStorageAt'; -export * from './eth_getTransactionByBlockHashAndIndex'; -export * from './eth_getTransactionByBlockNumberAndIndex'; -export * from './eth_getTransactionByHash'; -export * from './eth_getTransactionCount'; -export * from './eth_getTransactionReceipt'; -export * from './eth_getUncleByBlockHashAndIndex'; -export * from './eth_getUncleByBlockNumberAndIndex'; -export * from './eth_getUncleCountByBlockHash'; -export * from './eth_getUncleCountByBlockNumber'; -export * from './eth_getWork'; -export * from './eth_hashrate'; -export * from './eth_maxPriorityFeePerGas'; -export * from './eth_mining'; -export * from './eth_newBlockFilter'; -export * from './eth_newFilter'; -export * from './eth_newPendingTransactionFilter'; -export * from './eth_protocolVersion'; -export * from './eth_requestAccounts'; -export * from './eth_sendRawTransaction'; -export * from './eth_sendTransaction'; -export * from './eth_sign'; -export * from './eth_signTransaction'; -export * from './eth_signTypedData_v4'; -export * from './eth_submitWork'; -export * from './eth_subscribe'; -export * from './eth_syncing'; -export * from './eth_uninstallFilter'; -export * from './eth_unsubscribe'; -export * from './evm_mine'; -export * from './net_listening'; -export * from './net_peerCount'; -export * from './net_version'; -export * from './parity_nextNonce'; -export * from './txpool_content'; -export * from './txpool_contentFrom'; -export * from './txpool_inspect'; -export * from './txpool_status'; -export * from './web3_clientVersion'; -export * from './web3_sha3'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/net_listening/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/net_listening/index.ts deleted file mode 100644 index 935283e16..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/net_listening/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './net_listening'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/net_listening/net_listening.ts b/packages/network/src/provider/utils/rpc-mapper/methods/net_listening/net_listening.ts deleted file mode 100644 index af3980e41..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/net_listening/net_listening.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { JSONRPCInternalError, stringifyData } from '@vechain/sdk-errors'; -import type { ThorClient } from '../../../../../thor-client'; - -/** - * RPC Method net_listening implementation - * - * @link [net_listening](https://docs.infura.io/api/networks/ethereum/json-rpc-methods/net_listening) - * - * @param thorClient - The thor client instance to use. - */ -const netListening = async (thorClient: ThorClient): Promise => { - try { - return await thorClient.nodes.isHealthy(); - } catch (e) { - throw new JSONRPCInternalError( - 'net_listening()', - 'Method "net_listening" failed.', - { - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { netListening }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/net_peerCount/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/net_peerCount/index.ts deleted file mode 100644 index 74bed4b6f..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/net_peerCount/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './net_peerCount'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/net_peerCount/net_peerCount.ts b/packages/network/src/provider/utils/rpc-mapper/methods/net_peerCount/net_peerCount.ts deleted file mode 100644 index c941d621e..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/net_peerCount/net_peerCount.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; -import { JSONRPCInternalError, stringifyData } from '@vechain/sdk-errors'; - -/** - * RPC Method net_peerCount implementation - * - * @link [net_peerCount](https://docs.infura.io/api/networks/ethereum/json-rpc-methods/net_peercount) - * - * @param thorClient - The thor client instance to use. - */ -const netPeerCount = async (thorClient: ThorClient): Promise => { - try { - const peers = await thorClient.nodes.getNodes(); - return peers.length; - } catch (e) { - throw new JSONRPCInternalError( - 'net_peerCount()', - 'Method "net_peerCount" failed.', - { - url: thorClient.httpClient.baseURL, - innerError: stringifyData(e) - } - ); - } -}; - -export { netPeerCount }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/net_version/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/net_version/index.ts deleted file mode 100644 index 202050fc8..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/net_version/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './net_version'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/net_version/net_version.ts b/packages/network/src/provider/utils/rpc-mapper/methods/net_version/net_version.ts deleted file mode 100644 index e8bc63ef4..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/net_version/net_version.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { type ThorClient } from '../../../../../thor-client'; -import { ethChainId } from '../eth_chainId'; - -/** - * RPC Method net_version implementation - * - * @link [net_version](https://docs.infura.io/networks/ethereum/json-rpc-methods/net_version) - * - * @param thorClient - ThorClient instance. - * - * @returns The net version (equivalent to chain id in our case). - */ -const netVersion = async (thorClient: ThorClient): Promise => { - return await ethChainId(thorClient); -}; - -export { netVersion }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/parity_nextNonce/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/parity_nextNonce/index.ts deleted file mode 100644 index e644492f4..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/parity_nextNonce/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './parity_nextNonce'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/parity_nextNonce/parity_nextNonce.ts b/packages/network/src/provider/utils/rpc-mapper/methods/parity_nextNonce/parity_nextNonce.ts deleted file mode 100644 index 8dfcf48bb..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/parity_nextNonce/parity_nextNonce.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Method parity_nextNonce implementation - * - * @param thorClient - The thor client instance to use. - * @param params - The standard array of rpc call parameters. - * @note: - * * params[0]: ... - * * params[1]: ... - * * params[n]: ... - */ -const parityNextNonce = async (): Promise<'METHOD NOT IMPLEMENTED'> => { - // Not implemented yet - VeChainSDKLogger('warning').log({ - title: 'parity_nextNonce', - messages: ['Method "parity_nextNonce" has not been implemented yet.'] - }); - - // To avoid eslint error - return await Promise.resolve('METHOD NOT IMPLEMENTED'); -}; - -export { parityNextNonce }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_content/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/txpool_content/index.ts deleted file mode 100644 index e2e92f294..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_content/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './txpool_content'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_content/txpool_content.ts b/packages/network/src/provider/utils/rpc-mapper/methods/txpool_content/txpool_content.ts deleted file mode 100644 index ead95f21d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_content/txpool_content.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * RPC Method txpool_content implementation - * - * @link [txpool_content](https://www.quicknode.com/docs/ethereum/txpool_content) - * - * @note - * * We return a constant empty object for now. - * - * @returns The transaction pool status - */ -const txPoolContent = async (): Promise => { - return await Promise.resolve({}); -}; - -export { txPoolContent }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_contentFrom/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/txpool_contentFrom/index.ts deleted file mode 100644 index acabcfcc9..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_contentFrom/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './txpool_contentFrom'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_contentFrom/txpool_contentFrom.ts b/packages/network/src/provider/utils/rpc-mapper/methods/txpool_contentFrom/txpool_contentFrom.ts deleted file mode 100644 index 81b9349c3..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_contentFrom/txpool_contentFrom.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { Address } from '@vechain/sdk-core'; - -/** - * RPC Method txpool_contentFrom implementation - * - * @link [txpool_contentFrom](https://www.quicknode.com/docs/ethereum/txpool_contentFrom) - * - * @note - * * We return a constant empty object for now. - * - * @param params - The standard array of rpc call parameters. - * params[0]: The address to get the transaction pool status from - * @returns The transaction pool status - */ -const txPoolContentFrom = async (params: unknown[]): Promise => { - // Validate input - if ( - params.length !== 1 || - typeof params[0] !== 'string' || - !Address.isValid(params[0]) - ) - throw new JSONRPCInvalidParams( - 'txpool_contentFrom()', - `Invalid input params for "txpool_contentFrom" method. See https://www.quicknode.com/docs/ethereum/txpool_contentFrom for details.`, - { params } - ); - return await Promise.resolve({}); -}; - -export { txPoolContentFrom }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_inspect/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/txpool_inspect/index.ts deleted file mode 100644 index 2debc0c54..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_inspect/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './txpool_inspect'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_inspect/txpool_inspect.ts b/packages/network/src/provider/utils/rpc-mapper/methods/txpool_inspect/txpool_inspect.ts deleted file mode 100644 index e4487da5d..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_inspect/txpool_inspect.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * RPC Method txpool_inspect implementation - * - * @link [txpool_inspect](https://www.quicknode.com/docs/ethereum/txpool_inspect) - * - * @note - * * We return a constant empty object for now. - * - * @returns The transaction pool status - */ -const txPoolInspect = async (): Promise => { - return await Promise.resolve({}); -}; - -export { txPoolInspect }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_status/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/txpool_status/index.ts deleted file mode 100644 index e90795ad9..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_status/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './txpool_status'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_status/txpool_status.ts b/packages/network/src/provider/utils/rpc-mapper/methods/txpool_status/txpool_status.ts deleted file mode 100644 index 8d6ecfd78..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/txpool_status/txpool_status.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * RPC Method txpool_status implementation - * - * @link [txpool_status](https://www.quicknode.com/docs/ethereum/txpool_status) - * - * @note - * * We return a constant empty object for now. - * - * @returns The transaction pool status - */ -const txPoolStatus = async (): Promise => { - return await Promise.resolve({}); -}; - -export { txPoolStatus }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/types.d.ts b/packages/network/src/provider/utils/rpc-mapper/methods/types.d.ts deleted file mode 100644 index 91a5d40c4..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Transaction object input type - */ -interface BaseTransactionObjectInput { - gas?: string; - gasPrice?: string; - value?: string; - data?: string; -} - -export type { BaseTransactionObjectInput }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/web3_clientVersion/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/web3_clientVersion/index.ts deleted file mode 100644 index 641ac0f81..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/web3_clientVersion/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './web3_clientVersion'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/web3_clientVersion/web3_clientVersion.ts b/packages/network/src/provider/utils/rpc-mapper/methods/web3_clientVersion/web3_clientVersion.ts deleted file mode 100644 index 84fb79d50..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/web3_clientVersion/web3_clientVersion.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * RPC Method web3_clientVersion implementation - * - * @link [web3_clientVersion](https://docs.infura.io/networks/ethereum/json-rpc-methods/web3_clientversion) - * - * @returns A string representing the current client version. - */ -const web3ClientVersion = async (): Promise => { - return await Promise.resolve('thor'); -}; - -export { web3ClientVersion }; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/web3_sha3/index.ts b/packages/network/src/provider/utils/rpc-mapper/methods/web3_sha3/index.ts deleted file mode 100644 index c56b0d004..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/web3_sha3/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './web3_sha3'; diff --git a/packages/network/src/provider/utils/rpc-mapper/methods/web3_sha3/web3_sha3.ts b/packages/network/src/provider/utils/rpc-mapper/methods/web3_sha3/web3_sha3.ts deleted file mode 100644 index 683d9ada6..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/methods/web3_sha3/web3_sha3.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { Hex, Keccak256 } from '@vechain/sdk-core'; - -/** - * RPC Method web3_sha3 implementation - * - * @link [web3_sha3](https://docs.alchemy.com/reference/web3-sha3) - * @param params - The standard array of rpc call parameters. - * * params[0]: The data to hash. - * @returns A string representing the current client version. - */ -const web3Sha3 = async (params: unknown[]): Promise => { - // Input validation - if ( - params.length !== 1 || - typeof params[0] !== 'string' || - !Hex.isValid(params[0]) - ) - throw new JSONRPCInvalidParams( - 'web3_sha3', - `Invalid input params for "web3_sha3" method. See 'https://docs.alchemy.com/reference/web3-sha3' for details.`, - { params } - ); - - return await Promise.resolve(Keccak256.of(params[0]).toString()); -}; - -export { web3Sha3 }; diff --git a/packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts b/packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts deleted file mode 100644 index 209c0e3b2..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/rpc-mapper.ts +++ /dev/null @@ -1,549 +0,0 @@ -import { type ThorClient } from '../../../thor-client'; -import { type VeChainProvider } from '../../providers/vechain-provider'; -import { RPC_METHODS } from '../const/rpc-mapper/rpc-methods'; -import { - type BlocksRPC, - type LogsRPC, - type SyncBlockRPC, - type TracerReturnTypeRPC, - type TransactionReceiptRPC, - type TransactionRPC -} from '../formatter'; -import { - debugGetBadBlocks, - debugGetRawBlock, - debugGetRawHeader, - debugGetRawReceipts, - debugGetRawTransaction, - debugTraceBlockByHash, - debugTraceBlockByNumber, - debugTraceCall, - debugTraceTransaction, - engineExchangeCapabilities, - engineExchangeTransitionConfigurationV1, - engineForkchoiceUpdatedV1, - engineForkchoiceUpdatedV2, - engineForkchoiceUpdatedV3, - engineGetPayloadBodiesByHashV1, - engineGetPayloadBodiesByRangeV1, - engineGetPayloadV1, - engineGetPayloadV2, - engineGetPayloadV3, - engineNewPayloadV1, - engineNewPayloadV2, - engineNewPayloadV3, - ethAccounts, - ethBlockNumber, - ethCall, - ethChainId, - ethCoinbase, - ethCreateAccessList, - ethEstimateGas, - ethFeeHistory, - ethGasPrice, - ethGetBalance, - ethGetBlockByHash, - ethGetBlockByNumber, - ethGetBlockReceipts, - ethGetBlockTransactionCountByHash, - ethGetBlockTransactionCountByNumber, - ethGetCode, - ethGetFilterChanges, - ethGetFilterLogs, - ethGetLogs, - ethGetProof, - ethGetStorageAt, - ethGetTransactionByBlockHashAndIndex, - ethGetTransactionByBlockNumberAndIndex, - ethGetTransactionByHash, - ethGetTransactionCount, - ethGetTransactionReceipt, - ethGetUncleByBlockHashAndIndex, - ethGetUncleByBlockNumberAndIndex, - ethGetUncleCountByBlockHash, - ethGetUncleCountByBlockNumber, - ethGetWork, - ethHashrate, - ethMaxPriorityFeePerGas, - ethMining, - ethNewBlockFilter, - ethNewFilter, - ethNewPendingTransactionFilter, - ethProtocolVersion, - ethRequestAccounts, - ethSendRawTransaction, - ethSendTransaction, - ethSign, - ethSignTransaction, - ethSignTypedDataV4, - ethSubmitWork, - ethSubscribe, - ethSyncing, - ethUninstallFilter, - ethUnsubscribe, - evmMine, - netListening, - netPeerCount, - netVersion, - parityNextNonce, - txPoolContent, - txPoolContentFrom, - txPoolInspect, - txPoolStatus, - web3ClientVersion, - web3Sha3 -} from './methods'; -import { type MethodHandlerType } from './types'; - -/** - * Map of RPC methods to their implementations with the SDK. - * We can consider this as an "RPC Mapper" for the SDK. - * - * List of all RPC methods: - * * https://eth.wiki/json-rpc/API - * * https://ethereum.github.io/execution-apis/api-documentation/ - * - * @param thorClient - ThorClient instance. - * @param provider - Provider instance. It is optional because the majority of the methods do not require a provider. - */ -const RPCMethodsMap = ( - thorClient: ThorClient, - provider?: VeChainProvider -): Record> => { - /** - * Returns a map of RPC methods to their implementations with our SDK. - */ - return { - [RPC_METHODS.eth_blockNumber]: async (): Promise => { - return await ethBlockNumber(thorClient); - }, - - [RPC_METHODS.eth_chainId]: async (): Promise => { - return await ethChainId(thorClient); - }, - - [RPC_METHODS.eth_getBalance]: async (params): Promise => { - return await ethGetBalance(thorClient, params); - }, - - [RPC_METHODS.eth_getCode]: async (params): Promise => { - return await ethGetCode(thorClient, params); - }, - - [RPC_METHODS.eth_getStorageAt]: async (params): Promise => { - return await ethGetStorageAt(thorClient, params); - }, - - [RPC_METHODS.eth_estimateGas]: async (params): Promise => { - return await ethEstimateGas(thorClient, params); - }, - - [RPC_METHODS.eth_call]: async (params): Promise => { - return await ethCall(thorClient, params); - }, - - [RPC_METHODS.eth_sendRawTransaction]: async ( - params - ): Promise => { - return await ethSendRawTransaction(thorClient, params); - }, - - [RPC_METHODS.eth_getLogs]: async (params): Promise => { - return await ethGetLogs(thorClient, params); - }, - - [RPC_METHODS.eth_getBlockByHash]: async ( - params - ): Promise => { - return await ethGetBlockByHash(thorClient, params); - }, - - [RPC_METHODS.eth_getBlockByNumber]: async ( - params - ): Promise => { - return await ethGetBlockByNumber(thorClient, params); - }, - - [RPC_METHODS.eth_accounts]: async (): Promise => { - return await ethAccounts(provider); - }, - - [RPC_METHODS.eth_gasPrice]: async (): Promise => { - return await ethGasPrice(thorClient); - }, - - [RPC_METHODS.eth_getTransactionByHash]: async ( - params - ): Promise => { - return await ethGetTransactionByHash(thorClient, params); - }, - - [RPC_METHODS.eth_getTransactionCount]: async ( - params - ): Promise => { - return await ethGetTransactionCount(params); - }, - - [RPC_METHODS.eth_getTransactionReceipt]: async ( - params - ): Promise => { - return await ethGetTransactionReceipt(thorClient, params); - }, - - [RPC_METHODS.eth_sendTransaction]: async (params): Promise => { - return await ethSendTransaction(thorClient, params, provider); - }, - - [RPC_METHODS.eth_syncing]: async (): Promise< - boolean | SyncBlockRPC - > => { - return await ethSyncing(thorClient); - }, - - [RPC_METHODS.net_version]: async (): Promise => { - return await netVersion(thorClient); - }, - - [RPC_METHODS.web3_clientVersion]: async (): Promise => { - return await web3ClientVersion(); - }, - - [RPC_METHODS.eth_subscribe]: async (params): Promise => { - return await ethSubscribe(thorClient, params, provider); - }, - - [RPC_METHODS.eth_unsubscribe]: async (params) => { - return await ethUnsubscribe(params, provider); - }, - - [RPC_METHODS.debug_traceTransaction]: async ( - params - ): Promise< - TracerReturnTypeRPC<'call'> | TracerReturnTypeRPC<'prestate'> - > => { - return await debugTraceTransaction(thorClient, params); - }, - - [RPC_METHODS.debug_traceCall]: async ( - params - ): Promise< - TracerReturnTypeRPC<'call'> | TracerReturnTypeRPC<'prestate'> - > => { - return await debugTraceCall(thorClient, params); - }, - - [RPC_METHODS.evm_mine]: async (): Promise => { - return await evmMine(thorClient); - }, - - [RPC_METHODS.eth_coinbase]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethCoinbase(); - }, - - [RPC_METHODS.eth_feeHistory]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethFeeHistory(); - }, - - [RPC_METHODS.eth_getBlockTransactionCountByHash]: async ( - params - ): Promise => { - return await ethGetBlockTransactionCountByHash(thorClient, params); - }, - - [RPC_METHODS.eth_getBlockTransactionCountByNumber]: async ( - params - ): Promise => { - return await ethGetBlockTransactionCountByNumber( - thorClient, - params - ); - }, - - [RPC_METHODS.eth_getTransactionByBlockHashAndIndex]: async ( - params - ): Promise => { - return await ethGetTransactionByBlockHashAndIndex( - thorClient, - params - ); - }, - - [RPC_METHODS.eth_getTransactionByBlockNumberAndIndex]: async ( - params - ): Promise => { - return await ethGetTransactionByBlockNumberAndIndex( - thorClient, - params - ); - }, - - [RPC_METHODS.eth_getUncleByBlockHashAndIndex]: async ( - params - ): Promise => { - return await ethGetUncleByBlockHashAndIndex(params); - }, - - [RPC_METHODS.eth_getUncleByBlockNumberAndIndex]: async ( - params - ): Promise => { - return await ethGetUncleByBlockNumberAndIndex(params); - }, - - [RPC_METHODS.eth_getUncleCountByBlockHash]: async ( - params - ): Promise => { - return await ethGetUncleCountByBlockHash(params); - }, - - [RPC_METHODS.eth_getUncleCountByBlockNumber]: async ( - params - ): Promise => { - return await ethGetUncleCountByBlockNumber(params); - }, - - [RPC_METHODS.eth_getWork]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethGetWork(); - }, - - [RPC_METHODS.eth_mining]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethMining(); - }, - - [RPC_METHODS.eth_hashrate]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethHashrate(); - }, - - [RPC_METHODS.eth_protocolVersion]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethProtocolVersion(); - }, - - [RPC_METHODS.eth_requestAccounts]: async (): Promise => { - return await ethRequestAccounts(provider); - }, - - [RPC_METHODS.eth_sign]: async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethSign(); - }, - - [RPC_METHODS.eth_submitWork]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethSubmitWork(); - }, - - [RPC_METHODS.net_listening]: async (): Promise => { - return await netListening(thorClient); - }, - - [RPC_METHODS.net_peerCount]: async (): Promise => { - return await netPeerCount(thorClient); - }, - - [RPC_METHODS.parity_nextNonce]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await parityNextNonce(); - }, - - [RPC_METHODS.eth_newFilter]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethNewFilter(); - }, - - [RPC_METHODS.eth_newBlockFilter]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethNewBlockFilter(); - }, - - [RPC_METHODS.eth_newPendingTransactionFilter]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethNewPendingTransactionFilter(); - }, - - [RPC_METHODS.eth_getFilterLogs]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethGetFilterLogs(); - }, - - [RPC_METHODS.eth_getFilterChanges]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethGetFilterChanges(); - }, - - [RPC_METHODS.eth_uninstallFilter]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethUninstallFilter(); - }, - - [RPC_METHODS.debug_getBadBlocks]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await debugGetBadBlocks(); - }, - - [RPC_METHODS.debug_getRawBlock]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await debugGetRawBlock(); - }, - - [RPC_METHODS.debug_getRawHeader]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await debugGetRawHeader(); - }, - - [RPC_METHODS.debug_getRawReceipts]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await debugGetRawReceipts(); - }, - - [RPC_METHODS.debug_getRawTransaction]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await debugGetRawTransaction(); - }, - - [RPC_METHODS.engine_exchangeCapabilities]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineExchangeCapabilities(); - }, - - [RPC_METHODS.engine_exchangeTransitionConfigurationV1]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineExchangeTransitionConfigurationV1(); - }, - - [RPC_METHODS.engine_forkchoiceUpdatedV1]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineForkchoiceUpdatedV1(); - }, - - [RPC_METHODS.engine_forkchoiceUpdatedV2]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineForkchoiceUpdatedV2(); - }, - - [RPC_METHODS.engine_forkchoiceUpdatedV3]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineForkchoiceUpdatedV3(); - }, - - [RPC_METHODS.engine_getPayloadBodiesByHashV1]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineGetPayloadBodiesByHashV1(); - }, - - [RPC_METHODS.engine_getPayloadBodiesByRangeV1]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineGetPayloadBodiesByRangeV1(); - }, - - [RPC_METHODS.engine_getPayloadV1]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineGetPayloadV1(); - }, - - [RPC_METHODS.engine_getPayloadV2]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineGetPayloadV2(); - }, - - [RPC_METHODS.engine_getPayloadV3]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineGetPayloadV3(); - }, - - [RPC_METHODS.engine_newPayloadV1]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineNewPayloadV1(); - }, - - [RPC_METHODS.engine_newPayloadV2]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineNewPayloadV2(); - }, - - [RPC_METHODS.engine_newPayloadV3]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await engineNewPayloadV3(); - }, - - [RPC_METHODS.eth_createAccessList]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethCreateAccessList(); - }, - - [RPC_METHODS.eth_getBlockReceipts]: async ( - params - ): Promise => { - return await ethGetBlockReceipts(thorClient, params); - }, - - [RPC_METHODS.eth_getProof]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethGetProof(); - }, - - [RPC_METHODS.eth_maxPriorityFeePerGas]: - async (): Promise<'METHOD NOT IMPLEMENTED'> => { - return await ethMaxPriorityFeePerGas(); - }, - - [RPC_METHODS.eth_signTransaction]: async (params): Promise => { - return await ethSignTransaction(thorClient, params, provider); - }, - - [RPC_METHODS.web3_sha3]: async (params): Promise => { - return await web3Sha3(params); - }, - - [RPC_METHODS.txpool_inspect]: async (): Promise => { - return await txPoolInspect(); - }, - - [RPC_METHODS.txpool_content]: async (): Promise => { - return await txPoolContent(); - }, - - [RPC_METHODS.txpool_contentFrom]: async (params): Promise => { - return await txPoolContentFrom(params); - }, - - [RPC_METHODS.txpool_status]: async (): Promise => { - return await txPoolStatus(); - }, - - [RPC_METHODS.debug_traceBlockByHash]: async ( - params - ): Promise< - Array<{ - txHash: string; - result: - | TracerReturnTypeRPC<'call'> - | TracerReturnTypeRPC<'prestate'>; - }> - > => { - return await debugTraceBlockByHash(thorClient, params); - }, - - [RPC_METHODS.debug_traceBlockByNumber]: async ( - params - ): Promise< - Array<{ - txHash: string; - result: - | TracerReturnTypeRPC<'call'> - | TracerReturnTypeRPC<'prestate'>; - }> - > => { - return await debugTraceBlockByNumber(thorClient, params); - }, - - [RPC_METHODS.eth_signTypedData_v4]: async (params): Promise => { - return await ethSignTypedDataV4(thorClient, params, provider); - } - }; -}; - -export { RPCMethodsMap }; diff --git a/packages/network/src/provider/utils/rpc-mapper/types.d.ts b/packages/network/src/provider/utils/rpc-mapper/types.d.ts deleted file mode 100644 index aa31e1586..000000000 --- a/packages/network/src/provider/utils/rpc-mapper/types.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Type for the method handler. - * It is basically a function that takes an array of parameters and returns a promise. - */ -type MethodHandlerType = ( - params: TParams[] -) => Promise; - -/** - * Block type for RPC methods. - * - * It can be a block hash or a block number or a string ('0x...', 'latest', 'earliest', 'pending'). - */ -type BlockQuantityInputRPC = - | string - | { blockHash: string; blockNumber: never } - | { blockHash: never; blockNumber: number }; - -export { type MethodHandlerType, type BlockQuantityInputRPC }; diff --git a/packages/network/src/signer/index.ts b/packages/network/src/signer/index.ts deleted file mode 100644 index e07fd0e01..000000000 --- a/packages/network/src/signer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './signers'; diff --git a/packages/network/src/signer/signers/index.ts b/packages/network/src/signer/signers/index.ts deleted file mode 100644 index 860ffaccc..000000000 --- a/packages/network/src/signer/signers/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './utils'; -export * from './vechain-private-key-signer'; -export * from './vechain-abstract-signer'; -export type * from './types.d'; diff --git a/packages/network/src/signer/signers/types.d.ts b/packages/network/src/signer/signers/types.d.ts deleted file mode 100644 index 8ecb11495..000000000 --- a/packages/network/src/signer/signers/types.d.ts +++ /dev/null @@ -1,405 +0,0 @@ -import { type TransactionClause } from '@vechain/sdk-core'; -import type { - TypedDataDomain as ViemTypedDataDomain, - TypedDataParameter as ViemTypedDataParameter -} from 'viem'; -import { - type HardhatVeChainProvider, - type VeChainProvider -} from '../../provider'; - -/** - * Available types for the VeChainProvider's - * - * @NOTE: We use our supported providers instead of ethers providers. - * If you create a new provider, you need to add it here. - */ -type AvailableVeChainProviders = VeChainProvider | HardhatVeChainProvider; - -/** - * EIP-712 types in case we change the provider (viem as of now) - */ - -type TypedDataDomain = Omit & { - chainId: number | bigint | string | undefined; -}; - -type TypedDataParameter = ViemTypedDataParameter; - -/** - * Type for transaction input - * - * @note Types of the properties can differ WRT ethers.TransactionRequest - */ -interface TransactionRequestInput { - /** - * The target of the transaction. - */ - to?: null | string; - - /** - * The sender of the transaction. - */ - from?: null | string; - - /** - * Nonce value for various purposes. - * Basic is to prevent replay attack by make transaction unique. - * Every transaction with same chainTag, blockRef, ... must have different nonce. - */ - nonce?: string | number; - - /** - * Transaction gas. - */ - gas?: string | number; - - /** - * The maximum amount of gas to allow this transaction to consume. - */ - gasLimit?: string; - - /** - * The gas price to use for legacy transactions or transactions on - * legacy networks. - * - * Most of the time the ``max*FeePerGas`` is preferred. - */ - gasPrice?: string; - - /** - * Coefficient used to calculate the gas price for the transaction. - * Value must be between 0 and 255. - */ - gasPriceCoef?: number; - - /** - * The transaction data. - */ - data?: string; - - /** - * The transaction value (in wei). - */ - value?: string | number; - - /** - * When using ``call`` or ``estimateGas``, this allows a specific - * block to be queried. Many backends do not support this and when - * unsupported errors are silently squelched and ``"latest"`` is used. - */ - blockTag?: string; - - /** - * Add clauses to ethers.TransactionRequest - */ - clauses?: TransactionClause[]; - - /** - * The ID of the transaction that this transaction depends on. - */ - dependsOn?: string; - - /** - * The expiration time of the transaction. - * The transaction will expire after the number of blocks specified by this value. - */ - expiration?: number; - - /** - * 8 bytes prefix of some block's ID - */ - blockRef?: string; - - /** - * Last byte of genesis block ID - */ - chainTag?: number; - - /** - * A reserved field intended for features use. - * - * In standard EVM transactions, this reserved field typically is not present. - * However, it's been designed to cater to VIP-191, which deals with fee delegation. - * - * If the `features` within the `reserved` field is set as `1111...111`, it indicates that the transaction has been delegated. - * The method to check if the transaction is delegated is: - * - * ```typescript - * reserved.features & 1 === 1 - * ``` - * - * @example - * - * 1. - * ```typescript - * feature = 111101; - * isDelegated = (111101 & 111111) === 111101; // false (not delegated) - * ``` - * - * 2. - * ```typescript - * feature = 111111; - * isDelegated = (111111 & 111111) === 111111; // true (delegated) - * ``` - * - * @remarks - * For more information on the subject, refer to {@link https://github.com/vechain/VIPs/blob/master/vips/VIP-191.md | VIP-191}. - */ - reserved?: { - /** - * Tx feature bits - */ - features?: number; - /** - * Unused - */ - unused?: Uint8Array[]; - }; - - /** - * The VeChainThor blockchain allows for transaction-level proof of work (PoW) and converts the proved work into extra gas price that will be used by - * the system to generate more reward to the block generator, the Authority Masternode, that validates the transaction. - * In other words, users can utilize their local computational power to make their transactions more likely to be included in a new block. - * - * @link [VeChainThor Proof of Work](https://docs.vechain.org/core-concepts/transactions/transaction-calculation#proof-of-work) - */ - provedWork?: string; - - /** - * The address that pays for the gas fee of the transaction simulation. - * If different from the caller, then a delegated transaction is simulated. - */ - gasPayer?: string; - - /** - * The delegation URL to use to sponsor the transaction. - */ - delegationUrl?: string; - - /** - * A comment describing the transaction request. - */ - comment?: string; - - // START: NOT SUPPORTED FIELDS in VeChain BUT added to take compatibility with ethers - - /** - * The chain ID for the network this transaction is valid on. - */ - chainId?: string; - - /** - * The [[link-eip-2930]] access list. Storage slots included in the access - * list are //warmed// by preloading them, so their initial cost to - * fetch is guaranteed, but then each additional access is cheaper. - */ - // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents - accessList?: null | AccessListish; - - /** - * A custom object, which can be passed along for network-specific - * values. - */ - customData?: unknown; - - /** - * The [[link-eip-1559]] maximum priority fee to pay per gas. - */ - maxPriorityFeePerGas?: string; - - /** - * The [[link-eip-1559]] maximum total fee to pay per gas. The actual - * value used is protocol enforced to be the block's base fee. - */ - maxFeePerGas?: string; - - /** - * The transaction type. - */ - type?: null | number; - - /** - * When using ``call``, this enables CCIP-read, which permits the - * provider to be redirected to web-based content during execution, - * which is then further validated by the contract. - * - * There are potential security implications allowing CCIP-read, as - * it could be used to expose the IP address or user activity during - * the fetch to unexpected parties. - */ - enableCcipRead?: boolean; - - // END: NOT SUPPORTED FIELDS in VeChain BUT added to take compatibility with ethers -} - -/** - * Options for signing typed data - * - * @NOTE: To enhance compatibility with extension and mobile and to allow account switching when signing typed data, we define this interface. - */ -interface SignTypedDataOptions { - signer?: string; -} - -/** - * A signer for VeChain, adding specific methods for VeChain to the ethers signer - * - * @NOTE: Su support completely our providers (that already support ethers provider format) - * We use our supported providers instead of ethers providers - */ -interface VeChainSigner { - /** - * The provider attached to this Signer (if any). - */ - provider?: AvailableVeChainProviders; - - /** - * Returns a new instance of this Signer connected to //provider// or detached - * from any Provider if undefined. - * - * @param provider - The provider to connect to - * @returns a new instance of this Signer connected to //provider// or detached - */ - connect: (provider: AvailableVeChainProviders) => this; - - /** - * Get the address of the Signer. - * - * @returns the address of the signer - */ - getAddress: () => Promise; - - /** - * Gets the next nonce required for this Signer to send a transaction. - * - * @param blockTag - The blocktag to base the transaction count on, keep in mind - * many nodes do not honour this value and silently ignore it [default: ``"latest"``] - * - * @NOTE: This method generates a random number as nonce. It is because the nonce in VeChain is a 6-byte number. - */ - getNonce: (blockTag?: string) => Promise; - - /** - * Prepares a {@link TransactionRequestInput} for calling: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified, check that it matches this Signer - * - * @note: Here the base support of multi-clause transaction is added. - * So, if clauses are provided in the transaction, it will be used as it is. - * Otherwise, standard transaction will be prepared. - * - * @param transactionToPopulate - The call to prepare - * @returns the prepared call transaction - */ - populateCall: ( - transactionToPopulate: TransactionRequestInput - ) => Promise; - - /** - * Prepares a {@link TransactionRequestInput} for sending to the network by - * populating any missing properties: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - populates ``nonce`` via ``signer.getNonce("pending")`` - * - populates gas parameters via ``signer.estimateGas(tx)`` - * - ... and other necessary properties - * - * @param transactionToPopulate - The call to prepare - * @returns the prepared transaction - */ - populateTransaction: ( - transactionToPopulate: TransactionRequestInput - ) => Promise; - - /** - * Estimates the required gas required to execute //tx// on the Blockchain. This - * will be the expected amount a transaction will require - * to successfully run all the necessary computations and store the needed state - * that the transaction intends. - * - * @param transactionToEstimate - The transaction to estimate gas for - * @returns the total estimated gas required - */ - estimateGas: ( - transactionToEstimate: TransactionRequestInput - ) => Promise; - - /** - * Evaluates the //tx// by running it against the current Blockchain state. This - * cannot change state and has no cost, as it is effectively simulating - * execution. - * - * This can be used to have the Blockchain perform computations based on its state - * (e.g. running a Contract's getters) or to simulate the effect of a transaction - * before actually performing an operation. - * - * @param transactionToEvaluate - The transaction to evaluate - * @param revision - The revision to evaluate the transaction against - * @returns the result of the evaluation - */ - call: ( - transactionToEvaluate: TransactionRequestInput, - revision?: string - ) => Promise; - - /** - * Signs %%transactionToSign%%, returning the fully signed transaction. This does not - * populate any additional properties within the transaction. - * - * @param transactionToSign - The transaction to sign - * @returns The fully signed transaction - */ - signTransaction: ( - transactionToSign: TransactionRequestInput - ) => Promise; - - /** - * Sends %%transactionToSend%% to the Network. The ``signer.populateTransaction(transactionToSend)`` - * is called first to ensure all necessary properties for the - * transaction to be valid have been populated first. - * - * @param transactionToSend - The transaction to send - * @returns The transaction response - */ - sendTransaction: ( - transactionToSend: TransactionRequestInput - ) => Promise; - - /** - * Signs an [[link-eip-191]] prefixed a personal message. - * - * 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. - * - * To sign that example as two bytes, the Uint8Array should be used - * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). - */ - signMessage: (message: string | Uint8Array) => Promise; - - /** - * Signs the [[link-eip-712]] typed data. - */ - signTypedData: ( - domain: TypedDataDomain, - types: Record, - message: Record, - primaryType?: string, - options?: SignTypedDataOptions - ) => Promise; - - /** - * Resolves an VNS Name to an address. - */ - resolveName: (vnsName: string) => Promise; -} - -export { - type AvailableVeChainProviders, - type TypedDataDomain, - type TypedDataParameter, - type SignTypedDataOptions, - type TransactionRequestInput, - type VeChainSigner -}; diff --git a/packages/network/src/signer/signers/utils/index.ts b/packages/network/src/signer/signers/utils/index.ts deleted file mode 100644 index a57428f27..000000000 --- a/packages/network/src/signer/signers/utils/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { transactionBodyToTransactionRequestInput } from './utils'; - -const signerUtils = { - transactionBodyToTransactionRequestInput -}; -export { signerUtils }; diff --git a/packages/network/src/signer/signers/utils/utils.ts b/packages/network/src/signer/signers/utils/utils.ts deleted file mode 100644 index 2b3c394c1..000000000 --- a/packages/network/src/signer/signers/utils/utils.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type TransactionBody } from '@vechain/sdk-core'; -import { type TransactionRequestInput } from '../types'; - -/** - * Utility method to convert a transaction body to a transaction request input - * - * @param transactionBody - The transaction body to convert - * @param from - The address of the sender - * - * @returns The transaction request input - */ -function transactionBodyToTransactionRequestInput( - transactionBody: TransactionBody, - from: string -): TransactionRequestInput { - return { - from, - chainTag: transactionBody.chainTag, - blockRef: transactionBody.blockRef, - expiration: transactionBody.expiration, - clauses: transactionBody.clauses, - gasPriceCoef: transactionBody.gasPriceCoef, - gas: transactionBody.gas, - dependsOn: transactionBody.dependsOn ?? undefined, - nonce: transactionBody.nonce, - reserved: transactionBody.reserved - } satisfies TransactionRequestInput; -} - -export { transactionBodyToTransactionRequestInput }; diff --git a/packages/network/src/signer/signers/vechain-abstract-signer/index.ts b/packages/network/src/signer/signers/vechain-abstract-signer/index.ts deleted file mode 100644 index 1e66ce594..000000000 --- a/packages/network/src/signer/signers/vechain-abstract-signer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './vechain-abstract-signer'; 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 deleted file mode 100644 index 4ceb062ba..000000000 --- a/packages/network/src/signer/signers/vechain-abstract-signer/vechain-abstract-signer.ts +++ /dev/null @@ -1,550 +0,0 @@ -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, - SignerMethodError -} from '@vechain/sdk-errors'; -import { - hashTypedData, - type TypedDataDomain as ViemTypedDataDomain -} 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 TransactionRequestInput, - type TypedDataDomain, - type TypedDataParameter, - type VeChainSigner -} from '../types'; - -/** - * Abstract VeChain signer. - * This abstract class avoids people every time implementing standard signer - * methods. - * By implementing this abstract class, it will be easier to create new signers - */ -abstract class VeChainAbstractSigner implements VeChainSigner { - protected readonly MESSAGE_PREFIX = Txt.of('\x19Ethereum Signed Message:\n') - .bytes; - - /** - * The provider attached to this Signer (if any). - */ - provider?: AvailableVeChainProviders; - - /** - * Create a new VeChainPrivateKeySigner. - * A signer can be initialized using a private key. - * - * @param provider - The provider to connect to - */ - protected constructor(provider?: AvailableVeChainProviders) { - // Store provider and delegator - this.provider = provider; - } - - /** - * Returns a new instance of this Signer connected to //provider// or detached - * from any Provider if undefined. - * - * @param provider - The provider to connect to - * @returns a new instance of this Signer connected to //provider// or detached - */ - abstract connect(provider: AvailableVeChainProviders): this; - - /** - * Get the address of the Signer. - * - * @returns the address of the signer - */ - abstract getAddress(): Promise; - - /** - * Prepares a {@link TransactionRequestInput} for calling: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified, check that it matches this Signer - * - * @note: Here the base support of multi-clause transaction is added. - * So, if clauses are provided in the transaction, it will be used as it is. - * Otherwise, standard transaction will be prepared. - * - * @param transactionToPopulate - The call to prepare - * @returns the prepared call transaction - * @throws {InvalidDataType} - */ - async populateCall( - transactionToPopulate: TransactionRequestInput - ): Promise { - // 1 - Add from field (if not provided) - if ( - transactionToPopulate.from === undefined || - transactionToPopulate.from === null - ) - transactionToPopulate.from = Address.checksum( - HexUInt.of(await this.getAddress()) - ); - // Throw an error if the from address does not match the signer address - // @note: this because we cannot sign a transaction with a different address - else if ( - Address.checksum(HexUInt.of(transactionToPopulate.from)) !== - Address.checksum(HexUInt.of(await this.getAddress())) - ) { - throw new InvalidDataType( - 'VeChainAbstractSigner.populateCall()', - 'From address does not match the signer address.', - { - signerAddress: Address.checksum( - HexUInt.of(await this.getAddress()) - ), - fromAddress: Address.checksum( - HexUInt.of(transactionToPopulate.from) - ) - } - ); - } - - // 2 - Set to field - if (transactionToPopulate.to === undefined) - transactionToPopulate.to = null; - - // 3 - Use directly clauses, if they are provided - if ( - transactionToPopulate.clauses !== undefined && - transactionToPopulate.clauses.length > 0 - ) { - // 2.1 - Set to, value and data fields to be consistent - transactionToPopulate.to = transactionToPopulate.clauses[0].to; - transactionToPopulate.value = - transactionToPopulate.clauses[0].value; - transactionToPopulate.data = transactionToPopulate.clauses[0].data; - } - - // Return the transaction - return transactionToPopulate; - } - - /** - * Prepares a {@link TransactionRequestInput} for sending to the network by - * populating any missing properties: - * - resolves ``to`` and ``from`` addresses - * - if ``from`` is specified , check that it matches this Signer - * - populates ``nonce`` via ``signer.getNonce("pending")`` - * - populates gas parameters via ``signer.estimateGas(tx)`` - * - ... and other necessary properties - * - * @param transactionToPopulate - The call to prepare - * @returns the prepared transaction - * @throws {JSONRPCInvalidParams} - */ - async populateTransaction( - transactionToPopulate: TransactionRequestInput - ): Promise { - // 1 - Get the thor client - if ((this.provider as AvailableVeChainProviders) === undefined) { - throw new JSONRPCInvalidParams( - 'VechainAbstractSigner.populateTransaction()', - 'Thor client not found into the signer. Please attach a Provider with a thor client to your signer instance.', - { provider: this.provider } - ); - } - - const thorClient = (this.provider as AvailableVeChainProviders) - .thorClient; - - // 2 - Populate the call, to get proper 'from' and 'to' address (compatible with multi-clause transactions) - const populatedTransaction = await this.populateCall( - transactionToPopulate - ); - - // 3 - Estimate gas - const totalGasResult = - transactionToPopulate.gas !== undefined - ? Number(transactionToPopulate.gas) - : await this.estimateGas(transactionToPopulate); - - // 4 - Build the transaction body - return await thorClient.transactions.buildTransactionBody( - populatedTransaction.clauses ?? - this._buildClauses(populatedTransaction), - totalGasResult, - { - isDelegated: this.provider?.enableDelegation as boolean, - nonce: - populatedTransaction.nonce ?? - (await this.getNonce('pending')), - blockRef: populatedTransaction.blockRef ?? undefined, - chainTag: populatedTransaction.chainTag ?? undefined, - dependsOn: populatedTransaction.dependsOn ?? undefined, - expiration: populatedTransaction.expiration, - gasPriceCoef: populatedTransaction.gasPriceCoef ?? undefined - } - ); - } - - /** - * Estimates the required gas required to execute //tx// on the Blockchain. This - * will be the expected amount a transaction will require - * to successfully run all the necessary computations and store the needed state - * that the transaction intends. - * - * @param transactionToEstimate - The transaction to estimate gas for - * @returns the total estimated gas required - * @throws {JSONRPCInvalidParams} - */ - async estimateGas( - transactionToEstimate: TransactionRequestInput - ): Promise { - // 1 - Get the thor client - if ((this.provider as AvailableVeChainProviders) === undefined) { - throw new JSONRPCInvalidParams( - 'VechainAbstractSigner.estimateGas()', - 'Thor client not found into the signer. Please attach a Provider with a thor client to your signer instance.', - { provider: this.provider } - ); - } - - const thorClient = (this.provider as AvailableVeChainProviders) - .thorClient; - - // 2 - Populate the call, to get proper from and to address (compatible with multi-clause transactions) - const populatedTransaction = await this.populateCall( - transactionToEstimate - ); - - // 3 - Estimate gas - const gasEstimation = await thorClient.gas.estimateGas( - populatedTransaction.clauses ?? - this._buildClauses(populatedTransaction), - populatedTransaction.from as string - ); - - // Return the gas estimation - return gasEstimation.totalGas; - } - - /** - * Evaluates the //tx// by running it against the current Blockchain state. This - * cannot change state and has no cost, as it is effectively simulating - * execution. - * - * This can be used to have the Blockchain perform computations based on its state - * (e.g. running a Contract's getters) or to simulate the effect of a transaction - * before actually performing an operation. - * - * @param transactionToEvaluate - The transaction to evaluate - * @param revision - The block number or block ID of which the transaction simulation is based on - * @returns the result of the evaluation - * @throws {JSONRPCInvalidParams} - */ - async call( - transactionToEvaluate: TransactionRequestInput, - revision?: string - ): Promise { - // 1 - Get the thor client - if ((this.provider as AvailableVeChainProviders) === undefined) { - throw new JSONRPCInvalidParams( - 'VechainAbstractSigner.call()', - 'Thor client not found into the signer. Please attach a Provider with a thor client to your signer instance.', - { provider: this.provider } - ); - } - const thorClient = (this.provider as AvailableVeChainProviders) - .thorClient; - - // 2 - Populate the call, to get proper from and to address (compatible with multi-clause transactions) - const populatedTransaction = await this.populateCall( - transactionToEvaluate - ); - - // 3 - Evaluate the transaction - const simulation: TransactionSimulationResult[] = - await thorClient.transactions.simulateTransaction( - populatedTransaction.clauses ?? - this._buildClauses(populatedTransaction), - { - revision: revision ?? undefined, - gas: (populatedTransaction.gas as number) ?? undefined, - gasPrice: populatedTransaction.gasPrice ?? undefined, - caller: populatedTransaction.from as string, - provedWork: populatedTransaction.provedWork ?? undefined, - gasPayer: populatedTransaction.gasPayer ?? undefined, - expiration: populatedTransaction.expiration ?? undefined, - blockRef: populatedTransaction.blockRef ?? undefined - } - ); - - // 4 - Return the result of the evaluation - return simulation[0].data; - } - - /** - * Gets the next nonce required for this Signer to send a transaction. - * - * @param blockTag - The blocktag to base the transaction count on, keep in mind - * many nodes do not honour this value and silently ignore it [default: ``"latest"``] - * - * @NOTE: This method generates a random number as nonce. It is because the nonce in VeChain is a 6-byte number. - */ - async getNonce(blockTag?: string): Promise { - // If provider is available, get the nonce from the provider using eth_getTransactionCount - if (this.provider !== undefined) { - return (await this.provider.request({ - method: RPC_METHODS.eth_getTransactionCount, - params: [await this.getAddress(), blockTag] - })) as string; - } - - // Otherwise return a random number - return Hex.random(6).toString(); - } - - /** - * Signs %%transactionToSign%%, returning the fully signed transaction. This does not - * populate any additional properties with eth_getTransactionCount: RPC_METHODS, p0: (string | undefined)[], args: EIP1193RequestArguments* @param transactionToSign - The transaction to sign - * @returns The fully signed transaction - */ - abstract signTransaction( - transactionToSign: TransactionRequestInput - ): Promise; - - /** - * Sends %%transactionToSend%% to the Network. The ``signer.populateTransaction(transactionToSend)`` - * is called first to ensure all necessary properties for the - * transaction to be valid have been populated first. - * - * @param transactionToSend - The transaction to send - * @returns The transaction response - */ - abstract sendTransaction( - 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. - * - * @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. - * @return {Promise} - A Promise that resolves to the signature as a string. - */ - 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]; - } - - /** - * Viem does not check the type of the domain object on runtime at least in version 2.22.8 - * @param obj unknown object to check if it is a ViemTypedDataDomain - * @returns true if the object is a ViemTypedDataDomain - */ - private isViemTypedDataDomain(obj: unknown): obj is ViemTypedDataDomain { - if (typeof obj !== 'object' || obj === null) { - return false; - } - - const expectedKeys = [ - 'name', - 'version', - 'chainId', - 'verifyingContract', - 'salt' - ]; - const objKeys = Object.keys(obj); - - // Check for unexpected keys - for (const key of objKeys) { - if (!expectedKeys.includes(key)) { - return false; - } - } - - // salt and verifyingContract are dynamic types, should be checked by viem - const domain = obj as ViemTypedDataDomain; - return ( - (typeof domain.name === 'undefined' || - typeof domain.name === 'string') && - (typeof domain.version === 'undefined' || - typeof domain.version === 'string') && - (typeof domain.chainId === 'undefined' || - typeof domain.chainId === 'number' || - typeof domain.chainId === 'bigint' || - typeof domain.chainId === 'string') - ); - } - - /** - * 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 {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. - */ - public async signTypedData( - domain: TypedDataDomain, - types: Record, - message: Record, - primaryType?: string - ): Promise { - try { - const parsedDomain: ViemTypedDataDomain = { - ...domain, - chainId: - typeof domain.chainId === 'string' - ? BigInt(domain.chainId) - : domain.chainId - }; - if (!this.isViemTypedDataDomain(parsedDomain)) { - throw new SignerMethodError( - 'VeChainAbstractSigner.signTypedData', - 'The domain is not a valid object.', - { domain } - ); - } - const payload = Hex.of( - hashTypedData({ - domain: parsedDomain, - types, - primaryType: primaryType ?? this.deducePrimaryType(types), // Deduce the primary type if not provided - message - }) - ).bytes; - - return await this.signPayload(payload); - } catch (error) { - if (error instanceof SignerMethodError) { - throw 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 - * @param vnsName - The name to resolve - * @returns the address for a name or null - */ - async resolveName(vnsName: string): Promise { - if (this.provider === undefined) { - return null; - } - - return await vnsUtils.resolveName(this.provider.thorClient, vnsName); - } - - /** - * Build the transaction clauses - * form a transaction given as input - * - * @param transaction - The transaction to sign - * @returns The transaction clauses - */ - protected _buildClauses( - transaction: TransactionRequestInput - ): TransactionClause[] { - return transaction.to !== undefined && transaction.to !== null - ? // Normal transaction - [ - { - to: transaction.to, - data: transaction.data ?? '0x', - value: transaction.value ?? '0x0' - } satisfies TransactionClause - ] - : // If 'to' address is not provided, it will be assumed that the transaction is a contract creation transaction. - [ - Clause.deployContract( - HexUInt.of(transaction.data ?? 0) - ) as TransactionClause - ]; - } -} - -export { VeChainAbstractSigner }; diff --git a/packages/network/src/signer/signers/vechain-private-key-signer/index.ts b/packages/network/src/signer/signers/vechain-private-key-signer/index.ts deleted file mode 100644 index 1ae4da4c2..000000000 --- a/packages/network/src/signer/signers/vechain-private-key-signer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './vechain-private-key-signer'; 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 deleted file mode 100644 index 9c1828754..000000000 --- a/packages/network/src/signer/signers/vechain-private-key-signer/vechain-private-key-signer.ts +++ /dev/null @@ -1,254 +0,0 @@ -import { - Address, - Hex, - HexUInt, - Secp256k1, - Transaction, - type TransactionBody -} from '@vechain/sdk-core'; -import { - InvalidSecp256k1PrivateKey, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; -import { RPC_METHODS } from '../../../provider/utils/const/rpc-mapper/rpc-methods'; -import { - DelegationHandler, - type SignTransactionOptions, - type ThorClient -} from '../../../thor-client'; -import { - type AvailableVeChainProviders, - type TransactionRequestInput -} from '../types'; -import { VeChainAbstractSigner } from '../vechain-abstract-signer/vechain-abstract-signer'; - -/** - * Basic VeChain signer with the private key. - * This signer can be initialized using a private key. - */ -class VeChainPrivateKeySigner extends VeChainAbstractSigner { - /** - * Create a new VeChainPrivateKeySigner. - * A signer can be initialized using a private key. - * - * @param privateKey - The private key of the signer - * @param provider - The provider to connect to - */ - constructor( - private readonly privateKey: Uint8Array, - provider?: AvailableVeChainProviders - ) { - // Assert if the transaction can be signed - if (!Secp256k1.isValidPrivateKey(privateKey)) { - throw new InvalidSecp256k1PrivateKey( - `VeChainPrivateKeySigner.constructor()`, - "Invalid private key used to sign initialize the signer. Ensure it's a valid Secp256k1 private key.", - undefined - ); - } - - // Call the parent constructor - super(provider); - } - - /** - * Returns a new instance of this Signer connected to //provider// or detached - * from any Provider if null. - * - * @param provider - The provider to connect to - * @returns a new instance of this Signer connected to //provider// or detached - */ - connect(provider: AvailableVeChainProviders): this { - return new VeChainPrivateKeySigner(this.privateKey, provider) as this; - } - - /** - * Get the address checksum of the Signer. - * - * @returns the address checksum of the signer - */ - async getAddress(): Promise { - return Address.checksum( - HexUInt.of( - await Promise.resolve( - Address.ofPrivateKey(this.privateKey).toString() - ) - ) - ); - } - - /** - * Signs %%transactionToSign%%, returning the fully signed transaction. This does not - * populate any additional properties with eth_getTransactionCount: RPC_METHODS, p0: (string | undefined)[], args: EIP1193RequestArguments* @param transactionToSign - The transaction to sign - * @returns The fully signed transaction - */ - async signTransaction( - transactionToSign: TransactionRequestInput - ): Promise { - // Check the provider (needed to sign the transaction) - if (this.provider === undefined) { - throw new JSONRPCInvalidParams( - 'VeChainPrivateKeySigner.signTransaction()', - 'Thor provider is not found into the signer. Please attach a Provider to your signer instance.', - { transactionToSign } - ); - } - - let delegator = DelegationHandler( - await this.provider.wallet?.getDelegator() - ).delegatorOrNull(); - - // Override the delegator if the transaction has a delegation URL - if (transactionToSign.delegationUrl !== undefined) { - delegator = { - delegatorUrl: transactionToSign.delegationUrl - }; - } - - // Sign the transaction - return await this._signFlow( - transactionToSign, - delegator, - this.provider.thorClient - ); - } - - /** - * Sends %%transactionToSend%% to the Network. The ``signer.populateTransaction(transactionToSend)`` - * is called first to ensure all necessary properties for the - * transaction to be valid have been populated first. - * - * @param transactionToSend - The transaction to send - * @returns The transaction response - * @throws {JSONRPCInvalidParams} - */ - async sendTransaction( - transactionToSend: TransactionRequestInput - ): Promise { - // 1 - Get the provider (needed to send the raw transaction) - if (this.provider === undefined) { - throw new JSONRPCInvalidParams( - 'VeChainPrivateKeySigner.sendTransaction()', - 'Thor provider is not found into the signer. Please attach a Provider to your signer instance.', - { transactionToSend } - ); - } - - const provider = this.provider; - - // 2 - Sign the transaction - const signedTransaction = await this.signTransaction(transactionToSend); - - // 3 - Send the signed transaction - return (await provider.request({ - method: RPC_METHODS.eth_sendRawTransaction, - params: [signedTransaction] - })) as string; - } - - /** - * Signs a payload. - * - * @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 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()); - } - - /** - * Signs a transaction internal method - * - * @param transaction - The transaction to sign - * @param delegator - The delegator to use - * @param thorClient - The ThorClient instance - * @returns The fully signed transaction - * @throws {InvalidSecp256k1PrivateKey, InvalidDataType} - */ - async _signFlow( - transaction: TransactionRequestInput, - delegator: SignTransactionOptions | null, - thorClient: ThorClient - ): Promise { - // Populate the call, to get proper from and to address (compatible with multi-clause transactions) - const populatedTransaction = - await this.populateTransaction(transaction); - - // Sign the transaction - return delegator !== null - ? await this._signWithDelegator( - populatedTransaction, - this.privateKey, - thorClient, - delegator - ) - : Hex.of( - Transaction.of(populatedTransaction).sign(this.privateKey) - .encoded - ).toString(); - } - - /** - * Signs a transaction where the gas fee is paid by a delegator. - * - * @param unsignedTransactionBody - The unsigned transaction body to sign. - * @param originPrivateKey - The private key of the origin account. - * @param thorClient - The ThorClient instance. - * @param delegatorOptions - Optional parameters for the request. Includes the `delegatorUrl` and `delegatorPrivateKey` fields. - * Only one of the following options can be specified: `delegatorUrl`, `delegatorPrivateKey`. - * @returns A promise that resolves to the signed transaction. - * @throws {NotDelegatedTransaction} - */ - private async _signWithDelegator( - unsignedTransactionBody: TransactionBody, - originPrivateKey: Uint8Array, - thorClient: ThorClient, - delegatorOptions?: SignTransactionOptions - ): Promise { - // Address of the origin account - const originAddress = Address.ofPrivateKey(originPrivateKey).toString(); - - const unsignedTx = Transaction.of(unsignedTransactionBody); - - // Sign transaction with origin private key and delegator private key - if (delegatorOptions?.delegatorPrivateKey !== undefined) - return Hex.of( - Transaction.of(unsignedTransactionBody).signAsSenderAndGasPayer( - originPrivateKey, - HexUInt.of(delegatorOptions?.delegatorPrivateKey).bytes - ).encoded - ).toString(); - - // Otherwise, get the signature of the delegator from the delegator endpoint - const delegatorSignature = await DelegationHandler( - delegatorOptions - ).getDelegationSignatureUsingUrl( - unsignedTx, - originAddress, - thorClient.httpClient - ); - - // Sign transaction with origin private key - const originSignature = Secp256k1.sign( - unsignedTx.getTransactionHash().bytes, - originPrivateKey - ); - - // Sign the transaction with both signatures. Concat both signatures to get the final signature - const signature = new Uint8Array( - originSignature.length + delegatorSignature.length - ); - signature.set(originSignature); - signature.set(delegatorSignature, originSignature.length); - - // Return new signed transaction - return Hex.of( - Transaction.of(unsignedTx.body, signature).encoded - ).toString(); - } -} - -export { VeChainPrivateKeySigner }; diff --git a/packages/network/src/thor-client/ThorClient.ts b/packages/network/src/thor-client/ThorClient.ts deleted file mode 100644 index 4a10a63ea..000000000 --- a/packages/network/src/thor-client/ThorClient.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { - AccountsModule, - BlocksModule, - type BlocksModuleOptions, - ContractsModule, - DebugModule, - GasModule, - LogsModule, - NodesModule, - TransactionsModule -} from '.'; -import { SimpleHttpClient, type HttpClient } from '../http'; - -/** - * The `ThorClient` class serves as an interface to interact with the VeChainThor blockchain. - * It provides various methods. - */ -class ThorClient { - /** - * The `AccountsModule` instance - */ - public readonly accounts: AccountsModule; - - /** - * The `NodesModule` instance - */ - public readonly nodes: NodesModule; - - /** - * The `BlocksModule` instance - */ - public readonly blocks: BlocksModule; - - /** - * The `LogsModule` instance used for interacting with log-related endpoints. - */ - public readonly logs: LogsModule; - - /* - * The `TransactionsModule` instance - */ - public readonly transactions: TransactionsModule; - - /** - * The 'ContractClient' instance - */ - public readonly contracts: ContractsModule; - - /** - * The `GasModule` instance - */ - public readonly gas: GasModule; - - /** - * The `DebugModule` instance - */ - public readonly debug: DebugModule; - - /** - * Constructs a new `ThorClient` instance with a given HTTP client. - * - * @param httpClient - The HTTP client instance used for making network requests. - * @param options - (Optional) Other optional parameters for polling and error handling. - */ - constructor( - readonly httpClient: HttpClient, - options?: BlocksModuleOptions - ) { - this.accounts = new AccountsModule(httpClient); - this.debug = new DebugModule(httpClient); - this.blocks = new BlocksModule(httpClient, options); - this.logs = new LogsModule(this.blocks); - this.nodes = new NodesModule(this.blocks); - this.transactions = new TransactionsModule( - this.blocks, - this.debug, - this.logs - ); - this.contracts = new ContractsModule(this.transactions); - this.gas = new GasModule(this.transactions); - } - - /** - * Creates a new `ThorClient` instance from a given URL. - * - * @param {string} networkUrl - The URL of the network to connect to. - * @param {BlocksModuleOptions} [options] - Optional configuration settings for the Blocks module. - * @return {ThorClient} A ThorClient instance connected to the specified network URL. - */ - public static at( - networkUrl: string, - options?: BlocksModuleOptions - ): ThorClient { - return new ThorClient(new SimpleHttpClient(networkUrl), options); - } - - /** - * Destroys the `ThorClient` instance by stopping the event polling - * and any other cleanup. - */ - public destroy(): void { - this.blocks.destroy(); - } - - /** - * Creates a ThorClient instance from a network URL. - * - * @param {string} networkUrl - The URL of the network to connect to. - * @param {BlocksModuleOptions} [options] - Optional configuration settings for the Blocks module. - * @return {ThorClient} A ThorClient instance connected to the specified network URL. - * - * @deprecated Use {@link ThorClient.at} instead. - */ - public static fromUrl( - networkUrl: string, - options?: BlocksModuleOptions - ): ThorClient { - return ThorClient.at(networkUrl, options); - } -} - -export { ThorClient }; diff --git a/packages/network/src/thor-client/accounts/AccountData.ts b/packages/network/src/thor-client/accounts/AccountData.ts deleted file mode 100644 index d9f4cf936..000000000 --- a/packages/network/src/thor-client/accounts/AccountData.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * The account details represent the balance, energy & whether the account is a smart contract. - */ -export interface AccountData { - /** - * The hexadecimal expression of the wei VET value of the balance. - */ - balance: string; - - /** - * The hexadecimal expression of the wei VTHO value of the energy balance. - */ - energy: string; - - /** - * Whether the account is a smart contract (i.e., hasCode is true) - */ - hasCode: boolean; -} diff --git a/packages/network/src/thor-client/accounts/AccountDetail.ts b/packages/network/src/thor-client/accounts/AccountDetail.ts deleted file mode 100644 index 9cdaf6c19..000000000 --- a/packages/network/src/thor-client/accounts/AccountDetail.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { FixedPointNumber, Units, VET, VTHO } from '@vechain/sdk-core'; -import { type AccountData } from './AccountData'; - -/** - * Represents detailed account information. - * - * Implements the {@link AccountData} interface. - */ -class AccountDetail implements AccountData { - /** - * Return the hexadecimal expression of the wei VET value of the balance. - */ - readonly balance: string; - - /** - * Return the hexadecimal expression of the wei VTHO value of the energy balance. - */ - readonly energy: string; - - /** - * Return `true` if the account is a smart contract, otherwise `false`. - */ - readonly hasCode: boolean; - - /** - * Returns the balance of the account in {@link VET}. - */ - get vet(): VET { - return VET.of(Units.formatEther(FixedPointNumber.of(this.balance))); - } - - /** - * Returns the energy balance of the account in {@link VTHO}. - */ - get vtho(): VTHO { - return VTHO.of(Units.formatEther(FixedPointNumber.of(this.energy))); - } - - /** - * Constructs a new instance of the class. - * - * @param {AccountData} accountData - The data to initialize the account with. - */ - constructor(accountData: AccountData) { - this.balance = accountData.balance; - this.energy = accountData.energy; - this.hasCode = accountData.hasCode; - } -} - -export { AccountDetail }; diff --git a/packages/network/src/thor-client/accounts/AccountInputOptions.ts b/packages/network/src/thor-client/accounts/AccountInputOptions.ts deleted file mode 100644 index d6c2e40f7..000000000 --- a/packages/network/src/thor-client/accounts/AccountInputOptions.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { type Revision } from '@vechain/sdk-core'; - -/** - * Input options for: - * * {@link AccountModule.getAccount}, - * * {@link AccountModule.getBytecode}, - * * {@link AccountModule.getStorage}, - */ -export interface AccountInputOptions { - /** - * (Optional) The block number or ID to reference the bytecode version. - */ - revision?: Revision; -} diff --git a/packages/network/src/thor-client/accounts/AccountsModule.ts b/packages/network/src/thor-client/accounts/AccountsModule.ts deleted file mode 100644 index 62fae20da..000000000 --- a/packages/network/src/thor-client/accounts/AccountsModule.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { AccountDetail } from './AccountDetail'; -import { buildQuery, thorest } from '../../utils'; -import { type AccountData } from './AccountData'; -import { type AccountInputOptions } from './AccountInputOptions'; -import { type Address, type BlockId, HexUInt } from '@vechain/sdk-core'; -import { type HttpClient } from '../../http'; - -/** - * of the VeChain Thor blockchain. - * It allows to retrieve details, bytecode, and storage data for a specific blockchain account. - */ -class AccountsModule { - /** - * Creates an instance of the class with a specified HTTP client. - * - * @param {HttpClient} httpClient - The HTTP client instance to be used for making requests. - */ - constructor(readonly httpClient: HttpClient) {} - - /** - * Retrieves the details of an account given the account address and optional parameters. - * - * @param {Address} address - The address of the account to be retrieved. - * @param {AccountInputOptions} [options] - Optional parameters to modify the account retrieval. - * @return {Promise} Returns a promise that resolves to the account details. - */ - public async getAccount( - address: Address, - options?: AccountInputOptions - ): Promise { - const revision = options?.revision?.toString(); - return new AccountDetail( - (await this.httpClient.get( - thorest.accounts.get.ACCOUNT_DETAIL(address.toString()), - { - query: buildQuery({ revision }) - } - )) as AccountData - ); - } - - /** - * Retrieves the bytecode of the smart contract deployed at the specified address. - * - * @param {Address} address - The address of the smart contract. - * @param {AccountInputOptions} [options] - Optional settings for the request, including the block revision. - * @return {Promise} A promise that resolves to the bytecode of the smart contract. - */ - public async getBytecode( - address: Address, - options?: AccountInputOptions - ): Promise { - const revision = options?.revision?.toString(); - const result = (await this.httpClient.get( - thorest.accounts.get.ACCOUNT_BYTECODE(address.toString()), - { - query: buildQuery({ revision }) - } - )) as ResponseBytecode; - return HexUInt.of(result.code); - } - - /** - * Retrieves the storage value at the specified storage position for a given address. - * - * @param {Address} address - The address of the account whose storage value is to be retrieved. - * @param {ThorId} position - The position in the storage from where the value is to be retrieved. - * @param {AccountInputOptions} [options] - Optional parameters including revision for specifying the block number or ID to query against. - * @return {Promise} - A promise that resolves to the storage value as a string. - */ - public async getStorageAt( - address: Address, - position: BlockId, - options?: AccountInputOptions - ): Promise { - const pos = position.toString(); - const revision = options?.revision?.toString(); - const result = (await this.httpClient.get( - thorest.accounts.get.STORAGE_AT(address.toString(), pos), - { - query: buildQuery({ pos, revision }) - } - )) as ResponseStorage; - - return HexUInt.of(result.value); - } -} - -/** - * The bytecode of a smart contract. - * The bytecode is represented in hex string. - */ -interface ResponseBytecode { - /** - * Bytecode of the smart contract - */ - code: string; -} - -/** - * The storage data of a smart contract at the specified position. - * The storage data is represented in hex string. - */ -interface ResponseStorage { - /** - * Hex string of the storage data - */ - value: string; -} - -export { AccountsModule }; diff --git a/packages/network/src/thor-client/accounts/index.ts b/packages/network/src/thor-client/accounts/index.ts deleted file mode 100644 index e12142392..000000000 --- a/packages/network/src/thor-client/accounts/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './AccountDetail'; -export * from './AccountsModule'; -export type * from './AccountData'; -export type * from './AccountInputOptions'; diff --git a/packages/network/src/thor-client/blocks/blocks-module.ts b/packages/network/src/thor-client/blocks/blocks-module.ts deleted file mode 100644 index b43ae1962..000000000 --- a/packages/network/src/thor-client/blocks/blocks-module.ts +++ /dev/null @@ -1,330 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; -import { buildQuery, type EventPoll, Poll, thorest } from '../../utils'; -import { - type BlocksModuleOptions, - type CompressedBlockDetail, - type ExpandedBlockDetail, - type TransactionsExpandedBlockDetail, - type WaitForBlockOptions -} from './types'; -import { Revision, type TransactionClause } from '@vechain/sdk-core'; -import { type HttpClient, HttpMethod } from '../../http'; - -/** The `BlocksModule` class encapsulates functionality for interacting with blocks - * on the VeChainThor blockchain. - */ -class BlocksModule { - /** - * The head block (best block). This is updated by the event poll instance every time a new block is produced. - * @private - */ - private headBlock: CompressedBlockDetail | null = null; - - /** - * Error handler for block-related errors. - */ - public onBlockError?: (error: Error) => undefined; - - /** - * The Poll instance for event polling - * @private - */ - private pollInstance?: EventPoll; - - /** - * Initializes a new instance of the `Thor` class. - * @param thor - The Thor instance used to interact with the VeChain blockchain API. - * @param options - (Optional) Other optional parameters for polling and error handling. - */ - constructor( - readonly httpClient: HttpClient, - options?: BlocksModuleOptions - ) { - this.onBlockError = options?.onBlockError; - if (options?.isPollingEnabled === true) this.setupPolling(); - } - - /** - * Destroys the instance by stopping the event poll. - */ - public destroy(): void { - if (this.pollInstance != null) { - this.pollInstance.stopListen(); - } - } - - /** - * Sets up the event polling for the best block. - * @private - * */ - private setupPolling(): void { - this.pollInstance = Poll.createEventPoll( - async () => await this.getBestBlockCompressed(), - 10000 // Poll every 10 seconds, - ) - .onData((data) => { - this.headBlock = data; - }) - .onError(this.onBlockError ?? (() => {})); - - this.pollInstance.startListen(); - } - - /** - * Retrieves details of a compressed specific block identified by its revision (block number or ID). - * - * @param revision - The block number or ID to query details for. - * @returns A promise that resolves to an object containing the details of the compressed block. - * @throws {InvalidDataType} - */ - public async getBlockCompressed( - revision: string | number - ): Promise { - // Check if the revision is a valid block number or ID - if ( - revision !== null && - revision !== undefined && - !Revision.isValid(revision) - ) { - throw new InvalidDataType( - 'BlocksModule.getBlockCompressed()', - 'Invalid revision. The revision must be a string representing a block number or block id (also "best" is accepted which represents the best block & "finalized" for the finalized block).', - { revision } - ); - } - return (await this.httpClient.http( - HttpMethod.GET, - thorest.blocks.get.BLOCK_DETAIL(revision) - )) as CompressedBlockDetail | null; - } - - /** - * Retrieves details of an expanded specific block identified by its revision (block number or ID). - * - * @param revision - The block number or ID to query details for. - * @returns A promise that resolves to an object containing the details of the expanded block. - * @throws {InvalidDataType} - */ - public async getBlockExpanded( - revision: string | number - ): Promise { - // Check if the revision is a valid block number or ID - if ( - revision !== null && - revision !== undefined && - !Revision.isValid(revision) - ) { - throw new InvalidDataType( - 'BlocksModule.getBlockExpanded()', - 'Invalid revision. The revision must be a string representing a block number or block id (also "best" is accepted which represents the best block & "finalized" for the finalized block).', - { revision } - ); - } - - return (await this.httpClient.http( - HttpMethod.GET, - thorest.blocks.get.BLOCK_DETAIL(revision), - { - query: buildQuery({ expanded: true }) - } - )) as ExpandedBlockDetail | null; - } - - /** - * Retrieves details of the latest block. - * - * @returns A promise that resolves to an object containing the compressed block details. - */ - public async getBestBlockCompressed(): Promise { - return await this.getBlockCompressed('best'); - } - - /** - * Retrieves details of the latest block. - * - * @returns A promise that resolves to an object containing the expanded block details. - */ - public async getBestBlockExpanded(): Promise { - return await this.getBlockExpanded('best'); - } - - /** - * Asynchronously retrieves a reference to the best block in the blockchain. - * - * This method first calls `getBestBlockCompressed()` to obtain the current best block. If no block is found (i.e., if `getBestBlockCompressed()` returns `null`), - * the method returns `null` indicating that there's no block to reference. Otherwise, it extracts and returns the first 18 characters of the - * block's ID, providing the ref to the best block. - * - * @returns {Promise} A promise that resolves to either a string representing the first 18 characters of the best block's ID, - * or `null` if no best block is found. - * - * @Example: - * const blockRef = await getBestBlockRef(); - * if (blockRef) { - * console.log(`Reference to the best block: ${blockRef}`); - * } else { - * console.log("No best block found."); - * } - */ - public async getBestBlockRef(): Promise { - const bestBlock = await this.getBestBlockCompressed(); - if (bestBlock === null) return null; - return bestBlock.id.slice(0, 18); - } - - /** - * Retrieves the finalized block. - * - * @returns A promise that resolves to an object containing the finalized block. - */ - public async getFinalBlockCompressed(): Promise { - return await this.getBlockCompressed('finalized'); - } - - /** - * Retrieves details of the finalized block. - * - * @returns A promise that resolves to an object containing the finalized block details. - */ - public async getFinalBlockExpanded(): Promise { - return await this.getBlockExpanded('finalized'); - } - - /** - * Synchronously waits for a specific block revision using polling. - * - * @param blockNumber - The block number to wait for. - * @param expanded - A boolean indicating whether to wait for an expanded block. - * @param options - (Optional) Allows to specify timeout and interval in milliseconds - * @returns A promise that resolves to an object containing the compressed block. - * @throws {InvalidDataType} - */ - private async _waitForBlock( - blockNumber: number, - expanded: boolean, - options?: WaitForBlockOptions - ): Promise { - if ( - blockNumber !== undefined && - blockNumber !== null && - blockNumber <= 0 - ) { - throw new InvalidDataType( - 'BlocksModule.waitForBlock()', - 'Invalid blockNumber. The blockNumber must be a number representing a block number.', - { blockNumber } - ); - } - - // Use the Poll.SyncPoll utility to repeatedly call getBestBlock with a specified interval - return await Poll.SyncPoll( - async () => - expanded - ? await this.getBestBlockCompressed() - : await this.getBestBlockExpanded(), - { - requestIntervalInMilliseconds: options?.intervalMs, - maximumWaitingTimeInMilliseconds: options?.timeoutMs - } - ).waitUntil((result) => { - // Continue polling until the result's block number matches the specified revision - return result != null && result?.number >= blockNumber; - }); - } - - /** - * Synchronously waits for a specific block revision using polling. - * - * @param blockNumber - The block number to wait for. - * @param options - (Optional) Allows to specify timeout and interval in milliseconds - * @returns A promise that resolves to an object containing the compressed block. - */ - public async waitForBlockCompressed( - blockNumber: number, - options?: WaitForBlockOptions - ): Promise { - return (await this._waitForBlock( - blockNumber, - false, - options - )) as CompressedBlockDetail | null; - } - - /** - * Synchronously waits for a specific expanded block revision using polling. - * - * @param blockNumber - The block number to wait for. - * @param options - (Optional) Allows to specify timeout and interval in milliseconds - * @returns A promise that resolves to an object containing the expanded block details. - */ - public async waitForBlockExpanded( - blockNumber: number, - options?: WaitForBlockOptions - ): Promise { - return (await this._waitForBlock( - blockNumber, - true, - options - )) as ExpandedBlockDetail | null; - } - - /** - * Returns the head block (best block). - * @returns {BlockDetail | null} The head block (best block). - */ - public getHeadBlock(): CompressedBlockDetail | null { - return this.headBlock; - } - - /** - * Retrieves details of the genesis block. - * - * @returns A promise that resolves to an object containing the block details of the genesis block. - */ - public async getGenesisBlock(): Promise { - return await this.getBlockCompressed(0); - } - - /** - * Retrieves all addresses involved in a given block. This includes beneficiary, signer, clauses, - * delegator, gas payer, origin, contract addresses, event addresses, and transfer recipients and senders. - * - * @param {ExpandedBlockDetail} block - The block object to extract addresses from. - * - * @returns {string[]} - An array of addresses involved in the block, included - * empty addresses, duplicate elements are removed. - * - */ - public getAllAddressesIntoABlock(block: ExpandedBlockDetail): string[] { - const addresses = new Set(); - addresses.add(block.beneficiary); - addresses.add(block.signer); - block.transactions.forEach( - (transaction: TransactionsExpandedBlockDetail) => { - transaction.clauses.forEach((clause: TransactionClause) => { - if (typeof clause.to === 'string') { - addresses.add(clause.to); - } - }); - addresses.add(transaction.delegator); - addresses.add(transaction.gasPayer); - addresses.add(transaction.origin); - transaction.outputs.forEach((output) => { - if (typeof output.contractAddress === 'string') { - addresses.add(output.contractAddress); - } - output.events.forEach((event) => { - addresses.add(event.address); - }); - output.transfers.forEach((transfer) => { - addresses.add(transfer.recipient); - addresses.add(transfer.sender); - }); - }); - } - ); - return Array.from(addresses); - } -} - -export { BlocksModule }; diff --git a/packages/network/src/thor-client/blocks/index.ts b/packages/network/src/thor-client/blocks/index.ts deleted file mode 100644 index bc56849a3..000000000 --- a/packages/network/src/thor-client/blocks/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type * from './types.d'; -export * from './blocks-module'; diff --git a/packages/network/src/thor-client/blocks/types.d.ts b/packages/network/src/thor-client/blocks/types.d.ts deleted file mode 100644 index 5e729acbb..000000000 --- a/packages/network/src/thor-client/blocks/types.d.ts +++ /dev/null @@ -1,275 +0,0 @@ -/* --- Input options start --- */ - -import { type Event, type Transfer } from '../logs'; -import { type TransactionClause } from '@vechain/sdk-core'; - -/** - * Input options for Blocks module. - */ -interface BlocksModuleOptions { - /** - * (Optional) Whether the polling is enabled. - */ - isPollingEnabled?: boolean; - /** - * (Optional) Callback function called when an error occurs. - */ - onBlockError?: (error: Error) => undefined; -} - -/** - * Options for `waitForBlockCompressed` and `waitForBlockExpanded` methods. - */ -interface WaitForBlockOptions { - /** - * Timeout in milliseconds. - * After this time, the method will throw an error. - */ - timeoutMs?: number; - /** - * Interval in milliseconds. - * The method will check the blocks status every `intervalMs` milliseconds. - */ - intervalMs?: number; -} - -/* --- Input options end --- */ - -/* --- Responses Outputs start --- */ - -/** - * BlockDetail is an interface representing detailed information about a blockchain block. - */ -interface BlockDetail { - /** - * Unique identifier for the block. - */ - id: string; - - /** - * Block number in the blockchain. - */ - number: number; - - /** - * Size of the block in bytes. - */ - size: number; - - /** - * Identifier of the parent block. - */ - parentID: string; - - /** - * Timestamp when the block was created. - */ - timestamp: number; - - /** - * Maximum gas limit for transactions in the block. - */ - gasLimit: number; - - /** - * Address of the beneficiary (miner) of the block. - */ - beneficiary: string; - - /** - * Total gas used by transactions in the block. - */ - gasUsed: number; - - /** - * Represents the Accumulated Witness Number (AWN) of the block. - * It is used when selecting the trunk block in the VeChainThor consensus algorithm. - * - * @link see [VeChainThor Trunk](https://docs.vechain.org/introduction-to-vechain/about-the-vechain-blockchain/consensus-deep-dive#meta-transaction-features-3) - */ - totalScore: number; - - /** - * Root hash of the transactions in the block. - */ - txsRoot: string; - - /** - * Optional features associated with transactions. - */ - txsFeatures?: number; - - /** - * Root hash of the state tree after applying transactions. - */ - stateRoot: string; - - /** - * Root hash of the receipts of transactions. - */ - receiptsRoot: string; - - /** - * Address of the signer or validator for the block. - */ - signer: string; - - /** - * Indicates if the block contains a community fund (com). - */ - com?: boolean; - - /** - * Indicates if the block is finalized (optional). - */ - isFinalized?: boolean; - - /** - * Since there is no computational competition in PoA, the “longest chain” rule does not apply. - * Instead, we consider the better branch as the one witnessed by more AMs (Authority Master nodes). - * - * @link see [VeChainThor Trunk](https://docs.vechain.org/introduction-to-vechain/about-the-vechain-blockchain/consensus-deep-dive#meta-transaction-features-3) - */ - isTrunk: boolean; -} - -/** - * Type for the compressed block detail. - * Here we have the transactions as an array of strings. - */ -interface CompressedBlockDetail extends BlockDetail { - transactions: string[]; -} - -/** - * Type for the expanded block detail. - * Here we have the transactions expanded with the details. - */ -interface ExpandedBlockDetail extends BlockDetail { - transactions: TransactionsExpandedBlockDetail[]; -} - -/** - * Output represents the result or consequence of a blockchain transaction. - */ -interface Output { - /** - * address of the contract involved in the clause output. - */ - contractAddress: string | null; - /** - * Events emitted by executing the clause. - */ - events: Event[]; - /** - * Transfers of VET or VIP180 tokens that occur from the clause. - */ - transfers: Transfer[]; -} - -/** - * TransactionsExpandedBlockDetail is an interface representing detailed information about transactions in a blockchain block. - */ -interface TransactionsExpandedBlockDetail { - /** - * Unique identifier for the transaction. - */ - id: string; - - /** - * Chain tag of the blockchain. - */ - chainTag: string; - - /** - * Reference to the block. - */ - blockRef: string; - - /** - * Expiration timestamp of the transaction. - */ - expiration: number; - - /** - * Clauses represent the individual conditions or terms in a blockchain transaction. - */ - clauses: TransactionClause[]; - - /** - * Gas price coefficient for the transaction. - */ - gasPriceCoef: number; - - /** - * Gas limit for the transaction. - */ - gas: number; - - /** - * Origin (sender) of the transaction. - */ - origin: string; - - /** - * Delegator associated with the transaction. - */ - delegator: string; - - /** - * Nonce value for preventing replay attacks. - */ - nonce: string; - - /** - * Transaction dependency. - */ - dependsOn: string; - - /** - * Size of the transaction in bytes. - */ - size: number; - - /** - * Gas used by the transaction. - */ - gasUsed: number; - - /** - * Account paying for the gas. - */ - gasPayer: string; - - /** - * Amount paid for the transaction. - */ - paid: string; - - /** - * Reward associated with the transaction. - */ - reward: string; - - /** - * Indicates if the transaction is reverted. - */ - reverted: boolean; - - /** - * Outputs represent the results or consequences of a blockchain transaction. - */ - outputs: Output[]; -} - -/* --- Responses Outputs end --- */ - -export { - type BlocksModuleOptions, - type BlockDetail, - type CompressedBlockDetail, - type ExpandedBlockDetail, - type TransactionsExpandedBlockDetail, - type Output, - type WaitForBlockOptions -}; diff --git a/packages/network/src/thor-client/contracts/contracts-module.ts b/packages/network/src/thor-client/contracts/contracts-module.ts deleted file mode 100644 index 2cf2c3007..000000000 --- a/packages/network/src/thor-client/contracts/contracts-module.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { type ABIFunction } from '@vechain/sdk-core'; -import { type Abi } from 'abitype'; -import { type VeChainSigner } from '../../signer/signers/types'; -import { - type SendTransactionResult, - type SimulateTransactionOptions -} from '../transactions/types'; -import { Contract, ContractFactory } from './model'; -import type { - ContractCallOptions, - ContractCallResult, - ContractClause, - ContractTransactionOptions -} from './types'; -import { type TransactionsModule } from '../transactions'; - -/** - * Represents a module for interacting with smart contracts on the blockchain. - */ -class ContractsModule { - constructor(readonly transactionsModule: TransactionsModule) {} - - /** - * Creates a new instance of `ContractFactory` configured with the specified ABI, bytecode, and signer. - * This factory is used to deploy new smart contracts to the blockchain network managed by this instance. - * - * @param abi - The Application Binary Interface (ABI) of the contract, which defines the contract's methods and events. - * @param bytecode - The compiled bytecode of the contract, representing the contract's executable code. - * @param signer - The signer used for signing transactions during contract deployment, ensuring the deployer's identity. - * @returns An instance of `ContractFactory` configured with the provided ABI, bytecode, and signer, ready for deploying contracts. - */ - public createContractFactory( - abi: TAbi, - bytecode: string, - signer: VeChainSigner - ): ContractFactory { - return new ContractFactory(abi, bytecode, signer, this); - } - - /** - * Initializes and returns a new Contract instance with the provided parameters. - * - * @param address - The blockchain address of the contract to load. - * @param abi - The Application Binary Interface (ABI) of the contract, which defines the contract's methods and structures. - * @param signer - Optional. The signer caller, used for signing transactions when interacting with the contract. - * @returns A new instance of the Contract, initialized with the provided address, ABI, and optionally, a signer. - */ - public load( - address: string, - abi: Tabi, - signer?: VeChainSigner - ): Contract { - return new Contract(address, abi, this, signer); - } - - /** - * This method is going to be deprecated in next release. - * Use {@link TransactionsModule.executeCall} instead. - */ - public async executeCall( - contractAddress: string, - functionAbi: ABIFunction, - functionData: unknown[], - contractCallOptions?: ContractCallOptions - ): Promise { - return await this.transactionsModule.executeCall( - contractAddress, - functionAbi, - functionData, - contractCallOptions - ); - } - - /** - * This method is going to be deprecated in the next release. - * Use {@link TransactionsModule.executeMultipleClausesCall} next. - */ - public async executeMultipleClausesCall( - clauses: ContractClause[], - options?: SimulateTransactionOptions - ): Promise { - return await this.transactionsModule.executeMultipleClausesCall( - clauses, - options - ); - } - - /** - * This method is going to be deprecated in the next release. - * Use {@link TransactionsModule.executeTransaction} instead. - */ - public async executeTransaction( - signer: VeChainSigner, - contractAddress: string, - functionAbi: ABIFunction, - functionData: unknown[], - options?: ContractTransactionOptions - ): Promise { - return await this.transactionsModule.executeTransaction( - signer, - contractAddress, - functionAbi, - functionData, - options - ); - } - - /** - * This method is going to be deprected in the next release. - * Use {@link TransactionsModule.executeMultipleClausesTransaction} instead. - */ - public async executeMultipleClausesTransaction( - clauses: ContractClause[], - signer: VeChainSigner, - options?: ContractTransactionOptions - ): Promise { - return await this.transactionsModule.executeMultipleClausesTransaction( - clauses, - signer, - options - ); - } - - /** - * This method is going to be deprecated in the next release. - * Use {@link TransactionsModule.getBaseGasPrice} instead. - */ - public async getBaseGasPrice(): Promise { - return await this.transactionsModule.getBaseGasPrice(); - } -} - -export { ContractsModule }; diff --git a/packages/network/src/thor-client/contracts/index.ts b/packages/network/src/thor-client/contracts/index.ts deleted file mode 100644 index 7e257df32..000000000 --- a/packages/network/src/thor-client/contracts/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './contracts-module'; -export type * from './types.d'; -export * from './model'; diff --git a/packages/network/src/thor-client/contracts/model/contract-factory.ts b/packages/network/src/thor-client/contracts/model/contract-factory.ts deleted file mode 100644 index 5ab91655b..000000000 --- a/packages/network/src/thor-client/contracts/model/contract-factory.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { - Clause, - HexUInt, - Transaction, - type DeployParams, - type TransactionClause -} from '@vechain/sdk-core'; -import { - CannotFindTransaction, - ContractDeploymentFailed -} from '@vechain/sdk-errors'; -import { type Abi } from 'abitype'; -import { signerUtils, type VeChainSigner } from '../../../signer'; -import { type SendTransactionResult } from '../../transactions/types'; -import type { ContractTransactionOptions } from '../types'; -import { Contract } from './contract'; -import { type ContractsModule } from '../contracts-module'; - -/** - * A factory class for deploying smart contracts to a blockchain using a ThorClient. - */ -class ContractFactory { - /** - * The ABI (Application Binary Interface) of the contract. - */ - private readonly abi: Abi; - - /** - * The bytecode of the smart contract. - */ - private readonly bytecode: string; - - /** - * The signer used for signing transactions. - */ - private readonly signer: VeChainSigner; - - /** - * The result of the deployment transaction, undefined until a deployment is started. - */ - private deployTransaction: SendTransactionResult | undefined; - - readonly contractsModule: ContractsModule; - - /** - * Initializes a new instance of the `ContractFactory` class. - * @param abi The Application Binary Interface (ABI) of the contract, which defines the contract's methods and events. - * @param bytecode The compiled bytecode of the contract, representing the contract's executable code. - * @param signer The signer used for signing transactions during contract deployment, ensuring the deployer's identity. - * @param contractsModule An instance of the module to interact with the blockchain. - */ - constructor( - abi: Abi, - bytecode: string, - signer: VeChainSigner, - contractsModule: ContractsModule - ) { - this.abi = abi; - this.bytecode = bytecode; - this.signer = signer; - this.contractsModule = contractsModule; - } - - /** - * Initiates the deployment of a smart contract. - * - * This method performs several steps to deploy a smart contract: - * 1. Builds a transaction clause for deploying the contract. - * 2. Estimates the gas cost required for the transaction. - * 3. Constructs the transaction body with the estimated gas cost. - * 4. Signs the transaction using the provided signer. - * 5. Sends the signed transaction to the blockchain. - * - * @param {DeployParams?} deployParams (Optional) parameters for contract deployment. - * @param {ContractTransactionOptions?} options (Optional) transaction options, such as gas limit. - * @returns {Promise} A promise that resolves to the instance of `ContractFactory`, - * allowing for fluent chaining of further actions or queries. - * @throws {Error} Throws an error if any step in the deployment process fails. - */ - public async startDeployment( - deployParams?: DeployParams, - options?: ContractTransactionOptions - ): Promise> { - // Build a transaction for deploying the smart contract - - const deployContractClause = Clause.deployContract( - HexUInt.of(this.bytecode), - deployParams - ) as TransactionClause; - - // Estimate the gas cost of the transaction - const gasResult = - await this.contractsModule.transactionsModule.estimateGas( - [deployContractClause], - await this.signer.getAddress() - ); - - const txBody = - await this.contractsModule.transactionsModule.buildTransactionBody( - [deployContractClause], - gasResult.totalGas, - options - ); - - // Sign the transaction - const signedTx = await this.signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - await this.signer.getAddress() - ) - ); - - // Send the signed transaction to the blockchain - this.deployTransaction = - await this.contractsModule.transactionsModule.sendTransaction( - Transaction.decode(HexUInt.of(signedTx.slice(2)).bytes, true) - ); - - return this; - } - - /** - * Waits for the completion of a contract deployment transaction. - * - * This method checks for the presence of a deployed transaction result and then - * waits for the transaction to be processed. Upon successful processing, it - * constructs and returns a new `Contract` instance based on the transaction receipt. - * - * @returns {Promise} A promise that resolves to a `Contract` instance - * once the deployment transaction is completed. - * @throws {CannotFindTransaction, ContractDeploymentFailed} - */ - public async waitForDeployment(): Promise> { - // Check if the deploy transaction result is available - if (this.deployTransaction?.id === undefined) { - throw new CannotFindTransaction( - 'ContractFactory.waitForDeployment()', - 'Cannot find a contract deployment transaction', - { - networkUrl: - this.contractsModule.transactionsModule.blocksModule - .httpClient.baseURL - } - ); - } - - // Wait for the transaction to be processed - const transactionReceipt = await this.deployTransaction.wait(); - - // Ensure that the transaction receipt is valid - if ( - transactionReceipt?.outputs[0]?.contractAddress === null || - transactionReceipt?.outputs[0]?.contractAddress === undefined - ) { - throw new ContractDeploymentFailed( - 'ContractFactory.waitForDeployment()', - 'Contract deployment failed.', - { - deployTransaction: this.deployTransaction - } - ); - } - - // Construct and return a new Contract instance - return new Contract( - transactionReceipt?.outputs[0].contractAddress, - this.abi, - this.contractsModule, - this.signer, - transactionReceipt - ); - } - - /** - * Returns the deploy transaction result, if available. - */ - public getDeployTransaction(): SendTransactionResult | undefined { - return this.deployTransaction; - } -} - -export { ContractFactory }; diff --git a/packages/network/src/thor-client/contracts/model/contract-filter.ts b/packages/network/src/thor-client/contracts/model/contract-filter.ts deleted file mode 100644 index 4e19febd6..000000000 --- a/packages/network/src/thor-client/contracts/model/contract-filter.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type { - EventLogs, - FilterCriteria, - FilterEventLogsOptions -} from '../../logs'; -import { type Contract } from './contract'; -import { type Abi } from 'abitype'; -import { type TransferFilterOptions } from './types'; - -/** - * Represents a filter for events emitted by a smart contract. This class allows for the specification of criteria to filter - * events and provides a method to fetch event logs based on those criteria. - */ -class ContractFilter { - /** - * The smart contract instance to apply the filter on. - */ - public contract: Contract; - /** - * A set of criteria used to filter events. - */ - public criteriaSet: FilterCriteria[]; - - /** - * Constructs an instance of the `ContractFilter` class. - * - * @param contract - The smart contract instance to apply the filter on. - * @param criteriaSet - A set of criteria used to filter events. - */ - constructor(contract: Contract, criteriaSet: FilterCriteria[]) { - this.contract = contract; - this.criteriaSet = criteriaSet; - } - - /** - * Retrieves event logs based on the specified filter criteria, range, pagination options, and order. - * - * @returns An array of event logs that match the specified criteria. - * @param param - The filter options to apply to the event logs. - */ - public async get(param?: TransferFilterOptions): Promise { - const filterEventLogsOptions: FilterEventLogsOptions = { - range: param?.range ?? { - unit: 'block', - from: 0, - to: ( - await this.contract.contractsModule.transactionsModule.blocksModule.getBestBlockCompressed() - )?.number - }, - criteriaSet: this.criteriaSet, - options: param?.options, - order: param?.order ?? 'asc' - }; - return await this.contract.contractsModule.transactionsModule.logsModule.filterEventLogs( - filterEventLogsOptions - ); - } -} -export { ContractFilter }; diff --git a/packages/network/src/thor-client/contracts/model/contract-proxy.ts b/packages/network/src/thor-client/contracts/model/contract-proxy.ts deleted file mode 100644 index c5aace08b..000000000 --- a/packages/network/src/thor-client/contracts/model/contract-proxy.ts +++ /dev/null @@ -1,396 +0,0 @@ -import { - Address, - Clause, - type TransactionClause, - Units, - VET -} from '@vechain/sdk-core'; -import { - ContractCallError, - InvalidTransactionField -} from '@vechain/sdk-errors'; -import type { - Abi, - AbiParametersToPrimitiveTypes, - ExtractAbiEventNames, - ExtractAbiFunction, - ExtractAbiFunctionNames -} from 'abitype'; -import { type VeChainSigner } from '../../../signer'; -import { type FilterCriteria } from '../../logs'; -import { type SendTransactionResult } from '../../transactions/types'; -import { type ContractClause } from '../types'; -import { type Contract } from './contract'; -import { ContractFilter } from './contract-filter'; -import { - type ClauseAdditionalOptions, - type ClauseComment, - type ClauseRevision, - type ContractFunctionClause, - type ContractFunctionCriteria, - type ContractFunctionFilter, - type ContractFunctionRead, - type ContractFunctionTransact, - type TransactionValue -} from './types'; - -/** - * Creates a Proxy object for reading contract state, allowing for the dynamic invocation of contract read operations. - * @param contract - The contract instance to create the read proxy for. - * @returns A Proxy that intercepts calls to read contract functions, automatically handling the invocation with the configured options. - */ -function getReadProxy( - contract: Contract -): ContractFunctionRead> { - return new Proxy(contract.read, { - get: (_target, prop) => { - // Otherwise, assume that the function is a contract method - return async ( - ...args: AbiParametersToPrimitiveTypes< - ExtractAbiFunction['inputs'], - 'inputs' - > - ): Promise => { - // check if the clause comment is provided as an argument - - const extractOptionsResult = extractAndRemoveAdditionalOptions( - args as unknown[] - ); - - const clauseComment = - extractOptionsResult.clauseAdditionalOptions?.comment; - - const revisionValue = - extractOptionsResult.clauseAdditionalOptions?.revision; - - const functionAbi = contract.getFunctionAbi(prop); - - const executeCallResult = - await contract.contractsModule.executeCall( - contract.address, - functionAbi, - extractOptionsResult.args, - { - caller: - contract.getSigner() !== undefined - ? await contract.getSigner()?.getAddress() - : undefined, - ...contract.getContractReadOptions(), - comment: clauseComment, - revision: revisionValue, - includeABI: true - } - ); - - if (!executeCallResult.success) { - throw new ContractCallError( - functionAbi.stringSignature, - executeCallResult.result.errorMessage as string, - { - contractAddress: contract.address - } - ); - } - return executeCallResult.result.array as unknown[]; - }; - } - }); -} - -/** - * Creates a Proxy object for transacting with contract functions, allowing for the dynamic invocation of contract transaction operations. - * @param contract - The contract instance - * @returns A Proxy that intercepts calls to transaction contract functions, automatically handling the invocation with the configured options. - * @throws {InvalidTransactionField} - * @private - */ -function getTransactProxy( - contract: Contract -): ContractFunctionTransact< - TAbi, - ExtractAbiFunctionNames -> { - return new Proxy(contract.transact, { - get: (_target, prop) => { - // Otherwise, assume that the function is a contract method - return async ( - ...args: unknown[] - ): Promise => { - if (contract.getSigner() === undefined) { - throw new InvalidTransactionField( - 'getTransactProxy()', - 'Caller signer is required to transact with the contract.', - { fieldName: 'signer', prop } - ); - } - - // get the transaction options for the contract - const transactionOptions = - contract.getContractTransactOptions(); - - // check if the transaction value is provided as an argument - - const extractAdditionalOptionsResult = - extractAndRemoveAdditionalOptions(args); - - const transactionValue = - extractAdditionalOptionsResult.clauseAdditionalOptions - ?.value; - - const clauseComment = - extractAdditionalOptionsResult.clauseAdditionalOptions - ?.comment; - - args = extractAdditionalOptionsResult.args; - - return await contract.contractsModule.executeTransaction( - contract.getSigner() as VeChainSigner, - contract.address, - contract.getFunctionAbi(prop), - args, - { - ...transactionOptions, - value: - transactionOptions.value ?? transactionValue ?? 0, - comment: clauseComment, - includeABI: true - } - ); - }; - } - }); -} - -/** - * Creates a Proxy object for filtering contract events, allowing for the dynamic invocation of contract event filtering operations. - * @param contract - The contract instance to create the filter proxy for. - * @returns A Proxy that intercepts calls to filter contract events, automatically handling the invocation with the configured options. - */ -function getFilterProxy( - contract: Contract -): ContractFunctionFilter> { - return new Proxy(contract.filters, { - get: (_target, prop) => { - return ( - // eslint-disable-next-line sonarjs/use-type-alias - args: Record | unknown[] | undefined - ): ContractFilter => { - const criteriaSet = buildCriteria(contract, prop, args); - - return new ContractFilter(contract, [criteriaSet]); - }; - } - }); -} - -/** - * Creates a Proxy object for interacting with contract functions, allowing for the dynamic invocation of contract functions. - * @param contract - The contract instance to create the clause proxy for. - * @returns A Proxy that intercepts calls to contract functions, automatically handling the invocation with the configured options. - */ -function getClauseProxy( - contract: Contract -): ContractFunctionClause> { - return new Proxy(contract.clause, { - get: (_target, prop) => { - return (...args: unknown[]): ContractClause => { - // get the transaction options for the contract - const transactionOptions = - contract.getContractTransactOptions(); - - // check if the transaction value is provided as an argument - const extractAdditionalOptionsResult = - extractAndRemoveAdditionalOptions(args); - - const transactionValue = - extractAdditionalOptionsResult.clauseAdditionalOptions - ?.value; - - const clauseComment = - extractAdditionalOptionsResult.clauseAdditionalOptions - ?.comment; - - args = extractAdditionalOptionsResult.args; - - // return the contract clause - return { - clause: Clause.callFunction( - Address.of(contract.address), - contract.getFunctionAbi(prop), - args, - VET.of( - transactionOptions.value ?? transactionValue ?? 0, - Units.wei - ), - { - comment: clauseComment, - includeABI: true - } - ) as TransactionClause, - functionAbi: contract.getFunctionAbi(prop) - }; - }; - } - }); -} - -/** - * Create a proxy object for building event criteria for the event filtering. - * @param contract - The contract instance to create the criteria proxy for. - * @returns A Proxy that intercepts calls to build event criteria, automatically handling the invocation with the configured options. - */ -function getCriteriaProxy( - contract: Contract -): ContractFunctionCriteria> { - return new Proxy(contract.criteria, { - get: (_target, prop) => { - return ( - args: Record | unknown[] | undefined - ): FilterCriteria => { - return buildCriteria(contract, prop, args); - }; - } - }); -} - -/** - * Builds the filter criteria for the contract filter. - * @param contract - The contract instance to create the criteria for. - * @param prop - The property name of the contract event. - * @param args - The arguments to filter the event. - * @returns The event criteria for the contract filter. - */ -function buildCriteria( - contract: Contract, - prop: string | symbol, - args: Record | unknown[] | undefined -): FilterCriteria { - // Create the VeChain sdk event ABI - const eventAbi = contract.getEventAbi(prop); - - // Create a map of encoded filter topics for the event - const topics = new Map( - eventAbi - .encodeFilterTopicsNoNull(args) - .map((topic, index) => [index, topic]) - ); - - // Create the criteria set for the contract filter - return { - criteria: { - address: contract.address, - topic0: topics.get(0) as string, // the first topic is always defined since it's the event signature - topic1: topics.has(1) ? topics.get(1) : undefined, - topic2: topics.has(2) ? topics.get(2) : undefined, - topic3: topics.has(3) ? topics.get(3) : undefined, - topic4: topics.has(4) ? topics.get(4) : undefined - }, - eventAbi - }; -} - -/** - * Extracts the transaction value and comment from the list of arguments, if present. - * @param args - The list of arguments to search for the transaction value. - * @returns The transaction value and comment object, if found in the arguments list. Also returns the list of arguments with the clause options removed. - */ -function extractAndRemoveAdditionalOptions(args: unknown[]): { - args: unknown[]; - clauseAdditionalOptions: ClauseAdditionalOptions | undefined; -} { - // check if the transaction value is provided as an argument - const transactionValue = getTransactionValue(args); - const clauseComment = getClauseComment(args); - const clauseRevision = getRevision(args); - - // if present remove the transaction value argument from the list of arguments - if ( - transactionValue !== undefined || - clauseComment !== undefined || - clauseRevision !== undefined - ) { - args = args.filter( - (arg) => - !( - isTransactionValue(arg) || - isTransactionComment(arg) || - isRevision(arg) - ) - ); - } - - return { - args, - clauseAdditionalOptions: { - value: transactionValue?.value, - comment: clauseComment?.comment, - revision: clauseRevision?.revision - } - }; -} - -/** - * Extracts the transaction value from the list of arguments, if present. - * @param args - The list of arguments to search for the transaction value. - * @returns The transaction value object, if found in the arguments list. - */ -function getTransactionValue(args: unknown[]): TransactionValue | undefined { - return args.find((arg) => isTransactionValue(arg)) as - | TransactionValue - | undefined; -} - -/** - * Extracts the clause comment from the list of arguments, if present. - * @param args - The list of arguments to search for the clause comment. - * @returns The clause comment object, if found in the arguments list. - */ -function getClauseComment(args: unknown[]): ClauseComment | undefined { - return args.find((arg) => isTransactionComment(arg)) as - | ClauseComment - | undefined; -} - -/** - * Extracts the revision from the list of arguments, if present. - * @param args - The list of arguments to search for the revision. - * @returns The revision object, if found in the arguments list. - */ -function getRevision(args: unknown[]): ClauseRevision | undefined { - return args.find((arg) => isRevision(arg)) as ClauseRevision | undefined; -} - -/** - * Type guard function to check if an object is a TransactionValue. - * @param obj - The object to check. - * @returns True if the object is a TransactionValue, false otherwise. - */ -function isTransactionValue(obj: unknown): obj is ClauseAdditionalOptions { - return (obj as ClauseAdditionalOptions).value !== undefined; -} - -/** - * Type guard function to check if an object is a ClauseComment. - * @param obj - The object to check. - * @returns True if the object is a ClauseComment, false otherwise. - */ -function isTransactionComment(obj: unknown): obj is ClauseAdditionalOptions { - return (obj as ClauseAdditionalOptions).comment !== undefined; -} - -/** - * Type guard function to check if an object is a revision. - * @param obj - The object to check. - * @returns True if the object is a revision, false otherwise. - */ -function isRevision(obj: unknown): obj is ClauseAdditionalOptions { - return (obj as ClauseAdditionalOptions).revision !== undefined; -} - -export { - getClauseProxy, - getCriteriaProxy, - getFilterProxy, - getReadProxy, - getTransactProxy -}; diff --git a/packages/network/src/thor-client/contracts/model/contract.ts b/packages/network/src/thor-client/contracts/model/contract.ts deleted file mode 100644 index 73dc5c898..000000000 --- a/packages/network/src/thor-client/contracts/model/contract.ts +++ /dev/null @@ -1,210 +0,0 @@ -import { - ABIContract, - type ABIEvent, - type ABIFunction -} from '@vechain/sdk-core'; -import { - type Abi, - type ExtractAbiEventNames, - type ExtractAbiFunctionNames -} from 'abitype'; -import { type VeChainSigner } from '../../../signer'; -import type { TransactionReceipt } from '../../transactions/types'; -import type { ContractCallOptions, ContractTransactionOptions } from '../types'; -import { - getClauseProxy, - getCriteriaProxy, - getFilterProxy, - getReadProxy, - getTransactProxy -} from './contract-proxy'; -import { - type ContractFunctionClause, - type ContractFunctionCriteria, - type ContractFunctionFilter, - type ContractFunctionRead, - type ContractFunctionTransact -} from './types'; -import { type ContractsModule } from '../contracts-module'; - -/** - * A class representing a smart contract deployed on the blockchain. - */ -class Contract { - readonly contractsModule: ContractsModule; - readonly address: string; - readonly abi: Abi; - private signer?: VeChainSigner; - - readonly deployTransactionReceipt: TransactionReceipt | undefined; - - public read: ContractFunctionRead< - TAbi, - ExtractAbiFunctionNames - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - > = {} as ContractFunctionRead< - TAbi, - ExtractAbiFunctionNames - >; - - public transact: ContractFunctionTransact< - TAbi, - ExtractAbiFunctionNames - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - > = {} as ContractFunctionTransact< - TAbi, - ExtractAbiFunctionNames - >; - - public filters: ContractFunctionFilter> = - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - {} as ContractFunctionFilter>; - - public clause: ContractFunctionClause< - TAbi, - ExtractAbiFunctionNames - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - > = {} as ContractFunctionClause>; - - public criteria: ContractFunctionCriteria< - TAbi, - ExtractAbiEventNames - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - > = {} as ContractFunctionCriteria>; - - private contractCallOptions: ContractCallOptions = {}; - private contractTransactionOptions: ContractTransactionOptions = {}; - - /** - * Initializes a new instance of the `Contract` class. - * @param address The address of the contract. - * @param abi The Application Binary Interface (ABI) of the contract, which defines the contract's methods and events. - * @param thor An instance of ThorClient to interact with the blockchain. - * @param signer The signer caller used for signing transactions. - * @param transactionReceipt (Optional) The transaction receipt of the contract deployment. - */ - constructor( - address: string, - abi: Abi, - contractsModule: ContractsModule, - signer?: VeChainSigner, - transactionReceipt?: TransactionReceipt - ) { - this.abi = abi; - this.address = address; - this.contractsModule = contractsModule; - this.deployTransactionReceipt = transactionReceipt; - this.signer = signer; - this.read = getReadProxy(this); - this.transact = getTransactProxy(this); - this.filters = getFilterProxy(this); - this.clause = getClauseProxy(this); - this.criteria = getCriteriaProxy(this); - } - - /** - * Sets the options for contract calls. - * @param options - The contract call options to set. - * @returns The updated contract call options. - */ - public setContractReadOptions( - options: ContractCallOptions - ): ContractCallOptions { - this.contractCallOptions = options; - - // initialize the proxy with the new options - this.read = getReadProxy(this); - return this.contractCallOptions; - } - - /** - * Clears the current contract call options, resetting them to an empty object. - * @returns The updated contract call options. - */ - public getContractReadOptions(): ContractCallOptions { - return this.contractCallOptions; - } - - /** - * Clears the current contract call options, resetting them to an empty object. - */ - public clearContractReadOptions(): void { - this.contractCallOptions = {}; - this.read = getReadProxy(this); - } - - /** - * Sets the options for contract transactions. - * @param options - The contract transaction options to set. - * @returns The updated contract transaction options. - */ - public setContractTransactOptions( - options: ContractTransactionOptions - ): ContractTransactionOptions { - this.contractTransactionOptions = options; - - // initialize the proxy with the new options - this.transact = getTransactProxy(this); - return this.contractTransactionOptions; - } - - /** - * Retrieves the options for contract transactions. - * @returns The contract transaction options. - */ - public getContractTransactOptions(): ContractTransactionOptions { - return this.contractTransactionOptions; - } - - /** - * Clears the current contract transaction options, resetting them to an empty object. - */ - public clearContractTransactOptions(): void { - this.contractTransactionOptions = {}; - this.transact = getTransactProxy(this); - } - - /** - * Sets the private key of the caller for signing transactions. - * @param signer - The caller signer - */ - public setSigner(signer: VeChainSigner): VeChainSigner { - this.signer = signer; - - // initialize the proxy with the new signer - this.transact = getTransactProxy(this); - this.read = getReadProxy(this); - return this.signer; - } - - /** - * Get the caller signer used for signing transactions. - * @returns The signer used for signing transactions. - */ - public getSigner(): VeChainSigner | undefined { - return this.signer; - } - - /** - * Retrieves the function ABI for the specified function name. - * @param prop - The name of the function. - * @return The function ABI for the specified event name. - * @throws {InvalidAbiItem} - * - */ - public getFunctionAbi(prop: string | symbol): ABIFunction { - return ABIContract.ofAbi(this.abi).getFunction(prop.toString()); - } - - /** - * Retrieves the event ABI for the specified event name. - * @param eventName - The name of the event. - * @return The event ABI for the specified event name. - * @throws {InvalidAbiItem} - */ - public getEventAbi(eventName: string | symbol): ABIEvent { - return ABIContract.ofAbi(this.abi).getEvent(eventName.toString()); - } -} - -export { Contract }; diff --git a/packages/network/src/thor-client/contracts/model/index.ts b/packages/network/src/thor-client/contracts/model/index.ts deleted file mode 100644 index fca993f88..000000000 --- a/packages/network/src/thor-client/contracts/model/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { ContractFactory } from './contract-factory'; -export { Contract } from './contract'; -export type { ContractFunctionAsync } from './types'; diff --git a/packages/network/src/thor-client/contracts/model/types.d.ts b/packages/network/src/thor-client/contracts/model/types.d.ts deleted file mode 100644 index 58d2aafa3..000000000 --- a/packages/network/src/thor-client/contracts/model/types.d.ts +++ /dev/null @@ -1,234 +0,0 @@ -import type { ContractClause } from '../types'; -import type { SendTransactionResult } from '../../transactions/types'; -import { type ContractFilter } from './contract-filter'; -import type { - FilterCriteria, - Range, - PaginationOptions, - EventDisplayOrder -} from '../../logs'; -import { - type Abi, - type ExtractAbiFunctionNames, - type ExtractAbiFunction, - type AbiParametersToPrimitiveTypes, - type AbiFunction, - type ExtractAbiEvent -} from 'abitype'; -import { type GetEventArgs } from 'viem'; - -/** - * Represents a generic contract function type that accepts an arbitrary number of arguments - * and returns a value of generic type `T`. This type is typically used to model the behavior of - * smart contract functions in a blockchain context. - * - * @typeParam T - The expected return type of the function. Defaults to `unknown` if not specified. - * @param args - An array of arguments that the contract function accepts. The types of these arguments - * are not specified, allowing for flexibility in function signatures. - * @returns A value of type `T`, representing the result of the contract function execution. - */ -type ContractFunctionSync = ( - ...args: [ - ...Partial<{ value: number; comment: string }>, - ...AbiParametersToPrimitiveTypes - ] -) => T; - -/** - * Defines a synchronous function type for handling contract events. - * - * @template T - The return type of the contract event function. Defaults to `unknown`. - * @template TAbiEvent - The ABI event type for the contract event. - * - * This type represents a function that takes a variable number of arguments, which are partial - * representations of the input parameters defined in the ABI for the event, and returns a value of type `T`. - */ -type ContractEventSync = ( - ...args: Partial< - AbiParametersToPrimitiveTypes - > -) => T; - -/** - * Represents a generic contract function type that accepts an arbitrary number of arguments - * and returns a promise that resolves to a generic type `T`. This type is typically used to - * model the behavior of smart contract functions in a blockchain context. - * - * @typeParam T - The expected return type of the promise. Defaults to `unknown` if not specified. - * @param args - An array of arguments that the contract function accepts. The types of these arguments - * are not specified, allowing for flexibility in function signatures. - * @returns A promise that resolves to the type `T`, representing the result of the contract function execution. - */ -type ContractFunctionAsync = ( - ...args: [ - ...Partial<{ value: number; comment: string }>, - ...AbiParametersToPrimitiveTypes - ] -) => Promise; - -/** - * Defines a mapping of contract function names to their corresponding read-only contract functions. - * Each function in this record is expected to return a `Promise` that resolves to `ContractCallResult`, - * which should encapsulate the result of a read-only contract call. - * - * The keys of this record represent the names of the contract functions, and the values are the contract - * functions themselves, adhering to the `ContractFunctionAsync` type with `ContractCallResult` as the return type. - * - * @template TAbi - The ABI of the contract which includes the contract functions. - * @template TFunctionName - The names of the contract functions extracted from the ABI that are either 'pure' or 'view'. - * @template TAbiFunction - The contract function extracted from the ABI based on the function name. - */ -type ContractFunctionRead< - TAbi extends Abi, - TFunctionName extends ExtractAbiFunctionNames, - TAbiFunction extends AbiFunction = ExtractAbiFunction -> = Record< - TFunctionName, - ContractFunctionAsync< - AbiParametersToPrimitiveTypes, - TAbiFunction - > ->; - -/** - * Defines a mapping of contract function names to their corresponding transactional contract functions. - * Each function in this record is expected to return a `Promise` that resolves to `SendTransactionResult`, - * which should encapsulate the result of a transactional contract call (e.g., modifying state on the blockchain). - * - * The keys of this record represent the names of the contract functions, and the values are the contract - * functions themselves, adhering to the `ContractFunctionAsync` type with `SendTransactionResult` as the return type. - * - * @template TAbi - The ABI of the contract which includes the contract functions. - * @template TFunctionName - The names of the contract functions extracted from the ABI that are either 'payable' or 'nonpayable'. - * @template TAbiFunction - The contract function extracted from the ABI based on the function name. - */ -type ContractFunctionTransact< - TAbi extends Abi, - TFunctionName extends ExtractAbiFunctionNames< - TAbi, - 'payable' | 'non payable' - >, - TAbiFunction extends AbiFunction = ExtractAbiFunction -> = Record< - TFunctionName, - ContractFunctionAsync ->; - -/** - * Defines a mapping of contract event names to their corresponding filter criteria contract functions. - * Each function in this record is expected to return a value of type `ContractFilter`, which represents - * a filter that can be used to query events emitted by the contract. - * The keys of this record represent the names of the contract events, and the values are the contract - * functions themselves. - * @template TAbi - The ABI (Application Binary Interface) of the contract. - * @template TEventNames - The names of the events extracted from the ABI. - * @template TAbiEvent - The event type extracted from the ABI for a given event name. - */ -type ContractFunctionFilter< - TAbi extends Abi, - TEventNames extends string, - TABIEvent extends AbiFunction = ExtractAbiEvent -> = { - [K in TEventNames]: ( - args?: - | GetEventArgs - | Partial< - AbiParametersToPrimitiveTypes - > - ) => ContractFilter; -}; -/** - * Defines a mapping of contract function names to their corresponding transactional contract functions. - * Each function in this record is expected to return a value of type `TransactionClause`, which represents - * a transaction clause that can be used to interact with the contract. - * - * The keys of this record represent the names of the contract functions, and the values are the contract - * functions themselves, adhering to the `ContractFunctionSync` type with `ContractClause` as the return type. - * - * @template TAbi - The ABI (Application Binary Interface) of the contract. - * @template TFunctionName - The names of the functions extracted from the ABI, restricted to 'pure' or 'view' functions. - * @template TAbiFunction - The function type extracted from the ABI for a given function name. - */ -type ContractFunctionClause< - TAbi extends Abi, - TFunctionName extends ExtractAbiFunctionNames, - TAbiFunction extends AbiFunction = ExtractAbiFunction -> = Record>; - -/** - * Defines a mapping of contract event names to their corresponding filter criteria contract functions. - * Each function in this record is expected to return a value of type `FilterCriteria`, which represents - * a filter that can be used to query events emitted by the contract. - * The keys of this record represent the names of the contract events, and the values are the contract - * functions themselves. - * @template TAbi - The ABI (Application Binary Interface) of the contract. - * @template TEventNames - The names of the events extracted from the ABI. - * @template TABIEvent - The event type extracted from the ABI for a given event name. - */ -type ContractFunctionCriteria< - TAbi extends Abi, - TEventNames extends string, - TABIEvent extends AbiFunction = ExtractAbiEvent -> = { - [K in TEventNames]: ( - args?: - | GetEventArgs - | Partial< - AbiParametersToPrimitiveTypes - > - ) => FilterCriteria; -}; - -/** - * Represents the amount of VET to transfer in a transaction. - */ -interface TransactionValue { - value: number; -} - -/** - * Represents a comment for a transaction clause. - */ -interface ClauseComment { - comment: string; -} - -/** - * Represents the revision of a transaction clause. - */ -interface ClauseRevision { - revision: string; -} - -/** - * Represents additional options for a transaction clause. - */ -interface ClauseAdditionalOptions { - value: number | undefined; - comment: string | undefined; - revision: string | undefined; -} - -/** - * Represents the options for the get method of the `ContractFilter` class. - */ -interface TransferFilterOptions { - range?: Range; - options?: PaginationOptions; - order?: EventDisplayOrder; -} - -export type { - ContractFunctionAsync, - ContractFunctionSync, - ContractFunctionRead, - ContractFunctionTransact, - ContractFunctionFilter, - ContractFunctionClause, - ContractFunctionCriteria, - TransactionValue, - ClauseComment, - ClauseRevision, - ClauseAdditionalOptions, - TransferFilterOptions -}; diff --git a/packages/network/src/thor-client/contracts/types.d.ts b/packages/network/src/thor-client/contracts/types.d.ts deleted file mode 100644 index 96d7e47bd..000000000 --- a/packages/network/src/thor-client/contracts/types.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -import type { - SignTransactionOptions, - SimulateTransactionOptions, - TransactionBodyOptions -} from '../transactions/types'; - -import type { - ABIFunction, - ClauseOptions, - TransactionClause -} from '@vechain/sdk-core'; - -declare module 'abitype' { - export interface Register { - AddressType: string; - } -} - -declare module 'viem/node_modules/abitype' { - export interface Register { - AddressType: string; - } -} - -/* --------- Input types Start --------- */ - -/** - * Defines the options for executing a contract transaction. - */ -type ContractTransactionOptions = { - value?: number; - signTransactionOptions?: SignTransactionOptions; - - /** - * The delegation URL to use to sponsor the transaction. - */ - delegationUrl?: string; - - /** - * A comment describing the transaction request. - */ - comment?: string; -} & TransactionBodyOptions & - ClauseOptions; - -/** - * Defines the options for executing a contract call within a blockchain environment. - */ -type ContractCallOptions = SimulateTransactionOptions & ClauseOptions; - -/* --------- Input types End --------- */ - -/** - * Represents the result of a contract call operation, encapsulating the output of the call. - */ -interface ContractCallResult { - success: boolean; - result: { - plain?: unknown; // Success result as a plain value (might be literal or object). - array?: unknown[]; // Success result as an array (values are the same as in plain). - errorMessage?: string; - }; -} - -/** - * Represents a contract clause, which includes the clause and the corresponding function ABI. - */ -interface ContractClause { - clause: TransactionClause; - functionAbi: ABIFunction; -} - -export type { - ContractCallOptions, - ContractCallResult, - ContractClause, - ContractTransactionOptions -}; diff --git a/packages/network/src/thor-client/debug/ContractTraceTarget.d.ts b/packages/network/src/thor-client/debug/ContractTraceTarget.d.ts deleted file mode 100644 index 91d8863f9..000000000 --- a/packages/network/src/thor-client/debug/ContractTraceTarget.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { type Address, type Hex, type VET } from '@vechain/sdk-core'; - -/** - * Type for input for trace contract call - target contract. - */ -export interface ContractTraceTarget { - /** - * The recipient of the call. - * Null indicates contract deployment. - */ - to?: Address | null; - - /** - * The input data for the contract call. - */ - data?: Hex; - - /** - * The amount of token to be transferred. - */ - value?: VET; -} diff --git a/packages/network/src/thor-client/debug/DebugModule.ts b/packages/network/src/thor-client/debug/DebugModule.ts deleted file mode 100644 index 9d869147f..000000000 --- a/packages/network/src/thor-client/debug/DebugModule.ts +++ /dev/null @@ -1,185 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; -import { thorest } from '../../utils'; -import { type ContractTraceTarget } from './ContractTraceTarget'; -import { type HttpClient } from '../../http'; -import { type RetrieveStorageRange } from './RetrieveStorageRange'; -import { type RetrieveStorageRangeOptions } from './RetrieveStorageRangeOptions'; -import { type TransactionTraceTarget } from './TransactionTraceTarget'; -import { - type ContractTraceOptions, - type TracerConfig, - type TraceReturnType, - type TracerName -} from './types'; -import { HexUInt } from '@vechain/sdk-core'; - -/** - * The class provides methods to debug the VeChain Thor blockchain. - */ -class DebugModule { - /** - * Creates an instance of the class with a specified HTTP client. - * - * @param {HttpClient} httpClient - The HTTP client instance to be used for making requests. - */ - constructor(readonly httpClient: HttpClient) {} - - /** - * Retrieve the storage range for a specified transaction trace target. - * - * @param {Object} input - The input parameters. - * @param {TransactionTraceTarget} input.target - The transaction trace target containing the block ID, transaction, and clause index. - * @param {RetrieveStorageRangeOptions} [input.options] - Optional settings for the retrieval process. - * @param {Address} [input.options.address] - The address for which to retrieve the storage range. - * @param {KeyStart} [input.options.keyStart] - The starting key for the storage range retrieval. - * @param {number} [input.options.maxResult] - The maximum number of results to retrieve. - * - * @return {Promise} The storage range data for the specified target. - * - * @throws IllegalDataType If {@link TransactionTraceTarget} `input.target` has a negative `clauseIndex` or `transaction` property. - */ - public async retrieveStorageRange(input: { - target: TransactionTraceTarget; - options?: RetrieveStorageRangeOptions; - }): Promise { - // Validate target. If invalid, assert - this.validateTarget(input.target, 'retrieveStorageRange'); - - // Parse target - const parsedTarget = `${input.target.blockId}/${input.target.transaction}/${input.target.clauseIndex}`; - - // Send request - return (await this.httpClient.post( - thorest.debug.post.RETRIEVE_STORAGE_RANGE(), - { - query: {}, - body: { - target: parsedTarget, - address: input.options?.address?.toString(), - keyStart: input.options?.keyStart?.toString(), - maxResult: input.options?.maxResult - }, - headers: {} - } - )) as RetrieveStorageRange; - } - - /** - * Traces a contract call using the specified target, options, and configuration. - * - * @param {Object} input - The input parameters for the contract call trace. - * @param {ContractTraceTarget} [input.target] - The target contract details. - * @param {ContractTraceOptions} [input.options] - Optional configuration for the contract trace. - * @param {TracerConfig} [input.config] - Configuration for the tracer. - * @param {TracerName} [name] - The name of the tracer to be used. - * @return {Promise>} A promise that resolves to the trace result. - */ - public async traceContractCall( - input: { - target?: ContractTraceTarget; - options?: ContractTraceOptions; - config?: TracerConfig; - }, - name?: TracerName - ): Promise> { - // Send request - return (await this.httpClient.post( - thorest.debug.post.TRACE_CONTRACT_CALL(), - { - query: {}, - body: { - to: input.target?.to?.toString(), - data: input.target?.data?.toString(), - value: - typeof input.target?.value?.wei === 'bigint' - ? HexUInt.of(input.target.value.wei).toString() - : undefined, - name, - gas: input.options?.gas, - gasPrice: input.options?.gasPrice, - caller: input.options?.caller, - provedWork: input.options?.provedWork, - gasPayer: input.options?.gasPayer, - expiration: input.options?.expiration, - blockRef: input.options?.blockRef, - config: input.config - }, - headers: {} - } - )) as TraceReturnType; - } - - /** - * Traces a transaction clause based on the provided target and configuration. - * - * Tracers are instrumental in monitoring and analyzing the execution flow within the EVM. - * - * @param {Object} input - The input object containing the transaction trace target and optional tracer config. - * @param {TransactionTraceTarget} input.target - The target transaction details including block ID, transaction ID, and clause index. - * @param {TracerConfig} [input.config] - Optional tracer configuration settings. - * @param {TracerName} [name] - Optional name for the tracer. - * @return {Promise>} - The result of the trace operation. - * @throws {InvalidDataType} - If the `input.target.transaction` or `input.target.clauseIndex` properties are invalid. - */ - public async traceTransactionClause( - input: { - target: TransactionTraceTarget; - config?: TracerConfig; - }, - name?: TracerName - ): Promise> { - // Validate target. If invalid, assert - this.validateTarget(input.target, 'traceTransactionClause'); - // Parse target - const parsedTarget = `${input.target.blockId}/${input.target.transaction}/${input.target.clauseIndex}`; - // Send request - return (await this.httpClient.post( - thorest.debug.post.TRACE_TRANSACTION_CLAUSE(), - { - query: {}, - body: { - target: parsedTarget, - name, - config: input.config - }, - headers: {} - } - )) as TraceReturnType; - } - - /** - * Validates the properties of a TransactionTraceTarget object. - * - * @param {TransactionTraceTarget} target - The target object containing transaction details to be validated. - * @param {string} functionName - The name of the function where this validation is invoked. - * @throws {InvalidDataType} If the transaction or clauseIndex properties in the target object are invalid. - */ - private validateTarget( - target: TransactionTraceTarget, - functionName: string - ): void { - // Validate target - transaction - if (typeof target.transaction === 'number') { - if (target.transaction < 0) { - throw new InvalidDataType( - 'DebugModule.validateTarget()', - `invalid transaction index '${target.transaction}' given as input for ${functionName}.`, - { - transaction: target.transaction, - functionName - } - ); - } - } - // Validate target - clauseIndex - if (target.clauseIndex < 0) { - throw new InvalidDataType( - 'DebugModule.validateTarget()', - `invalid clause index '${target.clauseIndex}' given as input for ${functionName}.`, - { clauseIndex: target.clauseIndex, functionName } - ); - } - } -} - -export { DebugModule }; diff --git a/packages/network/src/thor-client/debug/RetrieveStorageRange.d.ts b/packages/network/src/thor-client/debug/RetrieveStorageRange.d.ts deleted file mode 100644 index cd2786c18..000000000 --- a/packages/network/src/thor-client/debug/RetrieveStorageRange.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Return type for retrieve storage range function - */ -export interface RetrieveStorageRange { - /** - * The next key to be used for the next retrieve storage range call. - */ - nextKey: string | null; - - /** - * The data is non-nullable, but an empty object is returned if no data is found. - */ - storage: Record< - string, - { - /** - * Storage key. - */ - key: string; - - /** - * Storage value. - */ - value: string; - } - >; -} diff --git a/packages/network/src/thor-client/debug/RetrieveStorageRangeOptions.d.ts b/packages/network/src/thor-client/debug/RetrieveStorageRangeOptions.d.ts deleted file mode 100644 index 12c285f95..000000000 --- a/packages/network/src/thor-client/debug/RetrieveStorageRangeOptions.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { type Address, type BlockId } from '@vechain/sdk-core'; - -/** - * Type for input options - * for retrieve storage range function - */ -export interface RetrieveStorageRangeOptions { - /** - * The address of the contract/ account to be traced. - */ - address?: Address; - - /** - * The start key of the storage range. - * Default is 0x0000000000000000000000000000000000000000000000000000000000000000. - */ - keyStart?: BlockId; - - /** - * The maximum number of results to be returned. Default is 1000. - */ - maxResult?: number; -} diff --git a/packages/network/src/thor-client/debug/TransactionTraceTarget.ts b/packages/network/src/thor-client/debug/TransactionTraceTarget.ts deleted file mode 100644 index cd6f960c6..000000000 --- a/packages/network/src/thor-client/debug/TransactionTraceTarget.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { type BlockId } from '@vechain/sdk-core'; - -/** - * Type for target of TraceTransactionClause. - */ -export interface TransactionTraceTarget { - /** - * Block ID. - */ - blockId: BlockId; - /** - * Clause index. - */ - clauseIndex: number; - /** - * Transaction index if `number`, else ID if `ThorId`. - */ - transaction: number | BlockId; -} diff --git a/packages/network/src/thor-client/debug/index.ts b/packages/network/src/thor-client/debug/index.ts deleted file mode 100644 index f7fee3cdc..000000000 --- a/packages/network/src/thor-client/debug/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './DebugModule'; -export type * from './ContractTraceTarget'; -export type * from './RetrieveStorageRange'; -export type * from './RetrieveStorageRangeOptions'; -export type * from './TransactionTraceTarget'; -export type * from './types-by-name'; -export type * from './types.d'; diff --git a/packages/network/src/thor-client/debug/types-by-name/4byte-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/4byte-name-types.d.ts deleted file mode 100644 index 3316f53dd..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/4byte-name-types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Config for the '4byte' name type - */ -type FourByteNameConfig = Record; - -/** - * Return type for the '4byte' name type - */ -type FourByteNameReturnType = Record; - -export { type FourByteNameConfig, type FourByteNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/bigram-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/bigram-name-types.d.ts deleted file mode 100644 index da0ad49be..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/bigram-name-types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Config for the 'bigram' name type - */ -type BigramNameConfig = Record; - -/** - * Return type for the 'bigram' name type - */ -type BigramNameReturnType = Record; - -export { type BigramNameConfig, type BigramNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/call-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/call-name-types.d.ts deleted file mode 100644 index fad47b613..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/call-name-types.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Config for the 'call' name type - */ -type CallNameConfig = Record; - -/** - * Return type for the 'call' name type - */ -interface CallNameReturnType { - /** - * Transaction parameters - */ - from: string; - gas: string; - gasUsed: string; - to: string; - input: string; - output?: string; - - /** - * Transaction errors (if any) - */ - error?: string; - - /** - * Trace clause type (/debug/tracers endpoint) - */ - calls?: Array<{ - from: string; - gas: string; - gasUsed: string; - to: string; - input: string; - output: string; - type: string; - }>; - - /** - * Trace contract type (/debug/tracers/call endpoint) - */ - value?: string; - type?: string; -} - -export { type CallNameConfig, type CallNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/default-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/default-name-types.d.ts deleted file mode 100644 index 2fc82d8e4..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/default-name-types.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Config for the default ('' or null) name type - */ -type DefaultNameConfig = Record; - -/** - * Return type for the default ('' or null) name type - */ -interface DefaultNameReturnType { - gas: number; - failed: boolean; - returnValue: string; - structLogs: Array<{ - pc: number; - op: string; - gas: number; - gasCost: number; - depth: number; - stack: string[]; - }>; -} - -export { type DefaultNameConfig, type DefaultNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/evmdis-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/evmdis-name-types.d.ts deleted file mode 100644 index 68ae35108..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/evmdis-name-types.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Config for the 'evmdis' name type - */ -type EVMDisNameConfig = Record; - -/** - * Return type for the 'evmdis' name type - */ -type EVMDisNameReturnType = Array<{ - op: number; - depth: number; - result: string[]; - len: number; -}>; - -export { type EVMDisNameConfig, type EVMDisNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/index.ts b/packages/network/src/thor-client/debug/types-by-name/index.ts deleted file mode 100644 index 172f690bd..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type * from './4byte-name-types.d'; -export type * from './bigram-name-types.d'; -export type * from './call-name-types.d'; -export type * from './default-name-types.d'; -export type * from './evmdis-name-types.d'; -export type * from './noop-name-types.d'; -export type * from './opcount-name-types.d'; -export type * from './prestate-name-types.d'; -export type * from './trigram-name-types.d'; -export type * from './unigram-name-types.d'; diff --git a/packages/network/src/thor-client/debug/types-by-name/noop-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/noop-name-types.d.ts deleted file mode 100644 index ab86fa596..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/noop-name-types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Config for the 'noop' name type - */ -type NoopNameConfig = Record; - -/** - * Return type for the 'noop' name type - */ -type NoopNameReturnType = Record; - -export { type NoopNameConfig, type NoopNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/opcount-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/opcount-name-types.d.ts deleted file mode 100644 index c1d6d37a4..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/opcount-name-types.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Config for the 'opcount' name type - */ -type OPCountNameConfig = Record; - -/** - * Return type for the 'opcount' name type - */ -// eslint-disable-next-line sonarjs/redundant-type-aliases -type OPCountNameReturnType = number; - -export { type OPCountNameConfig, type OPCountNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/prestate-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/prestate-name-types.d.ts deleted file mode 100644 index c76a0e8ea..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/prestate-name-types.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Config for the 'prestate' name type - */ -type PreStateNameConfig = Record; - -/** - * Return type for the 'prestate' name type - */ -type PreStateNameReturnType = Record< - string, - { - balance: string; - energy: string; - code?: string; - storage?: Record; - } ->; - -export { type PreStateNameConfig, type PreStateNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/trigram-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/trigram-name-types.d.ts deleted file mode 100644 index 1af8c238a..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/trigram-name-types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Config for the 'trigram' name type - */ -type TrigramNameConfig = Record; - -/** - * Return type for the 'trigram' name type - */ -type TrigramNameReturnType = Record; - -export { type TrigramNameConfig, type TrigramNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types-by-name/unigram-name-types.d.ts b/packages/network/src/thor-client/debug/types-by-name/unigram-name-types.d.ts deleted file mode 100644 index c4bd71a1d..000000000 --- a/packages/network/src/thor-client/debug/types-by-name/unigram-name-types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Config for the 'unigram' name type - */ -type UnigramNameConfig = Record; - -/** - * Return type for the 'unigram' name type - */ -type UnigramNameReturnType = Record; - -export { type UnigramNameConfig, type UnigramNameReturnType }; diff --git a/packages/network/src/thor-client/debug/types.d.ts b/packages/network/src/thor-client/debug/types.d.ts deleted file mode 100644 index efb2139af..000000000 --- a/packages/network/src/thor-client/debug/types.d.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { - type BigramNameConfig, - type BigramNameReturnType, - type CallNameConfig, - type CallNameReturnType, - type DefaultNameConfig, - type DefaultNameReturnType, - type EVMDisNameConfig, - type EVMDisNameReturnType, - type FourByteNameConfig, - type FourByteNameReturnType, - type NoopNameConfig, - type NoopNameReturnType, - type OPCountNameConfig, - type OPCountNameReturnType, - type PreStateNameConfig, - type PreStateNameReturnType, - type TrigramNameConfig, - type TrigramNameReturnType, - type UnigramNameConfig, - type UnigramNameReturnType -} from './types-by-name'; -import { type SimulateTransactionOptions } from '../transactions/types'; - -/** - * TracerName is the name of the tracer to use. - * - * It determines Output and Input configuration. - * - * An empty name stands for the default struct logger tracer. - */ -type TracerName = - | '' - | '4byte' - | 'call' - | 'noop' - | 'prestate' - | 'unigram' - | 'bigram' - | 'trigram' - | 'evmdis' - | 'opcount' - | null; - -/** - * The configuration of the tracer. - * - * Used for traceTransactionClause and traceContractCall functions. - * - * It is specific to the name of the tracer. - * - * @see{TracerName} - */ -type TracerConfig = - TraceNameType extends '' - ? DefaultNameConfig - : TraceNameType extends '4byte' - ? FourByteNameConfig - : TraceNameType extends 'call' - ? CallNameConfig - : TraceNameType extends 'noop' - ? NoopNameConfig - : TraceNameType extends 'prestate' - ? PreStateNameConfig - : TraceNameType extends 'unigram' - ? UnigramNameConfig - : TraceNameType extends 'bigram' - ? BigramNameConfig - : TraceNameType extends 'trigram' - ? TrigramNameConfig - : TraceNameType extends 'evmdis' - ? EVMDisNameConfig - : TraceNameType extends 'opcount' - ? OPCountNameConfig - : TraceNameType extends null - ? DefaultNameConfig - : TraceNameType extends undefined - ? DefaultNameConfig - : never; - -/** - * The return type of the tracer. - * - * Used for traceTransactionClause and traceContractCall functions. - * - * It is specific to the name of the tracer. - * - * @see{TracerName} - */ -type TraceReturnType = - TraceNameType extends '' - ? DefaultNameReturnType - : TraceNameType extends '4byte' - ? FourByteNameReturnType - : TraceNameType extends 'call' - ? CallNameReturnType - : TraceNameType extends 'noop' - ? NoopNameReturnType - : TraceNameType extends 'prestate' - ? PreStateNameReturnType - : TraceNameType extends 'unigram' - ? UnigramNameReturnType - : TraceNameType extends 'bigram' - ? BigramNameReturnType - : TraceNameType extends 'trigram' - ? TrigramNameReturnType - : TraceNameType extends 'evmdis' - ? EVMDisNameReturnType - : TraceNameType extends 'opcount' - ? OPCountNameReturnType - : TraceNameType extends null - ? DefaultNameReturnType - : TraceNameType extends undefined - ? DefaultNameReturnType - : never; - -/** - * Type for input for trace contract call - transaction options. - */ -type ContractTraceOptions = Omit; - -export { - type TracerName, - type TracerConfig, - type TraceReturnType, - type ContractTraceOptions -}; diff --git a/packages/network/src/thor-client/gas/gas-module.ts b/packages/network/src/thor-client/gas/gas-module.ts deleted file mode 100644 index 4513e760f..000000000 --- a/packages/network/src/thor-client/gas/gas-module.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { type EstimateGasOptions, type EstimateGasResult } from './types'; -import { type SimulateTransactionClause } from '../transactions/types'; -import { type TransactionsModule } from '../transactions'; - -/** - * The `GasModule` handles gas related operations and provides - * convenient methods for estimating the gas cost of a transaction. - */ -class GasModule { - readonly transactionsModule: TransactionsModule; - - constructor(transactionsModule: TransactionsModule) { - this.transactionsModule = transactionsModule; - } - - /** - * This method is going to be deprecated in next release. - * Use {@link TransactionsModule.estimateGas} instead. - */ - public async estimateGas( - clauses: SimulateTransactionClause[], - caller?: string, - options?: EstimateGasOptions - ): Promise { - return await this.transactionsModule.estimateGas( - clauses, - caller, - options - ); - } -} - -export { GasModule }; diff --git a/packages/network/src/thor-client/gas/helpers/const.ts b/packages/network/src/thor-client/gas/helpers/const.ts deleted file mode 100644 index 2344ef2cb..000000000 --- a/packages/network/src/thor-client/gas/helpers/const.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Keccak256, Txt } from '@vechain/sdk-core'; - -/** - * The selector of the `Error(string)` function in Solidity. - */ -const SOLIDITY_ERROR_SELECTOR = Keccak256.of(Txt.of('Error(string)').bytes) - .toString() - .slice(0, 10); - -/** - * The selector of the `Panic(uint256)` function in Solidity. - */ -const SOLIDITY_PANIC_SELECTOR = Keccak256.of(Txt.of('Panic(uint256)').bytes) - .toString() - .slice(0, 10); - -export { SOLIDITY_ERROR_SELECTOR, SOLIDITY_PANIC_SELECTOR }; diff --git a/packages/network/src/thor-client/gas/helpers/decode-evm-error.ts b/packages/network/src/thor-client/gas/helpers/decode-evm-error.ts deleted file mode 100644 index 7be73176c..000000000 --- a/packages/network/src/thor-client/gas/helpers/decode-evm-error.ts +++ /dev/null @@ -1,38 +0,0 @@ -// https://docs.soliditylang.org/en/v0.8.16/control-structures.html#error-handling-assert-require-revert-and-exceptions -// builtin errors in solidity, Error(string) and Panic(uint256) - -import { ABI } from '@vechain/sdk-core'; -import { SOLIDITY_ERROR_SELECTOR, SOLIDITY_PANIC_SELECTOR } from './const'; - -/** - * Decodes revert reasons from a given hex-encoded data string, identifying whether the revert is due to an "Error(string)" or a "Panic(uint256)". - * - * @param data - Hex-encoded data containing revert information. - * @returns Decoded revert reason or an error message if decoding fails. - * - * @example - * ```typescript - * const revertReason = decodeRevertReason('0x0123456789abcdef0123456789abcdef'); - * console.log(revertReason); // 'Decoded Revert Reason' - * ``` - */ -function decodeRevertReason(data: string): string | undefined { - // Check if the revert reason starts with the error selector - if (data.startsWith(SOLIDITY_ERROR_SELECTOR)) - // Decode the error message from the remaining data - return ABI.ofEncoded( - 'string', - '0x' + data.slice(SOLIDITY_ERROR_SELECTOR.length) - ).getFirstDecodedValue(); - - if (data.startsWith(SOLIDITY_PANIC_SELECTOR)) { - // Decode the panic code and format it as a string - const decoded = ABI.ofEncoded( - 'uint256', - '0x' + data.slice(SOLIDITY_PANIC_SELECTOR.length) - ).getFirstDecodedValue(); - return `Panic(0x${parseInt(decoded).toString(16).padStart(2, '0')})`; - } -} - -export { decodeRevertReason }; diff --git a/packages/network/src/thor-client/gas/index.ts b/packages/network/src/thor-client/gas/index.ts deleted file mode 100644 index efe56fc96..000000000 --- a/packages/network/src/thor-client/gas/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './gas-module'; diff --git a/packages/network/src/thor-client/gas/types.d.ts b/packages/network/src/thor-client/gas/types.d.ts deleted file mode 100644 index 5a3495f01..000000000 --- a/packages/network/src/thor-client/gas/types.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { type SimulateTransactionOptions } from '../transactions/types'; - -/* --- Input options start --- */ - -type EstimateGasOptions = Omit & { - /** - * percentage of gas to add on top of the estimated gas. - * Value must be between (0, 1]. (e.g. 0.1 = 10%) - */ - gasPadding?: number; -}; - -/* --- Input options end --- */ - -/* --- Responses Outputs start --- */ - -/** - * The result of estimating the gas cost of a transaction. - */ -interface EstimateGasResult { - /** - * The total gas cost estimation of the transaction. - */ - totalGas: number; - - /** - * Boolean indicating whether the transaction reverted or not. - */ - reverted: boolean; - - /** - * Decoded Solidity revert reasons for each clause. - * If the n-th clause reverted, then the n-th element of this array will be the decoded revert reason for the n-th clause. - * - * @note revertReasons will be undefined if the transaction did not revert. - */ - revertReasons: Array; - - /** - * The error message produced by the Virtual Machine. - * - * @note vmErrors will be undefined if the transaction did not revert. - */ - vmErrors: string[]; -} - -/* --- Responses Outputs end --- */ - -export type { EstimateGasResult, EstimateGasOptions }; diff --git a/packages/network/src/thor-client/index.ts b/packages/network/src/thor-client/index.ts deleted file mode 100644 index 7b3370a73..000000000 --- a/packages/network/src/thor-client/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Single clients -export * from './accounts'; -export * from './blocks'; -export * from './contracts'; -export * from './debug'; -export * from './gas'; -export * from './logs'; -export * from './nodes'; -export * from './transactions'; - -// Main client -export * from './ThorClient'; diff --git a/packages/network/src/thor-client/logs/index.ts b/packages/network/src/thor-client/logs/index.ts deleted file mode 100644 index 3f70446f6..000000000 --- a/packages/network/src/thor-client/logs/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type * from './types.d'; -export * from './logs-module'; diff --git a/packages/network/src/thor-client/logs/logs-module.ts b/packages/network/src/thor-client/logs/logs-module.ts deleted file mode 100644 index 83c350844..000000000 --- a/packages/network/src/thor-client/logs/logs-module.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { type ABIEvent, Hex } from '@vechain/sdk-core'; -import { InvalidAbiItem } from '@vechain/sdk-errors'; -import { thorest } from '../../utils/thorest/thorest'; -import { - type EventLogs, - type FilterEventLogsOptions, - type FilterRawEventLogsOptions, - type FilterTransferLogsOptions, - type TransferLogs -} from './types'; -import { HttpMethod } from '../../http'; -import { type BlocksModule } from '../blocks'; - -/** - * The `LogsClient` class provides methods to interact with log-related endpoints - * of the VeChainThor blockchain. It allows filtering event and transfer logs. - */ -class LogsModule { - readonly blocksModule: BlocksModule; - - constructor(blocksModule: BlocksModule) { - this.blocksModule = blocksModule; - } - - /** - * Filters event logs based on the provided criteria. Raw event logs are not decoded. - * - * @param filterOptions - An object specifying filtering criteria for event logs. - * @returns A promise that resolves to filtered event logs. - */ - public async filterRawEventLogs( - filterOptions: FilterRawEventLogsOptions - ): Promise { - return (await this.blocksModule.httpClient.http( - HttpMethod.POST, - thorest.logs.post.EVENT_LOGS(), - { - query: {}, - body: filterOptions, - headers: {} - } - )) as EventLogs[]; - } - - /** - * Filters event logs based on the provided criteria and decodes them using the provided ABI items. - * The decoded data is added to the event logs as a new property. - * @param filterOptions - An object specifying filtering criteria for event logs. - */ - public async filterEventLogs( - filterOptions: FilterEventLogsOptions - ): Promise { - // Extract raw event logs and ABI items from filter options - const eventAbis = filterOptions.criteriaSet?.map((c) => c.eventAbi); - - const eventLogs = await this.getRawEventLogs(filterOptions); - - const result: EventLogs[] = []; - - if (eventAbis !== undefined) { - const uniqueEventAbis = this.removeDuplicatedAbis(eventAbis); - - eventLogs.forEach((log) => { - const eventAbi = uniqueEventAbis.get(log.topics[0]); - if (eventAbi === undefined || eventAbi === null) { - throw new InvalidAbiItem( - 'LogsModule.filterEventLogs', - 'Topic not found in the provided ABIs.', - { type: 'event', value: log.topics[0] } - ); - } - log.decodedData = eventAbi.decodeEventLogAsArray({ - data: Hex.of(log.data), - topics: log.topics.map((topic) => Hex.of(topic)) - }); - result.push(log); - }); - } - - return result; - } - - /** - * Filters event logs based on the provided criteria and decodes them using the provided ABI items. - * The decoded data is added to the event logs as a new property. - * The result is an array of event logs grouped by the event topic hash. - * @param filterOptions - * @returns A promise that resolves to an array of event logs grouped by event. - */ - public async filterGroupedEventLogs( - filterOptions: FilterEventLogsOptions - ): Promise { - // Extract raw event logs and ABI items from filter options - const eventAbis = filterOptions.criteriaSet?.map((c) => c.eventAbi); - - const eventLogs = await this.getRawEventLogs(filterOptions); - - const result = new Map(); - - if (eventAbis !== undefined) { - const uniqueEventAbis = this.removeDuplicatedAbis(eventAbis); - - // Initialize the result map with empty arrays for each unique ABI item - uniqueEventAbis.forEach((f) => result.set(f.signatureHash, [])); - - eventLogs.forEach((log) => { - const eventAbi = uniqueEventAbis.get(log.topics[0]); - if (eventAbi === undefined || eventAbi === null) { - throw new InvalidAbiItem( - 'LogsModule.filterGroupedEventLogs', - 'Topic not found in the provided ABIs.', - { type: 'event', value: log.topics[0] } - ); - } - - log.decodedData = eventAbi.decodeEventLogAsArray({ - data: Hex.of(log.data), - topics: log.topics.map((topic) => Hex.of(topic)) - }); - result.get(log.topics[0])?.push(log); - }); - } - - return Array.from(result.values()); - } - - /** - * Filters event logs based on the provided criteria without decoding them. - * @param filterOptions - An object specifying filtering criteria for event logs. - * @private Returns a promise that resolves to filtered non decoded event logs. - */ - private async getRawEventLogs( - filterOptions: FilterEventLogsOptions - ): Promise { - const criteriaSet = filterOptions.criteriaSet?.map((c) => c.criteria); - // Create new filter options with the criteria set - const filterRawEventLogsOptions: FilterRawEventLogsOptions = { - range: filterOptions.range ?? { - unit: 'block', - from: 0, - to: (await this.blocksModule.getBestBlockCompressed())?.number - }, - criteriaSet, - options: filterOptions.options, - order: filterOptions.order ?? 'asc' - }; - - // Filter event logs based on the provided criteria - return await this.filterRawEventLogs(filterRawEventLogsOptions); - } - - /** - * Removes duplicated ABI items from the provided array. ABI items are considered duplicated if they have the same topic hash. - * @param eventAbis - An array of event ABI items. - * @private Returns a map of unique ABI items. - */ - private removeDuplicatedAbis(eventAbis: ABIEvent[]): Map { - const uniqueEventAbis = new Map(); - - eventAbis.forEach((obj) => { - if (!uniqueEventAbis.has(obj.signatureHash)) { - uniqueEventAbis.set(obj.signatureHash, obj); - } - }); - - return uniqueEventAbis; - } - - /** - * Filters transfer logs based on the provided criteria. - * - * @param filterOptions - An object specifying filtering criteria for transfer logs. - * @returns A promise that resolves to filtered transfer logs. - */ - public async filterTransferLogs( - filterOptions: FilterTransferLogsOptions - ): Promise { - return (await this.blocksModule.httpClient.http( - HttpMethod.POST, - thorest.logs.post.TRANSFER_LOGS(), - { - query: {}, - body: filterOptions, - headers: {} - } - )) as TransferLogs[]; - } -} - -export { LogsModule }; diff --git a/packages/network/src/thor-client/logs/types.d.ts b/packages/network/src/thor-client/logs/types.d.ts deleted file mode 100644 index 4446c867b..000000000 --- a/packages/network/src/thor-client/logs/types.d.ts +++ /dev/null @@ -1,271 +0,0 @@ -/* --- Input options start --- */ - -import { type ABIEvent } from '@vechain/sdk-core'; - -/** - * Range interface for specifying a range of data. - */ -interface Range { - /** - * The unit for specifying the range (block or time). - */ - unit?: 'block' | 'time'; // The unit for specifying the range (block or time). - - /** - * The starting point of the range. - */ - from?: number; - - /** - * The ending point of the range. - */ - to?: number; -} - -/** - * Options interface for specifying Pagination Options (offset and limits). - */ -interface PaginationOptions { - /** - * Offset for pagination. - */ - offset?: number; - - /** - * Limit for the number of results to return. - */ - limit?: number; -} - -/** - * FilterCriteria interface for filtering event logs. - */ -interface FilterCriteria { - criteria: EventCriteria; - eventAbi: ABIEvent; -} - -/** - * EventCriteria interface for filtering event logs. - */ -interface EventCriteria { - /** - * Address filter for event criteria. - */ - address?: string; - /** - * Event topics filter. - */ - topic0?: string; - topic1?: string; - topic2?: string; - topic3?: string; - topic4?: string; -} - -/** - * Order interface for filtering event logs. - */ -type EventDisplayOrder = 'asc' | 'desc'; - -/** - * FilterRawEventLogsArg interface for filtering raw event logs. - */ -interface FilterRawEventLogsOptions { - /** - * Block range - */ - range?: Range; - /** - * Pagination options - */ - options?: PaginationOptions; - /** - * Event filters - */ - criteriaSet?: EventCriteria[]; - /** - * Sorting order - */ - order?: EventDisplayOrder; -} - -/** - * FilterEventLogsArg interface for filtering decoded event logs. - */ -interface FilterEventLogsOptions { - /** - * Block range - */ - range?: Range; - /** - * Pagination options - */ - options?: PaginationOptions; - /** - * Event filters - */ - criteriaSet?: FilterCriteria[]; - /** - * Sorting order - */ - order?: EventDisplayOrder; -} - -/** - * FilterTransferLogsArg interface for filtering transfer logs. - */ -interface FilterTransferLogsOptions { - /** - * Block range to query - */ - range?: Range; - /** - * Pagination options - */ - options?: PaginationOptions; - /** - * Criteria to filter transfers by - */ - criteriaSet: TransferCriteria[]; - /** - * Ordering of results - */ - order: EventDisplayOrder; -} - -/* --- Input options end --- */ - -/* --- Responses Outputs start --- */ - -/** - * Event metadata for an entity. - */ -interface Metadata { - /** - * Block identifier associated with the entity - */ - blockID: string; - /** - * Block number associated with the entity - */ - blockNumber: number; - /** - * Timestamp of the block - */ - blockTimestamp: number; - /** - * Transaction ID associated with the entity - */ - txID: string; - /** - * Transaction origin information - */ - txOrigin: string; - /** - * Index of the clause - */ - clauseIndex: number; -} - -/** - * TransferCriteria interface for filtering transfer logs. - */ -interface TransferCriteria { - /** - * Transaction origin filter for transfer criteria. - */ - - txOrigin?: string; - /** - * Sender's address filter. - */ - - sender?: string; - /** - * Recipient's address filter. - */ - recipient?: string; -} - -/** - * Event interface representing event data. - */ -interface Event { - /** - * The address related to the event. - */ - address: string; - - /** - * Event topics or categories. - */ - topics: string[]; - - /** - * Event data. - */ - data: string; -} - -/** - * Transfer interface representing transfer data. - */ -interface Transfer { - /** - * The sender's address in the transfer. - */ - sender: string; - - /** - * The recipient's address in the transfer. - */ - recipient: string; - - /** - * The amount being transferred. - */ - amount: string; -} - -/** - * EventLogs interface, combining Event and EventMetadata. - */ -interface EventLogs extends Event { - /** - * Event logs with associated metadata - */ - meta: Metadata; - - /** - * The decoded data from the event. - */ - decodedData?: unknown[]; -} - -/** - * TransferLogs interface, combining Transfer and WithMeta. - */ -interface TransferLogs extends Transfer { - /** - * Transfer logs with associated metadata - */ - meta: Metadata; -} - -/* --- Responses Outputs end --- */ - -export type { - Event, - EventCriteria, - EventDisplayOrder, - EventLogs, - FilterCriteria, - FilterEventLogsOptions, - FilterRawEventLogsOptions, - FilterTransferLogsOptions, - PaginationOptions, - Range, - Transfer, - TransferLogs -}; diff --git a/packages/network/src/thor-client/nodes/index.ts b/packages/network/src/thor-client/nodes/index.ts deleted file mode 100644 index 62a89cc09..000000000 --- a/packages/network/src/thor-client/nodes/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './nodes-module'; -export type * from './types.d'; diff --git a/packages/network/src/thor-client/nodes/nodes-module.ts b/packages/network/src/thor-client/nodes/nodes-module.ts deleted file mode 100644 index 9d284dab5..000000000 --- a/packages/network/src/thor-client/nodes/nodes-module.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; -import { NODE_HEALTHCHECK_TOLERANCE_IN_SECONDS, thorest } from '../../utils'; -import { type BlocksModule, type CompressedBlockDetail } from '../blocks'; -import { type ConnectedPeer } from './types'; -import { HttpMethod } from '../../http'; - -/** - * The `NodesModule` class serves as a module for node-related functionality, for example, checking the health of a node. - */ -class NodesModule { - readonly blocksModule: BlocksModule; - - constructor(blocksModule: BlocksModule) { - this.blocksModule = blocksModule; - } - - /** - * Retrieves connected peers of a node. - * - * @returns A promise that resolves to the list of connected peers. - */ - public async getNodes(): Promise { - const nodes = (await this.blocksModule.httpClient.http( - HttpMethod.GET, - thorest.nodes.get.NODES() - )) as ConnectedPeer[] | null; - return nodes ?? []; - } - - /** - * Checks the health of a node using the following algorithm: - * 1. Make an HTTP GET request to retrieve the last block timestamp. - * 2. Calculates the difference between the current time and the last block timestamp. - * 3. If the difference is less than the tolerance, the node is healthy. - * Note, we could also check '/node/network/peers since' but the difficulty with this approach is - * if you consider a scenario where the node is connected to 20+ peers, which is healthy, and it receives the new blocks as expected. - * But what if the node's disk is full, and it's not writing the new blocks to its database? In this case the node is off-sync even - * though it's technically alive and connected - * @returns A boolean indicating whether the node is healthy. - * @throws {InvalidDataTypeError} - */ - public async isHealthy(): Promise { - /** - * @internal - * Perform an HTTP GET request using the SimpleNet instance to get the latest block - */ - const response = await this.blocksModule.getBestBlockCompressed(); - - /** - * timestamp from the last block and, eventually handle errors - * @internal - */ - const lastBlockTimestamp: number = this.getTimestampFromBlock(response); - - /** - * seconds elapsed since the timestamp of the last block - * @internal - */ - const secondsSinceLastBlock = - Math.floor(Date.now() / 1000) - lastBlockTimestamp; - - return ( - Math.abs(secondsSinceLastBlock) < - NODE_HEALTHCHECK_TOLERANCE_IN_SECONDS - ); - } - - /** - * Extracts the timestamp from the block - * @remarks - * This function throws an error if the timestamp key does not exist in the response from the API call to the node - * @param response the response from the API call to the node - * @returns the timestamp from the block - * @throws{InvalidDataType} - */ - private readonly getTimestampFromBlock = ( - response: CompressedBlockDetail | null - ): number => { - if ( - response === null || - response === undefined || - typeof response !== 'object' || - !('timestamp' in response) || - typeof response.timestamp !== 'number' - ) { - throw new InvalidDataType( - 'NodesModule.getTimestampFromBlock()', - 'Sending failed: Input must be a valid raw transaction in hex format.', - { response } - ); - } - - return response?.timestamp; - }; -} - -export { NodesModule }; diff --git a/packages/network/src/thor-client/nodes/types.d.ts b/packages/network/src/thor-client/nodes/types.d.ts deleted file mode 100644 index 3a1781d97..000000000 --- a/packages/network/src/thor-client/nodes/types.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* --- Responses Outputs start --- */ - -/** - * Type for connected peer. - * A connected peer is a node that is connected to the node you have specified for the thorest client. - */ -interface ConnectedPeer { - /** - * Name of the peer in the format of `[network]/[version]-[gitcommit]-[versionmeta]/[os]/[goversion]`. - * e.g., `thor/v2.1.0-2b5853f-release/linux/go1.21.0` - */ - name: string; - /** - * Represents the block ID of the best block of the peer. - */ - bestBlockID: string; - /** - * Represents the Accumulated Witness Number (AWN) of the best block of the peer. - */ - totalScore: number; - /** - * ID of the peer. - */ - peerID: string; - /** - * IP address of the peer. - */ - netAddr: string; - /** - * indicates whether the connection to a peer is inbound or outbound. - * If `inbound` is true, the peer has initiated the connection to your node. In other words, the connection request came from the peer to your VeChainThor node. - * If `inbound` is false, your node has initiated the connection to the peer. In other words, the connection request came from your VeChainThor node to the peer. - */ - inbound: boolean; - /** - * Duration of the connection with the peer. - */ - duration: number; -} - -/* --- Responses Outputs end --- */ - -export { type ConnectedPeer }; diff --git a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts b/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts deleted file mode 100644 index cdce9e3b4..000000000 --- a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { Hex, HexUInt, type Transaction } from '@vechain/sdk-core'; -import { NotDelegatedTransaction } from '@vechain/sdk-errors'; -import { - type GetDelegationSignatureResult, - type SignTransactionOptions -} from '../types'; -import { type HttpClient, HttpMethod } from '../../../http'; - -/** - * Retrieves the signature of a delegation transaction from a delegator given the endpoint - * from which to retrieve the signature. - * - * @see [Simple Gas Payer Standard](https://github.com/vechain/VIPs/blob/master/vips/VIP-201.md) - * - * @param tx - The transaction to delegate. - * @param delegatorUrl - The URL of the endpoint of the delegator. - * @param originAddress - The address of the origin account. - * @param httpClient - The HTTP client instance used for making HTTP requests. - * @returns A promise that resolves to the signature of the delegation transaction. - * @throws {NotDelegatedTransaction} - */ -const _getDelegationSignature = async ( - tx: Transaction, - delegatorUrl: string, - originAddress: string, - httpClient: HttpClient -): Promise => { - const rawTx = Hex.of(tx.encoded).toString(); - - /** - * The request body for the delegation transaction. - * - * @see [Obtaining Gas Payer Signature](https://github.com/vechain/VIPs/blob/master/vips/VIP-201.md#obtaining-gas-payer-signature) - */ - const sponsorRequestBody = { - origin: originAddress, - raw: rawTx - }; - - try { - const response = (await httpClient.http(HttpMethod.POST, delegatorUrl, { - body: sponsorRequestBody - })) as GetDelegationSignatureResult; - - return HexUInt.of(response.signature.slice(2)).bytes; - } catch (error) { - throw new NotDelegatedTransaction( - '_getDelegationSignature()', - 'Delegation failed: Cannot get signature from delegator.', - { - delegatorUrl - }, - error - ); - } -}; - -/** - * Provide a set of utils for the delegation type. - * It is a mutual exclusion between delegatorPrivateKey and delegatorUrl. (@see SignTransactionOptions) - * - * The aim of this handler is to: - * - Understand the kind of delegation and the delegation info - * - Provide a method to get the delegation signature - * - * @param delegator - The delegator options. - */ -const DelegationHandler = ( - delegator?: SignTransactionOptions | null -): { - isDelegated: () => boolean; - delegatorOrUndefined: () => SignTransactionOptions | undefined; - delegatorOrNull: () => SignTransactionOptions | null; - getDelegationSignatureUsingUrl: ( - tx: Transaction, - originAddress: string, - httpClient: HttpClient - ) => Promise; -} => { - // Check if delegator is undefined (null or undefined) - const delegatorIsUndefined = delegator === undefined || delegator === null; - - // Check if is delegated by url - const isDelegatedWithUrl = - !delegatorIsUndefined && delegator?.delegatorUrl !== undefined; - - // Check if is delegated by private key - const isDelegatedWithPrivateKey = - !delegatorIsUndefined && delegator?.delegatorPrivateKey !== undefined; - - return { - /** - * Check if the transaction is delegated. - * - * @returns true if the transaction is delegated, false otherwise. - */ - isDelegated: (): boolean => - isDelegatedWithUrl || isDelegatedWithPrivateKey, - - /** - * Get the delegator options or undefined. - * (if delegator is undefined or null). - * - * @returns The delegator options or undefined. - */ - delegatorOrUndefined: (): SignTransactionOptions | undefined => - delegatorIsUndefined ? undefined : delegator, - - /** - * Get the delegator options or null. - * (if delegator is undefined or null). - * - * @returns The delegator options or null. - */ - delegatorOrNull: (): SignTransactionOptions | null => - delegatorIsUndefined ? null : delegator, - - /** - * Retrieves the signature of a delegation transaction from a delegator given the endpoint - * from which to retrieve the signature. - * - * @see [Simple Gas Payer Standard](https://github.com/vechain/VIPs/blob/master/vips/VIP-201.md) - * - * @param tx - The transaction to delegate. - * @param originAddress - The address of the origin account. - * @param httpClient - The HTTP client instance used for making HTTP requests. - * @returns A promise that resolves to the signature of the delegation transaction. - * @throws {NotDelegatedTransaction} - */ - getDelegationSignatureUsingUrl: async ( - tx: Transaction, - originAddress: string, - httpClient: HttpClient - ): Promise => { - // Cannot be delegated by private key - if (!isDelegatedWithUrl) { - throw new NotDelegatedTransaction( - 'DelegationHandler.getDelegationSignatureUsingUrl()', - 'Delegation with url failed: delegatorUrl is not defined.', - undefined - ); - } - - return await _getDelegationSignature( - tx, - delegator?.delegatorUrl, - originAddress, - httpClient - ); - } - }; -}; - -export { DelegationHandler }; diff --git a/packages/network/src/thor-client/transactions/helpers/index.ts b/packages/network/src/thor-client/transactions/helpers/index.ts deleted file mode 100644 index 25a79b604..000000000 --- a/packages/network/src/thor-client/transactions/helpers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './delegation-handler'; diff --git a/packages/network/src/thor-client/transactions/index.ts b/packages/network/src/thor-client/transactions/index.ts deleted file mode 100644 index adb683f9b..000000000 --- a/packages/network/src/thor-client/transactions/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type * from './types.d'; -export * from './transactions-module'; -export * from './helpers'; diff --git a/packages/network/src/thor-client/transactions/transactions-module.ts b/packages/network/src/thor-client/transactions/transactions-module.ts deleted file mode 100644 index 8cf42eb4a..000000000 --- a/packages/network/src/thor-client/transactions/transactions-module.ts +++ /dev/null @@ -1,884 +0,0 @@ -import { - ABI, - ABIContract, - type ABIFunction, - Address, - Clause, - dataUtils, - Hex, - HexUInt, - Revision, - ThorId, - Transaction, - type TransactionBody, - type TransactionClause, - Units, - VET -} from '@vechain/sdk-core'; -import { InvalidDataType, InvalidTransactionField } from '@vechain/sdk-errors'; -import { ErrorFragment, Interface } from 'ethers'; -import { HttpMethod } from '../../http'; -import { blocksFormatter, getTransactionIndexIntoBlock } from '../../provider'; -import { - buildQuery, - BUILT_IN_CONTRACTS, - ERROR_SELECTOR, - PANIC_SELECTOR, - Poll, - thorest, - vnsUtils -} from '../../utils'; -import { type BlocksModule, type ExpandedBlockDetail } from '../blocks'; -import { type CallNameReturnType, type DebugModule } from '../debug'; -import { - type GetTransactionInputOptions, - type GetTransactionReceiptInputOptions, - type SendTransactionResult, - type SimulateTransactionClause, - type SimulateTransactionOptions, - type TransactionBodyOptions, - type TransactionDetailNoRaw, - type TransactionDetailRaw, - type TransactionReceipt, - type TransactionSimulationResult, - type WaitForTransactionOptions -} from './types'; -import type { EstimateGasOptions, EstimateGasResult } from '../gas/types'; -import { decodeRevertReason } from '../gas/helpers/decode-evm-error'; -import type { - ContractCallOptions, - ContractCallResult, - ContractClause, - ContractTransactionOptions -} from '../contracts'; -import type { VeChainSigner } from '../../signer'; -import { type LogsModule } from '../logs'; - -/** - * The `TransactionsModule` handles transaction related operations and provides - * convenient methods for sending transactions and waiting for transaction confirmation. - */ -class TransactionsModule { - readonly blocksModule: BlocksModule; - readonly debugModule: DebugModule; - readonly logsModule: LogsModule; - - constructor( - blocksModule: BlocksModule, - debugModule: DebugModule, - logsModule: LogsModule - ) { - this.blocksModule = blocksModule; - this.debugModule = debugModule; - this.logsModule = logsModule; - } - - /** - * Retrieves the details of a transaction. - * - * @param id - Transaction ID of the transaction to retrieve. - * @param options - (Optional) Other optional parameters for the request. - * @returns A promise that resolves to the details of the transaction. - * @throws {InvalidDataType} - */ - public async getTransaction( - id: string, - options?: GetTransactionInputOptions - ): Promise { - // Invalid transaction ID - if (!ThorId.isValid(id)) { - throw new InvalidDataType( - 'TransactionsModule.getTransaction()', - 'Invalid transaction ID given as input. Input must be an hex string of length 64.', - { id } - ); - } - - // Invalid head - if (options?.head !== undefined && !ThorId.isValid(options.head)) - throw new InvalidDataType( - 'TransactionsModule.getTransaction()', - 'Invalid head given as input. Input must be an hex string of length 64.', - { head: options?.head } - ); - - return (await this.blocksModule.httpClient.http( - HttpMethod.GET, - thorest.transactions.get.TRANSACTION(id), - { - query: buildQuery({ - raw: false, - head: options?.head, - pending: options?.pending - }) - } - )) as TransactionDetailNoRaw | null; - } - - /** - * Retrieves the details of a transaction. - * - * @param id - Transaction ID of the transaction to retrieve. - * @param options - (Optional) Other optional parameters for the request. - * @returns A promise that resolves to the details of the transaction. - * @throws {InvalidDataType} - */ - public async getTransactionRaw( - id: string, - options?: GetTransactionInputOptions - ): Promise { - // Invalid transaction ID - if (!ThorId.isValid(id)) { - throw new InvalidDataType( - 'TransactionsModule.getTransactionRaw()', - 'Invalid transaction ID given as input. Input must be an hex string of length 64.', - { id } - ); - } - - // Invalid head - if (options?.head !== undefined && !ThorId.isValid(options.head)) - throw new InvalidDataType( - 'TransactionsModule.getTransaction()', - 'Invalid head given as input. Input must be an hex string of length 64.', - { head: options?.head } - ); - - return (await this.blocksModule.httpClient.http( - HttpMethod.GET, - thorest.transactions.get.TRANSACTION(id), - { - query: buildQuery({ - raw: true, - head: options?.head, - pending: options?.pending - }) - } - )) as TransactionDetailRaw | null; - } - - /** - * Retrieves the receipt of a transaction. - * - * @param id - Transaction ID of the transaction to retrieve. - * @param options - (Optional) Other optional parameters for the request. - * If `head` is not specified, the receipt of the transaction at the best block is returned. - * @returns A promise that resolves to the receipt of the transaction. - * @throws {InvalidDataType} - */ - public async getTransactionReceipt( - id: string, - options?: GetTransactionReceiptInputOptions - ): Promise { - // Invalid transaction ID - if (!ThorId.isValid(id)) { - throw new InvalidDataType( - 'TransactionsModule.getTransactionReceipt()', - 'Invalid transaction ID given as input. Input must be an hex string of length 64.', - { id } - ); - } - - // Invalid head - if (options?.head !== undefined && !ThorId.isValid(options.head)) - throw new InvalidDataType( - 'TransactionsModule.getTransaction()', - 'Invalid head given as input. Input must be an hex string of length 64.', - { head: options?.head } - ); - - return (await this.blocksModule.httpClient.http( - HttpMethod.GET, - thorest.transactions.get.TRANSACTION_RECEIPT(id), - { - query: buildQuery({ head: options?.head }) - } - )) as TransactionReceipt | null; - } - - /** - * Retrieves the receipt of a transaction. - * - * @param raw - The raw transaction. - * @returns The transaction id of send transaction. - * @throws {InvalidDataType} - */ - public async sendRawTransaction( - raw: string - ): Promise { - // Validate raw transaction - if (!Hex.isValid0x(raw)) { - throw new InvalidDataType( - 'TransactionsModule.sendRawTransaction()', - 'Sending failed: Input must be a valid raw transaction in hex format.', - { raw } - ); - } - - // Decode raw transaction to check if raw is ok - try { - Transaction.decode(HexUInt.of(raw.slice(2)).bytes, true); - } catch (error) { - throw new InvalidDataType( - 'TransactionsModule.sendRawTransaction()', - 'Sending failed: Input must be a valid raw transaction in hex format. Decoding error encountered.', - { raw }, - error - ); - } - - const transactionResult = (await this.blocksModule.httpClient.http( - HttpMethod.POST, - thorest.transactions.post.TRANSACTION(), - { - body: { raw } - } - )) as SendTransactionResult; - - return { - id: transactionResult.id, - wait: async () => - await this.waitForTransaction(transactionResult.id) - }; - } - - /** - * Sends a signed transaction to the network. - * - * @param signedTx - the transaction to send. It must be signed. - * @returns A promise that resolves to the transaction ID of the sent transaction. - * @throws {InvalidDataType} - */ - public async sendTransaction( - signedTx: Transaction - ): Promise { - // Assert transaction is signed or not - if (!signedTx.isSigned) { - throw new InvalidDataType( - 'TransactionsModule.sendTransaction()', - 'Invalid transaction given as input. Transaction must be signed.', - { signedTx } - ); - } - - const rawTx = Hex.of(signedTx.encoded).toString(); - - return await this.sendRawTransaction(rawTx); - } - - /** - * Waits for a transaction to be included in a block. - * - * @param txID - The transaction ID of the transaction to wait for. - * @param options - Optional parameters for the request. Includes the timeout and interval between requests. - * Both parameters are in milliseconds. If the timeout is not specified, the request will not time out! - * @returns A promise that resolves to the transaction receipt of the transaction. If the transaction is not included in a block before the timeout, - * the promise will resolve to `null`. - * @throws {InvalidDataType} - */ - public async waitForTransaction( - txID: string, - options?: WaitForTransactionOptions - ): Promise { - // Invalid transaction ID - if (!ThorId.isValid(txID)) { - throw new InvalidDataType( - 'TransactionsModule.waitForTransaction()', - 'Invalid transaction ID given as input. Input must be an hex string of length 64.', - { txID } - ); - } - - return await Poll.SyncPoll( - async () => await this.getTransactionReceipt(txID), - { - requestIntervalInMilliseconds: options?.intervalMs, - maximumWaitingTimeInMilliseconds: options?.timeoutMs - } - ).waitUntil((result) => { - return result !== null; - }); - } - - /** - * Builds a transaction body with the given clauses without having to - * specify the chainTag, expiration, gasPriceCoef, gas, dependsOn and reserved fields. - * - * @param clauses - The clauses of the transaction. - * @param gas - The gas to be used to perform the transaction. - * @param options - Optional parameters for the request. Includes the expiration, gasPriceCoef, dependsOn and isDelegated fields. - * If the `expiration` is not specified, the transaction will expire after 32 blocks. - * If the `gasPriceCoef` is not specified, the transaction will use the default gas price coef of 127. - * If the `dependsOn is` not specified, the transaction will not depend on any other transaction. - * If the `isDelegated` is not specified, the transaction will not be delegated. - * - * @returns A promise that resolves to the transaction body. - * - * @throws an error if the genesis block or the latest block cannot be retrieved. - */ - public async buildTransactionBody( - clauses: TransactionClause[], - gas: number, - options?: TransactionBodyOptions - ): Promise { - // Get the genesis block to get the chainTag - const genesisBlock = await this.blocksModule.getBlockCompressed(0); - if (genesisBlock === null) - throw new InvalidTransactionField( - 'TransactionsModule.buildTransactionBody()', - 'Error while building transaction body: Cannot get genesis block.', - { fieldName: 'genesisBlock', genesisBlock, clauses, options } - ); - - const blockRef = - options?.blockRef ?? (await this.blocksModule.getBestBlockRef()); - if (blockRef === null) - throw new InvalidTransactionField( - 'TransactionsModule.buildTransactionBody()', - 'Error while building transaction body: Cannot get blockRef.', - { fieldName: 'blockRef', blockRef, clauses, options } - ); - - const chainTag = - options?.chainTag ?? Number(`0x${genesisBlock.id.slice(64)}`); - - return { - blockRef, - chainTag, - clauses: await this.resolveNamesInClauses(clauses), - dependsOn: options?.dependsOn ?? null, - expiration: options?.expiration ?? 32, - gas, - gasPriceCoef: options?.gasPriceCoef ?? 0, - nonce: options?.nonce ?? Hex.random(8).toString(), - reserved: - options?.isDelegated === true ? { features: 1 } : undefined - }; - } - - /** - * Ensures that names in clauses are resolved to addresses - * - * @param clauses - The clauses of the transaction. - * @returns A promise that resolves to clauses with resolved addresses - */ - public async resolveNamesInClauses( - clauses: TransactionClause[] - ): Promise { - // find unique names in the clause list - const uniqueNames = clauses.reduce((map, clause) => { - if ( - typeof clause.to === 'string' && - !map.has(clause.to) && - clause.to.includes('.') - ) { - map.set(clause.to, clause.to); - } - return map; - }, new Map()); - - const nameList = [...uniqueNames.keys()]; - - // no names, return the original clauses - if (uniqueNames.size === 0) { - return clauses; - } - - // resolve the names to addresses - const addresses = await vnsUtils.resolveNames( - this.blocksModule, - this, - nameList - ); - - // map unique names with resolved addresses - addresses.forEach((address, index) => { - if (address !== null) { - uniqueNames.set(nameList[index], address); - } - }); - - // replace names with resolved addresses, or leave unchanged - return clauses.map((clause) => { - if (typeof clause.to !== 'string') { - return clause; - } - - return { - to: uniqueNames.get(clause.to) ?? clause.to, - data: clause.data, - value: clause.value - }; - }); - } - - /** - * Simulates the execution of a transaction. - * Allows to estimate the gas cost of a transaction without sending it, as well as to retrieve the return value(s) of the transaction. - * - * @param clauses - The clauses of the transaction to simulate. - * @param options - (Optional) The options for simulating the transaction. - * @returns A promise that resolves to an array of simulation results. - * Each element of the array represents the result of simulating a clause. - * @throws {InvalidDataType} - */ - public async simulateTransaction( - clauses: SimulateTransactionClause[], - options?: SimulateTransactionOptions - ): Promise { - const { - revision, - caller, - gasPrice, - gasPayer, - gas, - blockRef, - expiration, - provedWork - } = options ?? {}; - if ( - revision !== undefined && - revision !== null && - !Revision.isValid(revision) - ) { - throw new InvalidDataType( - 'TransactionsModule.simulateTransaction()', - 'Invalid revision given as input. Input must be a valid revision (i.e., a block number or block ID).', - { revision } - ); - } - - return (await this.blocksModule.httpClient.http( - HttpMethod.POST, - thorest.accounts.post.SIMULATE_TRANSACTION(revision), - { - query: buildQuery({ revision }), - body: { - clauses: await this.resolveNamesInClauses( - clauses.map((clause) => { - return { - to: clause.to, - data: clause.data, - value: BigInt(clause.value).toString() - }; - }) - ), - gas, - gasPrice, - caller, - provedWork, - gasPayer, - expiration, - blockRef - } - } - )) as TransactionSimulationResult[]; - } - - /** - * Decode the revert reason from the encoded revert reason into a transaction. - * - * @param encodedRevertReason - The encoded revert reason to decode. - * @param errorFragment - (Optional) The error fragment to use to decode the revert reason (For Solidity custom errors). - * @returns A promise that resolves to the decoded revert reason. - * Revert reason can be a string error or Panic(error_code) - */ - public decodeRevertReason( - encodedRevertReason: string, - errorFragment?: string - ): string { - // Error selector - if (encodedRevertReason.startsWith(ERROR_SELECTOR)) - return ABI.ofEncoded( - 'string', - `0x${encodedRevertReason.slice(ERROR_SELECTOR.length)}` - ).getFirstDecodedValue(); - // Panic selector - else if (encodedRevertReason.startsWith(PANIC_SELECTOR)) { - const decoded = ABI.ofEncoded( - 'uint256', - `0x${encodedRevertReason.slice(PANIC_SELECTOR.length)}` - ).getFirstDecodedValue(); - return `Panic(0x${parseInt(decoded).toString(16).padStart(2, '0')})`; - } - // Solidity error, an error fragment is provided, so decode the revert reason using solidity error - else if (errorFragment !== undefined) { - const errorInterface = new Interface([ - ErrorFragment.from(errorFragment) - ]); - return errorInterface - .decodeErrorResult( - ErrorFragment.from(errorFragment), - encodedRevertReason - ) - .toArray()[0] as string; - } - - // Unknown revert reason (we know ONLY that transaction is reverted) - return ``; - } - - /** - * Get the revert reason of an existing transaction. - * - * @param transactionHash - The hash of the transaction to get the revert reason for. - * @param errorFragment - (Optional) The error fragment to use to decode the revert reason (For Solidity custom errors). - * @returns A promise that resolves to the revert reason of the transaction. - */ - public async getRevertReason( - transactionHash: string, - errorFragment?: string - ): Promise { - // 1 - Init Blocks and Debug modules - const blocksModule = this.blocksModule; - const debugModule = this.debugModule; - - // 2 - Get the transaction details - const transaction = await this.getTransaction(transactionHash); - - // 3 - Get the block details (to get the transaction index) - const block = - transaction !== null - ? ((await blocksModule.getBlockExpanded( - transaction.meta.blockID - )) as ExpandedBlockDetail) - : null; - - // Block or transaction not found - if (block === null || transaction === null) return null; - - // 4 - Get the transaction index into the block (we know the transaction is in the block) - const transactionIndex = getTransactionIndexIntoBlock( - blocksFormatter.formatToRPCStandard(block, ''), - transactionHash - ); - - // 5 - Get the error or panic reason. By iterating over the clauses of the transaction - for ( - let transactionClauseIndex = 0; - transactionClauseIndex < transaction.clauses.length; - transactionClauseIndex++ - ) { - // 5.1 - Debug the clause - const debuggedClause = (await debugModule.traceTransactionClause( - { - target: { - blockId: ThorId.of(block.id), - transaction: transactionIndex, - clauseIndex: transactionClauseIndex - }, - // Optimized for top call - config: { - OnlyTopCall: true - } - }, - 'call' - )) as CallNameReturnType; - - // 5.2 - Error or panic present, so decode the revert reason - if (debuggedClause.output !== undefined) { - return this.decodeRevertReason( - debuggedClause.output, - errorFragment - ); - } - } - - // No revert reason found - return null; - } - - /** - * Estimates the amount of gas required to execute a set of transaction clauses. - * - * @param {SimulateTransactionClause[]} clauses - An array of clauses to be simulated. Must contain at least one clause. - * @param {string} [caller] - The address initiating the transaction. Optional. - * @param {EstimateGasOptions} [options] - Additional options for the estimation, including gas padding. - * @return {Promise} - The estimated gas result, including total gas required, whether the transaction reverted, revert reasons, and any VM errors. - * @throws {InvalidDataType} - If clauses array is empty or if gas padding is not within the range (0, 1]. - * - * @see {@link TransactionsModule#simulateTransaction} - */ - public async estimateGas( - clauses: SimulateTransactionClause[], - caller?: string, - options?: EstimateGasOptions - ): Promise { - // Clauses must be an array of clauses with at least one clause - if (clauses.length <= 0) { - throw new InvalidDataType( - 'GasModule.estimateGas()', - 'Invalid clauses. Clauses must be an array of clauses with at least one clause.', - { clauses, caller, options } - ); - } - - // gasPadding must be a number between (0, 1] - if ( - options?.gasPadding !== undefined && - (options.gasPadding <= 0 || options.gasPadding > 1) - ) { - throw new InvalidDataType( - 'GasModule.estimateGas()', - 'Invalid gasPadding. gasPadding must be a number between (0, 1].', - { gasPadding: options?.gasPadding } - ); - } - - // Simulate the transaction to get the simulations of each clause - const simulations = await this.simulateTransaction(clauses, { - caller, - ...options - }); - - // If any of the clauses reverted, then the transaction reverted - const isReverted = simulations.some((simulation) => { - return simulation.reverted; - }); - - // The intrinsic gas of the transaction - const intrinsicGas = Number(Transaction.intrinsicGas(clauses).wei); - - // totalSimulatedGas represents the summation of all clauses' gasUsed - const totalSimulatedGas = simulations.reduce((sum, simulation) => { - return sum + simulation.gasUsed; - }, 0); - - // The total gas of the transaction - // If the transaction involves contract interaction, a constant 15000 gas is added to the total gas - const totalGas = - (intrinsicGas + - (totalSimulatedGas !== 0 ? totalSimulatedGas + 15000 : 0)) * - (1 + (options?.gasPadding ?? 0)); // Add gasPadding if it is defined - - return isReverted - ? { - totalGas, - reverted: true, - revertReasons: simulations.map((simulation) => { - /** - * The decoded revert reason of the transaction. - * Solidity may revert with Error(string) or Panic(uint256). - * - * @link see [Error handling: Assert, Require, Revert and Exceptions](https://docs.soliditylang.org/en/latest/control-structures.html#error-handling-assert-require-revert-and-exceptions) - */ - return decodeRevertReason(simulation.data) ?? ''; - }), - vmErrors: simulations.map((simulation) => { - return simulation.vmError; - }) - } - : { - totalGas, - reverted: false, - revertReasons: [], - vmErrors: [] - }; - } - - /** - * Executes a read-only call to a smart contract function, simulating the transaction to obtain the result. - * - * The method simulates a transaction using the provided parameters - * without submitting it to the blockchain, allowing read-only operations - * to be tested without incurring gas costs or modifying the blockchain state. - * - * @param {string} contractAddress - The address of the smart contract. - * @param {ABIFunction} functionAbi - The ABI definition of the smart contract function to be called. - * @param {unknown[]} functionData - The arguments to be passed to the smart contract function. - * @param {ContractCallOptions} [contractCallOptions] - Optional parameters for the contract call execution. - * @return {Promise} The result of the contract call. - */ - public async executeCall( - contractAddress: string, - functionAbi: ABIFunction, - functionData: unknown[], - contractCallOptions?: ContractCallOptions - ): Promise { - // Simulate the transaction to get the result of the contract call - const response = await this.simulateTransaction( - [ - { - to: contractAddress, - value: '0', - data: functionAbi.encodeData(functionData).toString() - } - ], - contractCallOptions - ); - - return this.getContractCallResult( - response[0].data, - functionAbi, - response[0].reverted - ); - } - - /** - * Executes and simulates multiple read-only smart-contract clause calls, - * simulating the transaction to obtain the results. - * - * @param {ContractClause[]} clauses - The array of contract clauses to be executed. - * @param {SimulateTransactionOptions} [options] - Optional simulation transaction settings. - * @return {Promise} - The decoded results of the contract calls. - */ - public async executeMultipleClausesCall( - clauses: ContractClause[], - options?: SimulateTransactionOptions - ): Promise { - // Simulate the transaction to get the result of the contract call - const response = await this.simulateTransaction( - clauses.map((clause) => clause.clause), - options - ); - // Returning the decoded results both as plain and array. - return response.map((res, index) => - this.getContractCallResult( - res.data, - clauses[index].functionAbi, - res.reverted - ) - ); - } - - /** - * Executes a transaction with a smart-contract on the VeChain blockchain. - * - * @param {VeChainSigner} signer - The signer instance to sign the transaction. - * @param {string} contractAddress - The address of the smart contract. - * @param {ABIFunction} functionAbi - The ABI of the contract function to be called. - * @param {unknown[]} functionData - The input parameters for the contract function. - * @param {ContractTransactionOptions} [options] - Optional transaction parameters. - * @return {Promise} - A promise that resolves to the result of the transaction. - * - * @see {@link TransactionsModule.buildTransactionBody} - */ - public async executeTransaction( - signer: VeChainSigner, - contractAddress: string, - functionAbi: ABIFunction, - functionData: unknown[], - options?: ContractTransactionOptions - ): Promise { - // Sign the transaction - const id = await signer.sendTransaction({ - clauses: [ - // Build a clause to interact with the contract function - Clause.callFunction( - Address.of(contractAddress), - functionAbi, - functionData, - VET.of(options?.value ?? 0, Units.wei) - ) - ], - gas: options?.gas, - gasLimit: options?.gasLimit, - gasPrice: options?.gasPrice, - gasPriceCoef: options?.gasPriceCoef, - nonce: options?.nonce, - value: options?.value, - dependsOn: options?.dependsOn, - expiration: options?.expiration, - chainTag: options?.chainTag, - blockRef: options?.blockRef, - delegationUrl: options?.delegationUrl, - comment: options?.comment - }); - - return { - id, - wait: async () => await this.waitForTransaction(id) - }; - } - - /** - * Executes a transaction with multiple clauses on the VeChain blockchain. - * - * @param {ContractClause[]} clauses - Array of contract clauses to be included in the transaction. - * @param {VeChainSigner} signer - A VeChain signer instance used to sign and send the transaction. - * @param {ContractTransactionOptions} [options] - Optional parameters to customize the transaction. - * @return {Promise} The result of the transaction, including transaction ID and a wait function. - */ - public async executeMultipleClausesTransaction( - clauses: ContractClause[], - signer: VeChainSigner, - options?: ContractTransactionOptions - ): Promise { - const id = await signer.sendTransaction({ - clauses: clauses.map((clause) => clause.clause), - gas: options?.gas, - gasLimit: options?.gasLimit, - gasPrice: options?.gasPrice, - gasPriceCoef: options?.gasPriceCoef, - nonce: options?.nonce, - value: options?.value, - dependsOn: options?.dependsOn, - expiration: options?.expiration, - chainTag: options?.chainTag, - blockRef: options?.blockRef, - delegationUrl: options?.delegationUrl, - comment: options?.comment - }); - - return { - id, - wait: async () => await this.waitForTransaction(id) - }; - } - - /** - * Retrieves the base gas price from the blockchain parameters. - * - * This method sends a call to the blockchain parameters contract to fetch the current base gas price. - * The base gas price is the minimum gas price that can be used for a transaction. - * It is used to obtain the VTHO (energy) cost of a transaction. - * @link [Total Gas Price](https://docs.vechain.org/core-concepts/transactions/transaction-calculation#total-gas-price) - * - * @return {Promise} A promise that resolves to the result of the contract call, containing the base gas price. - */ - public async getBaseGasPrice(): Promise { - return await this.executeCall( - BUILT_IN_CONTRACTS.PARAMS_ADDRESS, - ABIContract.ofAbi(BUILT_IN_CONTRACTS.PARAMS_ABI).getFunction('get'), - [dataUtils.encodeBytes32String('base-gas-price', 'left')] - ); - } - - /** - * Decode the result of a contract call from the result of a simulated transaction. - * - * @param {string} encodedData - The encoded data received from the contract call. - * @param {ABIFunction} functionAbi - The ABI function definition used for decoding the result. - * @param {boolean} reverted - Indicates if the contract call reverted. - * @return {ContractCallResult} An object containing the success status and the decoded result. - */ - private getContractCallResult( - encodedData: string, - functionAbi: ABIFunction, - reverted: boolean - ): ContractCallResult { - if (reverted) { - const errorMessage = decodeRevertReason(encodedData) ?? ''; - return { - success: false, - result: { - errorMessage - } - }; - } - - // Returning the decoded result both as plain and array. - const encodedResult = Hex.of(encodedData); - const plain = functionAbi.decodeResult(encodedResult); - const array = functionAbi.decodeOutputAsArray(encodedResult); - return { - success: true, - result: { - plain, - array - } - }; - } -} - -export { TransactionsModule }; diff --git a/packages/network/src/thor-client/transactions/types.d.ts b/packages/network/src/thor-client/transactions/types.d.ts deleted file mode 100644 index 9ff3c1d01..000000000 --- a/packages/network/src/thor-client/transactions/types.d.ts +++ /dev/null @@ -1,331 +0,0 @@ -import type { TransactionBody, TransactionClause } from '@vechain/sdk-core'; -import type { Output } from '../blocks'; -import { type Transfer } from '../logs'; - -/** - * Transaction clause type for transaction simulation having value only string. - */ -type SimulateTransactionClause = TransactionClause; - -/* --- Input options start --- */ - -/** - * Options for `waitForTransaction` method. - */ -interface WaitForTransactionOptions { - /** - * Timeout in milliseconds. - * After this time, the method will throw an error. - */ - timeoutMs?: number; - /** - * Interval in milliseconds. - * The method will check the transaction status every `intervalMs` milliseconds. - */ - intervalMs?: number; -} - -/** - * Options for `buildTransactionBody` method. - */ -interface TransactionBodyOptions { - /** - * 8 bytes prefix of some block's ID - */ - blockRef?: string; - - /** - * Last byte of genesis block ID - */ - chainTag?: number; - - /** - * The ID of the transaction that this transaction depends on. - */ - dependsOn?: string; - - /** - * The expiration time of the transaction. - * The transaction will expire after the number of blocks specified by this value. - */ - expiration?: number; - - /** - * Transaction gas. - */ - gas?: string | number; - - /** - * The maximum amount of gas to allow this transaction to consume. - */ - gasLimit?: string; - - /** - * The gas price to use for legacy transactions or transactions on - * legacy networks. - * - * Most of the time the ``max*FeePerGas`` is preferred. - */ - gasPrice?: string; - - /** - * Coefficient used to calculate the gas price for the transaction. - * Value must be between 0 and 255. - */ - gasPriceCoef?: number; - - /** - * Whether the transaction is delegated to another account for gas payment. - */ - isDelegated?: boolean; - - /** - * Nonce value for various purposes. - * Basic is to prevent replay attack by make transaction unique. - * Every transaction with same chainTag, blockRef, ... must have different nonce. - */ - nonce?: string | number; -} - -/** - * Options for `signTransaction` method. - */ -type SignTransactionOptions = - | { delegatorUrl: string; delegatorPrivateKey?: never } - | { delegatorPrivateKey: string; delegatorUrl?: never }; - -/** - * Input options for: - * * getTransactionReceipt - * Methods - */ -interface GetTransactionReceiptInputOptions { - /** - * (Optional) The block number or ID to reference the transaction. - */ - head?: string; -} - -/** - * Input options for: - * * getTransaction - * Methods - */ -type GetTransactionInputOptions = GetTransactionReceiptInputOptions & { - /** - * (Optional) If true, returns the pending transaction details instead of the final transaction details. - */ - pending?: boolean; -}; - -/** - * Type for transaction simulation options. - */ -interface SimulateTransactionOptions { - /** - * The block number or block ID of which the transaction simulation is based on - */ - revision?: string; - /** - * The offered gas for the transaction simulation - */ - gas?: string | number; - /** - * The price of gas for the transaction simulation - */ - gasPrice?: string; - /** - * The caller of the transaction simulation. (i.e., the address that performs the transaction) - */ - caller?: string; - - // ------ START: EXTENDED EVM CONTEXT OPTIONS ------ // - - /* - The following options are useful when simulating transactions that provide additional context to the EVM. - The additional context is handled by the built-in Extension-V2 Smart contract (https://docs.vechain.org/developer-resources/built-in-contracts#extension-v2-sol) - - The contract allows for smart contract developers to obtain additional context about the transaction in their smart contract code, for example: - - The expiration of the transaction - - The block reference of the transaction - - The gas payer of the transaction - - The proved work of the transaction (https://docs.vechain.org/core-concepts/transactions/transaction-calculation#proof-of-work) - */ - - /** - * The VeChainThor blockchain allows for transaction-level proof of work (PoW) and converts the proved work into extra gas price that will be used by - * the system to generate more reward to the block generator, the Authority Master node, that validates the transaction. - * In other words, users can utilize their local computational power to make their transactions more likely to be included in a new block. - * - * @link [VeChainThor Proof of Work](https://docs.vechain.org/core-concepts/transactions/transaction-calculation#proof-of-work) - */ - provedWork?: string; - /** - * The address that pays for the gas fee of the transaction simulation. - * If different from the caller, then a delegated transaction is simulated. - */ - gasPayer?: string; - /** - * The expiration of the transaction simulation. - * Represents how long, in terms of the number of blocks, the transaction will be allowed to be mined in VeChainThor - */ - expiration?: number; - /** - * BlockRef stores the reference to a particular block whose next block is the earliest block the current transaction can be included. - * - * @link [VeChainThor BlockRef](https://docs.vechain.org/core-concepts/transactions/meta-transaction-features/controllable-transaction-lifecycle) - */ - blockRef?: string; - - // ------ END: EXTENDED EVM CONTEXT OPTIONS ------ // -} - -/* --- Input options end --- */ - -/* --- Responses Outputs start --- */ - -/** - * Represents the result of sending a transaction. - * - * @interface SendTransactionResult - */ -interface SendTransactionResult { - /** - * The unique identifier associated with the transaction. - * - * @type {string} - */ - id: string; - - wait: () => Promise; -} - -/** - * Represents the result of getting a delegation signature. - */ -interface GetDelegationSignatureResult { - /** - * The signature of the transaction. - */ - signature: string; -} - -/** - * Transaction Metadata interface. - */ -interface TransactionMetadata { - blockID: string; - blockNumber: number; - blockTimestamp: number; - txID?: string; - txOrigin?: string; -} - -/** - * Type for RAW transaction detail. - * It is the response of `getTransaction` with `raw` set to `true`. - */ -interface TransactionDetailRaw { - /** - * Raw data - */ - raw: string; - /** - * Transaction meta data - */ - meta: Omit; -} - -/** - * Type for NO RAW transaction detail. - * It is the response of `getTransaction` with `raw` set to `false`. - */ -type TransactionDetailNoRaw = TransactionBody & { - id: string; - origin: string; - delegator: string | null; - size: number; - meta: TransactionMetadata; -}; - -/** - * Type for transaction receipt. - */ -interface TransactionReceipt { - /** - * Gas used in the transaction - */ - gasUsed: number; - /** - * For delegated transactions the gas payer - * */ - gasPayer: string; - /** - * Energy paid for used gas - */ - paid: string; - /** - * Energy reward given to block proposer - */ - reward: string; - /** - * If the transaction has been reverted - */ - reverted: boolean; - /** - * Outputs of the transaction, e.g. contract, events, transfers - */ - outputs: Output[]; - /** - * Data associated with the transaction e.g. blockID, blockNumber, txID - */ - meta: TransactionMetadata; -} - -/** - * Type for transaction call simulation result. - */ -interface TransactionSimulationResult { - /** - * Data returned from the transaction simulation - */ - data: string; - /** - * Events emitted from the transaction simulation - */ - events: Event[]; - /** - * Transfers that occur from the transaction simulation - */ - transfers: Transfer[]; - /** - * Gas used from the transaction simulation - */ - gasUsed: number; - /** - * Boolean indicating if the transaction simulation reverted - */ - reverted: boolean; - /** - * Error message from the transaction simulation if it reverted - */ - vmError: string; -} - -/* --- Responses Outputs end --- */ - -export type { - WaitForTransactionOptions, - TransactionBodyOptions, - SignTransactionOptions, - GetDelegationSignatureResult, - SendTransactionResult, - GetTransactionInputOptions, - GetTransactionReceiptInputOptions, - TransactionReceipt, - TransactionSimulationResult, - SimulateTransactionClause, - SimulateTransactionOptions, - TransactionDetailRaw, - TransactionDetailNoRaw -}; diff --git a/packages/network/src/utils/const/built-in/built-in.ts b/packages/network/src/utils/const/built-in/built-in.ts deleted file mode 100644 index 5a50f76a5..000000000 --- a/packages/network/src/utils/const/built-in/built-in.ts +++ /dev/null @@ -1,363 +0,0 @@ -/** - * Address of the Params built-in contract. - * - * @link see [params.sol](https://docs.vechain.org/developer-resources/built-in-contracts#params-sol) - */ -const PARAMS_ADDRESS = '0x0000000000000000000000000000506172616d73'; - -/** - * Address of the Energy built-in contract. - * - * @link see [energy.sol](https://docs.vechain.org/developer-resources/built-in-contracts#energy-sol) - */ -const ENERGY_ADDRESS = '0x0000000000000000000000000000456e65726779'; - -/** - * ABI of the Params built-in contract. - * - * @link see [params.sol](https://docs.vechain.org/developer-resources/built-in-contracts#params-sol) - */ -const PARAMS_ABI = [ - { - constant: false, - inputs: [ - { - name: '_key', - type: 'bytes32' - }, - { - name: '_value', - type: 'uint256' - } - ], - name: 'set', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [ - { - name: '_key', - type: 'bytes32' - } - ], - name: 'get', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'executor', - outputs: [ - { - name: '', - type: 'address' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: 'key', - type: 'bytes32' - }, - { - indexed: false, - name: 'value', - type: 'uint256' - } - ], - name: 'Set', - type: 'event' - } -] as const; - -/** - * ABI of the Energy built-in contract. (VTHO) - * - * @link see [energy.sol](https://docs.vechain.org/developer-resources/built-in-contracts#energy-sol) - */ -const ENERGY_ABI = [ - { - constant: true, - inputs: [], - name: 'name', - outputs: [ - { - name: '', - type: 'string' - } - ], - payable: false, - stateMutability: 'pure', - type: 'function' - }, - { - constant: false, - inputs: [ - { - name: '_spender', - type: 'address' - }, - { - name: '_value', - type: 'uint256' - } - ], - name: 'approve', - outputs: [ - { - name: 'success', - type: 'bool' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'totalSupply', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address' - }, - { - name: '_to', - type: 'address' - }, - { - name: '_amount', - type: 'uint256' - } - ], - name: 'transferFrom', - outputs: [ - { - name: 'success', - type: 'bool' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'decimals', - outputs: [ - { - name: '', - type: 'uint8' - } - ], - payable: false, - stateMutability: 'pure', - type: 'function' - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address' - } - ], - name: 'balanceOf', - outputs: [ - { - name: 'balance', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'symbol', - outputs: [ - { - name: '', - type: 'string' - } - ], - payable: false, - stateMutability: 'pure', - type: 'function' - }, - { - constant: false, - inputs: [ - { - name: '_to', - type: 'address' - }, - { - name: '_amount', - type: 'uint256' - } - ], - name: 'transfer', - outputs: [ - { - name: 'success', - type: 'bool' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address' - }, - { - name: '_to', - type: 'address' - }, - { - name: '_amount', - type: 'uint256' - } - ], - name: 'move', - outputs: [ - { - name: 'success', - type: 'bool' - } - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function' - }, - { - constant: true, - inputs: [], - name: 'totalBurned', - outputs: [ - { - name: '', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address' - }, - { - name: '_spender', - type: 'address' - } - ], - name: 'allowance', - outputs: [ - { - name: 'remaining', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_from', - type: 'address' - }, - { - indexed: true, - name: '_to', - type: 'address' - }, - { - indexed: false, - name: '_value', - type: 'uint256' - } - ], - name: 'Transfer', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: '_owner', - type: 'address' - }, - { - indexed: true, - name: '_spender', - type: 'address' - }, - { - indexed: false, - name: '_value', - type: 'uint256' - } - ], - name: 'Approval', - type: 'event' - } -] as const; - -/** - * Built-in contracts. - */ -export const BUILT_IN_CONTRACTS = { - PARAMS_ABI, - PARAMS_ADDRESS, - ENERGY_ABI, - ENERGY_ADDRESS -}; diff --git a/packages/network/src/utils/const/built-in/index.ts b/packages/network/src/utils/const/built-in/index.ts deleted file mode 100644 index 17b1b000e..000000000 --- a/packages/network/src/utils/const/built-in/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './built-in'; diff --git a/packages/network/src/utils/const/client/http-client.ts b/packages/network/src/utils/const/client/http-client.ts deleted file mode 100644 index 7c2ad7c9c..000000000 --- a/packages/network/src/utils/const/client/http-client.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * HTTP regex. - */ -const HTTP_REGEX: RegExp = /^http:\/\//; - -/** - * HTTPS regex. - */ -const HTTPS_REGEX: RegExp = /^https:\/\//; - -export { HTTP_REGEX, HTTPS_REGEX }; diff --git a/packages/network/src/utils/const/client/index.ts b/packages/network/src/utils/const/client/index.ts deleted file mode 100644 index 5b7f07c47..000000000 --- a/packages/network/src/utils/const/client/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './http-client'; -export * from './nodes'; -export * from './transactions'; diff --git a/packages/network/src/utils/const/client/nodes.ts b/packages/network/src/utils/const/client/nodes.ts deleted file mode 100644 index 675f95300..000000000 --- a/packages/network/src/utils/const/client/nodes.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Node healthcheck Tolerance in seconds. - * @example When set to 30, it means that we consider a node healthy even when it's off-sync by roughly 3 blocks. - */ -const NODE_HEALTHCHECK_TOLERANCE_IN_SECONDS = 30; - -export { NODE_HEALTHCHECK_TOLERANCE_IN_SECONDS }; diff --git a/packages/network/src/utils/const/client/transactions.ts b/packages/network/src/utils/const/client/transactions.ts deleted file mode 100644 index daf6e627a..000000000 --- a/packages/network/src/utils/const/client/transactions.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Keccak256, Txt } from '@vechain/sdk-core'; - -/** - * The selector for the error event. - */ -const ERROR_SELECTOR = Keccak256.of(Txt.of('Error(string)').bytes) - .toString() - .slice(0, 10); - -/** - * The selector for the panic event. - */ -const PANIC_SELECTOR = Keccak256.of(Txt.of('Panic(uint256)').bytes) - .toString() - .slice(0, 10); - -export { ERROR_SELECTOR, PANIC_SELECTOR }; diff --git a/packages/network/src/utils/const/index.ts b/packages/network/src/utils/const/index.ts deleted file mode 100644 index 9d0ae8860..000000000 --- a/packages/network/src/utils/const/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './built-in'; -export * from './client'; -export * from './network'; -export * from './rpc'; -export * from './thor-solo'; diff --git a/packages/network/src/utils/const/network/index.ts b/packages/network/src/utils/const/network/index.ts deleted file mode 100644 index a31b9ed5f..000000000 --- a/packages/network/src/utils/const/network/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './network'; diff --git a/packages/network/src/utils/const/network/network.ts b/packages/network/src/utils/const/network/network.ts deleted file mode 100644 index 38de94a7b..000000000 --- a/packages/network/src/utils/const/network/network.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Url of the mainnet - */ -const MAINNET_URL = 'https://mainnet.vechain.org'; - -/** - * Url of the testnet - */ -const TESTNET_URL = 'https://testnet.vechain.org'; - -/** - * Url of the solo network - */ -const THOR_SOLO_URL = 'http://localhost:8669'; - -export { MAINNET_URL, TESTNET_URL, THOR_SOLO_URL }; diff --git a/packages/network/src/utils/const/rpc/index.ts b/packages/network/src/utils/const/rpc/index.ts deleted file mode 100644 index e2c825252..000000000 --- a/packages/network/src/utils/const/rpc/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './rpc'; diff --git a/packages/network/src/utils/const/rpc/rpc.ts b/packages/network/src/utils/const/rpc/rpc.ts deleted file mode 100644 index 1bba7b8e3..000000000 --- a/packages/network/src/utils/const/rpc/rpc.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Documentation link of RPC methods - */ -const RPC_DOCUMENTATION_URL = - 'https://ethereum.github.io/execution-apis/api-documentation/'; - -export { RPC_DOCUMENTATION_URL }; diff --git a/packages/network/src/utils/const/thor-solo/index.ts b/packages/network/src/utils/const/thor-solo/index.ts deleted file mode 100644 index 39381fcee..000000000 --- a/packages/network/src/utils/const/thor-solo/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './thor-solo'; diff --git a/packages/network/src/utils/const/thor-solo/thor-solo.ts b/packages/network/src/utils/const/thor-solo/thor-solo.ts deleted file mode 100644 index a010bba55..000000000 --- a/packages/network/src/utils/const/thor-solo/thor-solo.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * All available Thor solo accounts for testing purposes. - * - * * Every account has 500000000 VET and at least 500000000 VTHO. - * * Every account has a private key and an address. (both as hex string) - */ -const THOR_SOLO_ACCOUNTS: Array<{ privateKey: string; address: string }> = [ - /* ----------- NEW ACCOUNTS ----------- */ - /** - * Each new account starts with - * - VET: 500000000 - * - VTHO: at least 500000000 (VTHO is not constant due to generation when having VET) - */ - { - privateKey: - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158', - address: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535' - }, - { - privateKey: - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5', - address: '0x2669514f9fe96bc7301177ba774d3da8a06cace4' - }, - { - privateKey: - '1758771c54938e977518e4ff1c297aca882f6598891df503030734532efa790e', - address: '0x9e7911de289c3c856ce7f421034f66b6cde49c39' - }, - { - privateKey: - '432f38bcf338c374523e83fdb2ebe1030aba63c7f1e81f7d76c5f53f4d42e766', - address: '0x88b2551c3ed42ca663796c10ce68c88a65f73fe2' - }, - { - privateKey: - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff', - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' - }, - { - privateKey: - 'f9fc826b63a35413541d92d2bfb6661128cd5075fcdca583446d20c59994ba26', - address: '0x7a28e7361fd10f4f058f9fefc77544349ecff5d6' - }, - { - privateKey: - '0da72e8e26580d409d1837e23cc50c887358964152039e32af0c8a147c6b616d', - address: '0xb717b660cd51109334bd10b2c168986055f58c1a' - }, - { - privateKey: - '6e8ad4e4ffb888082d94975a58dc9a8179f8724ba22301cd8392ba5352af7e25', - address: '0x62226ae029dabcf90f3cb66f091919d2687d5257' - }, - { - privateKey: - '521b7793c6eb27d137b617627c6b85d57c0aa303380e9ca4e30a30302fbc6676', - address: '0x062f167a905c1484de7e75b88edc7439f82117de' - }, - { - privateKey: - 'adc81265b0909dec70235ec973b1758e45ce5ce7cfe92eb96b79cd0ef07bc6bc', - address: '0x3e3d79163b08502a086213cd09660721740443d7' - }, - /* ----------- THOR SOLO GENESIS ACCOUNTS ----------- */ - /** - * Each Thor Solo genesis account has - * - VET: 500000000 - * - VTHO: at least 1365000000 (VTHO is not constant due to generation when having VET) - */ - { - privateKey: - '99f0500549792796c14fed62011a51081dc5b5e68fe8bd8a13b86be829c4fd36', - address: '0xf077b491b355e64048ce21e3a6fc4751eeea77fa' - }, - { - privateKey: - '7b067f53d350f1cf20ec13df416b7b73e88a1dc7331bc904b92108b1e76a08b1', - address: '0x435933c8064b4ae76be665428e0307ef2ccfbd68' - }, - { - privateKey: - 'f4a1a17039216f535d42ec23732c79943ffb45a089fbb78a14daad0dae93e991', - address: '0x0f872421dc479f3c11edd89512731814d0598db5' - }, - { - privateKey: - '35b5cc144faca7d7f220fca7ad3420090861d5231d80eb23e1013426847371c4', - address: '0xf370940abdbd2583bc80bfc19d19bc216c88ccf0' - }, - { - privateKey: - '10c851d8d6c6ed9e6f625742063f292f4cf57c2dbeea8099fa3aca53ef90aef1', - address: '0x99602e4bbc0503b8ff4432bb1857f916c3653b85' - }, - { - privateKey: - '2dd2c5b5d65913214783a6bd5679d8c6ef29ca9f2e2eae98b4add061d0b85ea0', - address: '0x61e7d0c2b25706be3485980f39a3a994a8207acf' - }, - { - privateKey: - 'e1b72a1761ae189c10ec3783dd124b902ffd8c6b93cd9ff443d5490ce70047ff', - address: '0x361277d1b27504f36a3b33d3a52d1f8270331b8c' - }, - { - privateKey: - '35cbc5ac0c3a2de0eb4f230ced958fd6a6c19ed36b5d2b1803a9f11978f96072', - address: '0xd7f75a0a1287ab2916848909c8531a0ea9412800' - }, - { - privateKey: - 'b639c258292096306d2f60bc1a8da9bc434ad37f15cd44ee9a2526685f592220', - address: '0xabef6032b9176c186f6bf984f548bda53349f70a' - }, - { - privateKey: - '9d68178cdc934178cca0a0051f40ed46be153cf23cb1805b59cc612c0ad2bbe0', - address: '0x865306084235bf804c8bba8a8d56890940ca8f0b' - } -]; - -export { THOR_SOLO_ACCOUNTS }; diff --git a/packages/network/src/utils/helpers/index.ts b/packages/network/src/utils/helpers/index.ts deleted file mode 100644 index 56e4b0555..000000000 --- a/packages/network/src/utils/helpers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './request'; diff --git a/packages/network/src/utils/helpers/request.ts b/packages/network/src/utils/helpers/request.ts deleted file mode 100644 index 9778fc4e3..000000000 --- a/packages/network/src/utils/helpers/request.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Constructs a query object for HTTP requests by filtering out undefined values. - * - * @param params - An object containing the query parameters with potential undefined values. - * @returns An object containing only the defined query parameters. - */ -const buildQuery = ( - params: Record -): Record => { - const definedParams: Record = {}; - - // Iterate over each property in the params object - for (const key in params) { - // Check if the value is not undefined - if (params[key] !== undefined) { - // If the value is defined, add it to the definedParams object - definedParams[key] = params[key] as string; - } - } - - return definedParams; -}; - -export { buildQuery }; diff --git a/packages/network/src/utils/index.ts b/packages/network/src/utils/index.ts deleted file mode 100644 index 7ca784b48..000000000 --- a/packages/network/src/utils/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './const'; -export * from './helpers'; -export * from './poll'; -export * from './thorest'; -export * from './subscriptions'; -export * from './vns'; diff --git a/packages/network/src/utils/poll/event.ts b/packages/network/src/utils/poll/event.ts deleted file mode 100644 index 160e765a0..000000000 --- a/packages/network/src/utils/poll/event.ts +++ /dev/null @@ -1,274 +0,0 @@ -import { EventEmitter } from 'events'; -import { InvalidDataType, PollExecution } from '@vechain/sdk-errors'; - -/** - * Poll in an event based way. - * This Poll is Asynchronous. It exploits: - * - The EventEmitter to emit events - * - The setInterval function to poll - * - * @example It can be used to trigger events every time - * - When balance is updated after a transaction is sent a message is sent - * - When a transaction is mined a message is sent - * - When a certain block is mined an operation can start - * ... - */ -class EventPoll extends EventEmitter { - /** - * The current iteration. It counts how many iterations have been done. - * This parameter is useful to know how many iterations have been done. - * For example, it can be used to stop the poll after a certain number of iterations. - */ - private currentIteration: number = 0; - - /** - * Error thrown during the execution of the poll. - */ - private error?: Error; - - /** - * Indicates whether to stop execution on error of the - * {@link _intervalLoop} function. - * - * @type {boolean} - */ - private readonly hasToStopOnError: boolean; - - /** - * The interval used to poll. - */ - private intervalId?: NodeJS.Timeout; - - /** - * The function to be called. - */ - private readonly pollingFunction: () => Promise; - - /** - * The interval of time (in milliseconds) between each request. - */ - private readonly requestIntervalInMilliseconds: number; - - /** - * Constructor for creating an instance of EventPoll. - * - * @param {Function} pollingFunction - The function to be executed repeatedly. - * @param {number} requestIntervalInMilliseconds - The interval in milliseconds between each execution of the polling function. - * @param {boolean} [hasToStopOnError=true] - Indicates whether to stop polling if an error occurs. - * @throws {InvalidDataType} - */ - constructor( - pollingFunction: () => Promise, - requestIntervalInMilliseconds: number, - hasToStopOnError: boolean - ) { - super(); - this.pollingFunction = pollingFunction; - this.hasToStopOnError = hasToStopOnError; - - // Positive number for request interval - if ( - requestIntervalInMilliseconds !== undefined && - (requestIntervalInMilliseconds <= 0 || - !Number.isInteger(requestIntervalInMilliseconds)) - ) { - throw new InvalidDataType( - 'SyncPoll()', - 'Polling failed: Invalid input for field "options?.maximumWaitingTimeInMilliseconds" it must be a positive number', - { - requestIntervalInMilliseconds - } - ); - } - - this.requestIntervalInMilliseconds = requestIntervalInMilliseconds; - } - - /** - * Get how many iterations have been done. - * - * @returns The number of iterations. - */ - public get getCurrentIteration(): number { - return this.currentIteration; - } - - /** - * Basic interval loop function. - * This function must be called into setInterval. - * It calls the promise and emit the event. - */ - private async _intervalLoop(): Promise { - try { - // Get data and emit the event - const data = await this.pollingFunction(); - this.emit('data', { data, eventPoll: this }); - } catch (error) { - // Set error - this.error = new PollExecution( - 'EventPoll - main interval loop function', - `Error during the execution of the poll ${(error as Error).message}`, - { - functionName: this.pollingFunction.name - } - ); - - // Emit the error - this.emit('error', { error: this.error }); - - // Stop listening? - if (this.hasToStopOnError) { - this.stopListen(); - } - } - - // Increment the iteration - this.currentIteration = this.currentIteration + 1; - } - - /** - * Listen to the 'data' event. - * This method is the redefinition of the EventEmitter.on method. - * Because the EventEmitter.on method does not allow to specify the type of the data. - * And we must be type safe. - * - * This is equivalent to: - * - * ```typescript - * eventPoll.on('data', (data) => { ... }); - * ``` - * @param onDataCallback - The callback to be called when the event is emitted. - */ - public onData( - onDataCallback: ( - data: TReturnType, - eventPoll: EventPoll - ) => void - ): this { - this.on('data', (data) => { - onDataCallback( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - data.data as TReturnType, - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - data.eventPoll as EventPoll - ); - }); - - return this; - } - - /* --- Overloaded of 'on' event emitter start --- */ - - /** - * Listen to the 'error' event. - * This method is the redefinition of the EventEmitter.on method. - * Because the EventEmitter.on method does not allow to specify the type of the data. - * And we must be type safe. - * - * This is equivalent to: - * - * ```typescript - * eventPoll.on('error', (data) => { ... }); - * ``` - * @param onErrorCallback - The callback to be called when the event is emitted. - */ - public onError(onErrorCallback: (error: Error) => void): this { - this.on('error', (error) => { - onErrorCallback( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - error.error as Error - ); - }); - - return this; - } - - /** - * Listen to the 'start' event. - * This happens when the poll is stopped. - * - * @param onStartCallback - The callback to be called when the event is emitted. - */ - public onStart( - onStartCallback: (eventPoll: EventPoll) => void - ): this { - this.on('start', (data) => { - onStartCallback( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - data.eventPoll as EventPoll - ); - }); - - return this; - } - - /** - * Listen to the 'stop' event. - * This happens when the poll is stopped. - * - * @param onStopCallback - The callback to be called when the event is emitted. - */ - public onStop( - onStopCallback: (eventPoll: EventPoll) => void - ): this { - this.on('stop', (data) => { - onStopCallback( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - data.eventPoll as EventPoll - ); - }); - - return this; - } - - /** - * Start listening to the event. - */ - startListen(): void { - // Start listening - this.emit('start', { eventPoll: this }); - - // Execute `_intervalLoop` and then set an interval which calls `_intervalLoop` every `requestIntervalInMilliseconds` - void this._intervalLoop().then(() => { - // Create an interval - this.intervalId = setInterval(() => { - void (async () => { - await this._intervalLoop(); - })(); - }, this.requestIntervalInMilliseconds); - }); // No need for .catch(), errors are handled within _intervalLoop - } - - /** - * Stop listening to the event. - */ - stopListen(): void { - clearInterval(this.intervalId); - this.emit('stop', { eventPoll: this }); - } - - /* --- Overloaded of 'on' event emitter end --- */ -} - -/** - * Creates an event poll that performs a callback function repeatedly at a specified interval. - * This method is useful to create an event poll in a more readable way. - * - * @param {Function} callBack - The callback function to be executed on each interval. It should return a Promise. - * @param {number} requestIntervalInMilliseconds - The interval in milliseconds at which the callback function will be executed. - * @param {boolean} [hasToStopOnError=true] - Optional parameter to specify whether the poll should stop on error. Default is true. - * @returns {EventPoll} - The created event poll instance. - */ -function createEventPoll( - callBack: () => Promise, - requestIntervalInMilliseconds: number, - hasToStopOnError: boolean = true -): EventPoll { - return new EventPoll( - callBack, - requestIntervalInMilliseconds, - hasToStopOnError - ); -} - -export { EventPoll, createEventPoll }; diff --git a/packages/network/src/utils/poll/index.ts b/packages/network/src/utils/poll/index.ts deleted file mode 100644 index f6c84e9a3..000000000 --- a/packages/network/src/utils/poll/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Synchronous Polling -import { SyncPoll } from './sync'; - -// Asynchronous Event Polling -import { createEventPoll, type EventPoll } from './event'; - -// Types -export type * from './types.d'; - -const Poll = { SyncPoll, createEventPoll }; -export { Poll, type EventPoll }; diff --git a/packages/network/src/utils/poll/sync.ts b/packages/network/src/utils/poll/sync.ts deleted file mode 100644 index 93bbe5ede..000000000 --- a/packages/network/src/utils/poll/sync.ts +++ /dev/null @@ -1,164 +0,0 @@ -import { type SyncPollInputOptions } from './types'; -import { InvalidDataType, PollExecution } from '@vechain/sdk-errors'; - -/** - * Sleep for a given amount of time (in milliseconds). - * - * @param delayInMilliseconds - The amount of time to sleep in milliseconds. - */ -async function sleep(delayInMilliseconds: number): Promise { - await new Promise((resolve) => setTimeout(resolve, delayInMilliseconds)); -} - -/** - * Poll until the condition is met. - * - * @note: Be careful!, this function is synchronous and will block the thread until the condition is met. - * Thus mean it can run forever if the condition is never met. - * To avoid infinite loop, you can use the `options.maximumIterations` parameter. - * - * @example It can be used to wait until: - * - A balance is updated after a transaction is sent - * - A transaction is mined - * - A block is mined - * ... - * - * @param pollingFunction - The function to be called. - * @param options - Polling options. @see {SyncPollInputOptions} type. If not specified, the default values are used. In particular: `requestIntervalInMilliseconds` is 1000, `maximumIterations` is not specified - * and `maximumWaitingTimeInMilliseconds` is not specified. - * @returns An object with a `waitUntil` method. It blocks execution until the condition is met. When the condition is met, it returns the result of the poll. - * @throws {InvalidDataType, PollExecution} - */ -function SyncPoll( - pollingFunction: () => Promise | TReturnType, - options?: SyncPollInputOptions -): { - waitUntil: ( - condition: (data: TReturnType) => boolean - ) => Promise; -} { - // Positive number for the request interval - if ( - options?.requestIntervalInMilliseconds !== undefined && - (options.requestIntervalInMilliseconds <= 0 || - !Number.isInteger(options.requestIntervalInMilliseconds)) - ) { - throw new InvalidDataType( - 'SyncPoll()', - 'Polling failed: Invalid input for field "options?.requestIntervalInMilliseconds" it must be a positive number', - { - requestIntervalInMilliseconds: - options.requestIntervalInMilliseconds - } - ); - } - - // Positive number for maximum iterations - if ( - options?.maximumIterations !== undefined && - (options.maximumIterations <= 0 || - !Number.isInteger(options.maximumIterations)) - ) { - throw new InvalidDataType( - 'SyncPoll()', - 'Polling failed: Invalid input for field "options?.maximumIterations" it must be a positive number', - { - maximumIterations: options.maximumIterations - } - ); - } - - // Positive number for maximum waiting time - if ( - options?.maximumWaitingTimeInMilliseconds !== undefined && - (options.maximumWaitingTimeInMilliseconds <= 0 || - !Number.isInteger(options.maximumWaitingTimeInMilliseconds)) - ) { - throw new InvalidDataType( - 'SyncPoll()', - 'Polling failed: Invalid input for field "options?.maximumWaitingTimeInMilliseconds" it must be a positive number', - { - maximumWaitingTimeInMilliseconds: - options.maximumWaitingTimeInMilliseconds - } - ); - } - - // Number of iterations - let currentIteration = 0; - - // Current result - let currentResult: TReturnType; - - // Polling condition - let pollingCondition: boolean = false; - - // Initialize the start time - const startTime = Date.now(); - - return { - /** - * Poll until the condition is met. - * - * @param condition - The condition to be met. - * @returns The result of the poll after the condition is met. - */ - waitUntil: async ( - condition: (data: TReturnType) => boolean - ): Promise => { - try { - do { - // 1 - Fetch the result of promise - currentResult = await pollingFunction(); - - // 2 - Sleep for the interval (in a synchronous way) - await sleep( - options?.requestIntervalInMilliseconds !== undefined - ? options.requestIntervalInMilliseconds - : 1000 - ); - - // 3 - Increment the current iteration - currentIteration = currentIteration + 1; - - // 4 - Check if the poll should be stopped (in a forced way OR not) - // 4.1 - If the condition is met or not - const isConditionSatisfied = condition(currentResult); - - // 4.2 - Stop forced on iterations - const isMaximumIterationsReached = - options?.maximumIterations !== undefined - ? currentIteration >= options.maximumIterations - : false; - - // 4.3 - Stop forced on maximum waiting time - const isTimeLimitReached = - options?.maximumWaitingTimeInMilliseconds !== - undefined && - Date.now() - startTime >= - options.maximumWaitingTimeInMilliseconds; - - // Stop the polling if the condition is met OR the maximum iterations is reached OR the maximum waiting time is reached - pollingCondition = !( - isConditionSatisfied || - isMaximumIterationsReached || - isTimeLimitReached - ); - } while (pollingCondition); - - return currentResult; - } catch (error) { - throw new PollExecution( - 'SyncPoll.waitUntil()', - 'Polling failed: Function execution error encountered during synchronous polling.', - { - functionName: pollingFunction.name - }, - error - ); - } - } - }; -} - -export { SyncPoll }; diff --git a/packages/network/src/utils/poll/types.d.ts b/packages/network/src/utils/poll/types.d.ts deleted file mode 100644 index 4144a9338..000000000 --- a/packages/network/src/utils/poll/types.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Options for the force stop of the sync polling. - */ -interface SyncPollInputOptions { - /** - * The maximum number of iterations. - * Poll will stop after this number of iterations, no matter condition is met or not. - * - * @note If not specified limit on iterations is NOT given. - */ - maximumIterations?: number; - - /** - * The interval of time (in milliseconds) between each function call. - * - * @note If not specified a default value is given. - */ - requestIntervalInMilliseconds?: number; - - /** - * The maximum amount of time (in milliseconds) to wait for the condition to be met. - * - * @note If not specified limit on time is NOT given. - */ - maximumWaitingTimeInMilliseconds?: number; -} - -export { type SyncPollInputOptions }; diff --git a/packages/network/src/utils/subscriptions/beat.ts b/packages/network/src/utils/subscriptions/beat.ts deleted file mode 100644 index b989dd6c2..000000000 --- a/packages/network/src/utils/subscriptions/beat.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { thorest } from '../thorest'; -import { type BlockSubscriptionOptions } from './types'; - -/** - * Returns the URL for subscribing to new beats through a websocket connection. - * @note This subscribes to the legacy beats. - * [Legacy Beat source code](https://github.com/vechain/thor/blob/abf1da466b554dcc9c1ad30cb8e75a860b046bf5/api/subscriptions/beat_reader.go#L29) - * - * @param baseURL - The URL of the node to request the subscription from. - * @param options - (optional) other optional parameters for the request. - * `blockID` - The block id to start from, defaults to the best block. - * - * @returns The websocket subscription URL. - */ -const getLegacyBeatSubscriptionUrl = ( - baseURL: string, - options?: BlockSubscriptionOptions -): string => { - return thorest.subscriptions.get.BEAT_LEGACY(baseURL, options?.blockID); -}; - -/** - * Returns the URL for subscribing to new beats through a websocket connection. - * @note this subscribes to the updated version of the beats. The new version uses a dynamic size bloom filter. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param options - (optional) other optional parameters for the request. - * `blockID` - The block id to start from, defaults to the best block. - * - * @returns The websocket subscription URL. - */ -const getBeatSubscriptionUrl = ( - baseURL: string, - options?: BlockSubscriptionOptions -): string => { - return thorest.subscriptions.get.BEAT(baseURL, options?.blockID); -}; - -export { getLegacyBeatSubscriptionUrl, getBeatSubscriptionUrl }; diff --git a/packages/network/src/utils/subscriptions/block.ts b/packages/network/src/utils/subscriptions/block.ts deleted file mode 100644 index 129ba4422..000000000 --- a/packages/network/src/utils/subscriptions/block.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { thorest } from '../thorest'; -import { type BlockSubscriptionOptions } from './types'; - -/** - * Returns the URL for subscribing to new blocks through a websocket connection. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param options - (optional) other optional parameters for the request. - * `blockID` - The block id to start from, defaults to the best block. - * - * @returns The websocket subscription URL. - */ -const getBlockSubscriptionUrl = ( - baseURL: string, - options?: BlockSubscriptionOptions -): string => { - return thorest.subscriptions.get.BLOCK(baseURL, options?.blockID); -}; - -export { getBlockSubscriptionUrl }; diff --git a/packages/network/src/utils/subscriptions/event.ts b/packages/network/src/utils/subscriptions/event.ts deleted file mode 100644 index d86d0802a..000000000 --- a/packages/network/src/utils/subscriptions/event.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { ABIEvent } from '@vechain/sdk-core'; -import { type AbiEvent } from 'abitype'; -import { thorest } from '../thorest'; -import { type EventLike, type EventSubscriptionOptions } from './types'; - -/** - * Returns the URL for subscribing to an event through a websocket connection. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param event - The event to subscribe to. - * Can be an event object or a string representing an event. - * @see [Viem Parse ABI Item](https://viem.sh/docs/abi/parseAbiItem.html) - * - * @param indexedValues - The values of the indexed parameters to construct the topic filters. - * @param options - (optional) other optional parameters for the request. - * `blockID` - The block id to start from, defaults to the best block. - * `address` - The contract address to filter events by. - * - * @returns The websocket subscription URL. - * - * @throws Will throw an error if the event is not a valid event or if the indexed values to encode are invalid. - */ -const getEventSubscriptionUrl = ( - baseURL: string, - event: EventLike, - indexedValues?: unknown[], - options?: EventSubscriptionOptions -): string => { - const ev = - typeof event === 'string' - ? new ABIEvent(event) - : new ABIEvent(event as AbiEvent); - - // Encode the indexed parameters to construct the topic filters - const encodedTopics = ev.encodeFilterTopicsNoNull(indexedValues ?? []); - - return thorest.subscriptions.get.EVENT(baseURL, { - position: options?.blockID, - contractAddress: options?.address, - topic0: encodedTopics[0], - topic1: encodedTopics[1], - topic2: encodedTopics[2], - topic3: encodedTopics[3], - topic4: encodedTopics[4] - }); -}; - -export { getEventSubscriptionUrl }; diff --git a/packages/network/src/utils/subscriptions/index.ts b/packages/network/src/utils/subscriptions/index.ts deleted file mode 100644 index 315d65d04..000000000 --- a/packages/network/src/utils/subscriptions/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { getBeatSubscriptionUrl, getLegacyBeatSubscriptionUrl } from './beat'; -import { getBlockSubscriptionUrl } from './block'; -import { getEventSubscriptionUrl } from './event'; -import { getNewTransactionsSubscriptionUrl } from './transaction'; -import { getVETtransfersSubscriptionUrl } from './transfer'; - -export type * from './types.d'; - -/** - * Subscriptions utilities. - * Contains functions for obtaining URLs for subscribing to events through a websocket connection. - */ -export const subscriptions = { - getEventSubscriptionUrl, - getBlockSubscriptionUrl, - getNewTransactionsSubscriptionUrl, - getVETtransfersSubscriptionUrl, - getLegacyBeatSubscriptionUrl, - getBeatSubscriptionUrl -}; diff --git a/packages/network/src/utils/subscriptions/transaction.ts b/packages/network/src/utils/subscriptions/transaction.ts deleted file mode 100644 index 98cfb53f4..000000000 --- a/packages/network/src/utils/subscriptions/transaction.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { thorest } from '../thorest'; - -/** - * Returns the URL for subscribing to new transactions through a websocket connection. - * - * @param baseURL - The URL of the node to request the subscription from. - * @returns The websocket subscription URL. - */ -const getNewTransactionsSubscriptionUrl = (baseURL: string): string => { - return thorest.subscriptions.get.NEW_TRANSACTIONS(baseURL); -}; - -export { getNewTransactionsSubscriptionUrl }; diff --git a/packages/network/src/utils/subscriptions/transfer.ts b/packages/network/src/utils/subscriptions/transfer.ts deleted file mode 100644 index fd99d905d..000000000 --- a/packages/network/src/utils/subscriptions/transfer.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { thorest } from '../thorest'; -import { type VETtransfersSubscriptionOptions } from './types'; - -/** - * Returns the URL for subscribing to new VET transfers through a websocket connection. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param options - (optional) other optional parameters for the request. - * `blockID` - The block id to start from, defaults to the best block. - * `signerAddress` - The address of the signer of the transaction to filter transfers by. - * `sender` - The sender address to filter transfers by. - * `recipient` - The recipient address to filter transfers by. - * - * @returns The websocket subscription URL. - */ -const getVETtransfersSubscriptionUrl = ( - baseURL: string, - options?: VETtransfersSubscriptionOptions -): string => { - return thorest.subscriptions.get.VET_TRANSFER(baseURL, { - position: options?.blockID, - signerAddress: options?.signerAddress, - sender: options?.sender, - receiver: options?.recipient - }); -}; - -export { getVETtransfersSubscriptionUrl }; diff --git a/packages/network/src/utils/subscriptions/types.d.ts b/packages/network/src/utils/subscriptions/types.d.ts deleted file mode 100644 index 3bd3fce83..000000000 --- a/packages/network/src/utils/subscriptions/types.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { type AbiEvent } from 'viem'; -/* --------- Event types start --------- */ - -/** - * An Event Parameter ABI object. - */ -interface EventParameter { - /** - * Whether the parameter is an indexed parameter. - */ - indexed: boolean; - /** - * The name of the parameter. - */ - name: string; - /** - * The type of the parameter. - */ - type: string; - /** - * The internal type of the parameter. - */ - internalType?: string; -} - -/** - * An Event ABI object. - */ -interface EventAbi { - /** - * Whether the event was declared as anonymous. - */ - anonymous: boolean; - /** - * The inputs of the event. - */ - inputs: EventParameter[]; - /** - * The name of the event. - */ - name: string; - /** - * The type of the event. For an event, this is always 'event'. - */ - type: string; -} - -/** - * An event represented as a string, an EventAbi object or an abitype AbiEvent. - * If a string is provided, it must adhere to abitype's AbiEvent. - * - * @see [AbiEvent](https://abitype.dev/api/types#abievent) - */ -type EventLike = string | AbiEvent | EventAbi; - -/* --------- Event types end --------- */ - -/* --- Input options start --- */ - -/** - * Options for event subscription. - */ -interface EventSubscriptionOptions { - /** - * The block id from which to start the subscription. - * - * @note the Block ID must refer to a block that does not exceed the backtrace limit of the node. (Default: 1000) - * @see [Backtrace limit](https://docs.vechain.org/start-building/tutorials/how-to-run-a-thor-solo-node#command-line-options) - */ - blockID?: string; - - /** - * The address of the contract that emitted the event to subscribe to. - */ - address?: string; -} - -interface BlockSubscriptionOptions { - /** - * The block id from which to start the subscription. - * - * @note the Block ID must refer to a block that does not exceed the backtrace limit of the node. (Default: 1000) - * @see [Backtrace limit](https://docs.vechain.org/start-building/tutorials/how-to-run-a-thor-solo-node#command-line-options) - */ - blockID?: string; -} - -interface VETtransfersSubscriptionOptions { - /** - * The block id from which to start the subscription. - * - * @note the Block ID must refer to a block that does not exceed the backtrace limit of the node. (Default: 1000) - * @see [Backtrace limit](https://docs.vechain.org/start-building/tutorials/how-to-run-a-thor-solo-node#command-line-options) - */ - blockID?: string; - - /** - * The address of the contract that emitted the event to subscribe to. - */ - signerAddress?: string; - - /** - * The address of the sender of the VET transfer to subscribe to. - */ - sender?: string; - - /** - * The address of the recipient of the VET transfer to subscribe to. - */ - recipient?: string; -} - -/* --- Input options end --- */ - -export type { - BlockSubscriptionOptions, - EventLike, - EventSubscriptionOptions, - VETtransfersSubscriptionOptions -}; diff --git a/packages/network/src/utils/thorest/helpers.ts b/packages/network/src/utils/thorest/helpers.ts deleted file mode 100644 index 9ea8a3b6e..000000000 --- a/packages/network/src/utils/thorest/helpers.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; -import { HTTP_REGEX, HTTPS_REGEX } from '../const'; - -/** - * Generates a query string from a record of key-value pairs. - * Only includes keys in the query string whose values are defined. - * - * @param params - The record of key-value pairs. - * @returns The query string. - */ -const toQueryString = ( - params: Record -): string => { - // Filter out undefined values and map to 'key=value' strings - const queryParts = Object.entries(params) - .filter(([, value]) => value !== undefined) - .map( - ([key, value]) => - `${encodeURIComponent(key)}=${encodeURIComponent( - value as string - )}` - ); - - // Join the parts with '&' and prepend a '?' if not empty - return queryParts.length > 0 ? `?${queryParts.join('&')}` : ''; -}; - -/** - * Sanitizes a base URL by removing trailing slashes and adding the protocol if missing. - * - * @param url - The URL to validate. - * @returns The sanitized URL without the protocol. - * @throws {InvalidDataType} - */ -const sanitizeWebsocketBaseURL = (url: string): string => { - // Clean the url - url = url.trim(); - - // Simplified regex to check if the URL is valid - const urlRegex = - /^(https?:\/\/)([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)(:\d+)?\/?$/; - - if (!urlRegex.test(url)) - throw new InvalidDataType( - 'sanitizeWebsocketBaseURL()', - `Invalid url: ${url}. Must adhere to the regex: ${urlRegex}.`, - { url, urlRegex } - ); - - // Remove trailing slash - url = url.replace(/\/$/, ''); - - // Replace http with ws and https with wss - url = - HTTP_REGEX.exec(url) !== null - ? url.replace(HTTP_REGEX, 'ws://') - : url.replace(HTTPS_REGEX, 'wss://'); - - return url; -}; - -export { toQueryString, sanitizeWebsocketBaseURL }; diff --git a/packages/network/src/utils/thorest/index.ts b/packages/network/src/utils/thorest/index.ts deleted file mode 100644 index 475ee6eb0..000000000 --- a/packages/network/src/utils/thorest/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './helpers'; -export type * from './types.d'; -export * from './thorest'; diff --git a/packages/network/src/utils/thorest/thorest.ts b/packages/network/src/utils/thorest/thorest.ts deleted file mode 100644 index 2580336a5..000000000 --- a/packages/network/src/utils/thorest/thorest.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { sanitizeWebsocketBaseURL, toQueryString } from './helpers'; -import { type VetTransferOptions, type EventOptions } from './types'; - -/** - * Endpoints for the REST API. - */ -const thorest = { - /** - * Accounts related endpoints. - */ - accounts: { - get: { - ACCOUNT_DETAIL: (address: string): string => `/accounts/${address}`, - ACCOUNT_BYTECODE: (address: string): string => - `/accounts/${address}/code`, - STORAGE_AT: (address: string, position: string): string => - `/accounts/${address}/storage/${position}` - }, - post: { - SIMULATE_TRANSACTION: (revision?: string): string => { - return revision != null - ? `/accounts/*?revision=${revision}` - : `/accounts/*`; - } - } - }, - - /** - * Blocks related endpoints. - */ - blocks: { - get: { - BLOCK_DETAIL: (revision: string | number): string => - `/blocks/${revision}` - } - }, - - /** - * Nodes related endpoints. - */ - nodes: { - get: { - NODES: (): string => '/node/network/peers' - } - }, - - /** - * Logs related endpoints. - */ - logs: { - post: { - EVENT_LOGS: (): string => '/logs/event', - TRANSFER_LOGS: (): string => '/logs/transfer' - } - }, - - /** - * Transactions related endpoints. - */ - transactions: { - get: { - TRANSACTION: (id: string): string => `/transactions/${id}`, - TRANSACTION_RECEIPT: (id: string): string => - `/transactions/${id}/receipt` - }, - post: { - TRANSACTION: (): string => `/transactions` - } - }, - - /** - * Subscriptions related endpoints. - */ - subscriptions: { - get: { - /** - * Subscribe to new blocks. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param position - (optional) The block id to start from, defaults to the best block. - * - * @returns The websocket subscription URL. - */ - BLOCK: (baseURL: string, position?: string): string => { - const queryParams = toQueryString({ - pos: position - }); - - return `${sanitizeWebsocketBaseURL( - baseURL - )}/subscriptions/block${queryParams}`; - }, - - /** - * Subscribe to new events. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param options - (optional) The options for the subscription. - * - * @returns The websocket subscription URL. - */ - EVENT: (baseURL: string, options?: EventOptions): string => { - const queryParams = toQueryString({ - pos: options?.position, - addr: options?.contractAddress, - t0: options?.topic0, - t1: options?.topic1, - t2: options?.topic2, - t3: options?.topic3, - t4: options?.topic4 - }); - - return `${sanitizeWebsocketBaseURL( - baseURL - )}/subscriptions/event${queryParams}`; - }, - - /** - * Subscribe to new VET transfers. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param options - (optional) The options for the subscription. - * - * @returns The websocket subscription URL. - */ - VET_TRANSFER: ( - baseURL: string, - options?: VetTransferOptions - ): string => { - const queryParams = toQueryString({ - pos: options?.position, - txOrigin: options?.signerAddress, - sender: options?.sender, - recipient: options?.receiver - }); - - return `${sanitizeWebsocketBaseURL( - baseURL - )}/subscriptions/transfer${queryParams}`; - }, - - /** - * Subscribe to new legacy beats. - * A beat is a notification that a new block has been added to the blockchain with a bloom filter which can be used to check if the block contains any relevant account. - * @note This subscription has been improved with dynamic size bloom filter with the new `BEAT` subscription. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param position - (optional) The block id to start from, defaults to the best block. - * - * @returns The websocket subscription URL. - */ - BEAT_LEGACY: (baseURL: string, position?: string): string => { - const queryParams = toQueryString({ - pos: position - }); - - return `${sanitizeWebsocketBaseURL( - baseURL - )}/subscriptions/beat${queryParams}`; - }, - - /** - * Subscribe to new beats. - * A beat is a notification that a new block has been added to the blockchain with a bloom filter which can be used to check if the block contains any relevant account. - * - * @param baseURL - The URL of the node to request the subscription from. - * @param position - (optional) The block id to start from, defaults to the best block. - * - * @returns The websocket subscription URL. - */ - BEAT: (baseURL: string, position?: string): string => { - const queryParams = toQueryString({ - pos: position - }); - - return `${sanitizeWebsocketBaseURL( - baseURL - )}/subscriptions/beat2${queryParams}`; - }, - - /** - * Subscribe to new transactions. - * - * @returns The websocket subscription URL. - */ - NEW_TRANSACTIONS: (baseURL: string): string => - `${sanitizeWebsocketBaseURL(baseURL)}/subscriptions/txpool` - } - }, - - /** - * Debug related endpoints. - */ - debug: { - post: { - TRACE_TRANSACTION_CLAUSE: (): string => `/debug/tracers`, - TRACE_CONTRACT_CALL: (): string => `/debug/tracers/call`, - RETRIEVE_STORAGE_RANGE: (): string => `/debug/storage-range` - } - } -}; - -export { thorest }; diff --git a/packages/network/src/utils/thorest/types.d.ts b/packages/network/src/utils/thorest/types.d.ts deleted file mode 100644 index bc0ac2198..000000000 --- a/packages/network/src/utils/thorest/types.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* --- Input options start --- */ - -interface EventOptions { - /** - * The block id to start from, defaults to the best block. - */ - position?: string; - /** - * The contract address to filter events by. - */ - contractAddress?: string; - /** - * The topic0 to filter events by. - */ - topic0?: string; - /** - * The topic1 to filter events by. - */ - topic1?: string; - /** - * The topic2 to filter events by. - */ - topic2?: string; - /** - * The topic3 to filter events by. - */ - topic3?: string; - /** - * The topic4 to filter events by. - */ - topic4?: string; -} - -interface VetTransferOptions { - /** - * The block id to start from, defaults to the best block. - */ - position?: string; - /** - * The signer address to filter transfers by. - */ - signerAddress?: string; - /** - * The sender address to filter transfers by. - */ - sender?: string; - /** - * The receiver address to filter transfers by. - */ - receiver?: string; -} - -/* --- Input options end --- */ - -export type { EventOptions, VetTransferOptions }; diff --git a/packages/network/src/utils/vns/addresses.ts b/packages/network/src/utils/vns/addresses.ts deleted file mode 100644 index 3da5b2e0e..000000000 --- a/packages/network/src/utils/vns/addresses.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { - MAINNET_NETWORK, - SOLO_NETWORK, - TESTNET_NETWORK -} from '@vechain/sdk-core'; - -const NetworkContracts: Record< - string, - { registry: string; resolveUtils: string } -> = { - [MAINNET_NETWORK.genesisBlock.id]: { - registry: '0xa9231da8BF8D10e2df3f6E03Dd5449caD600129b', - resolveUtils: '0xA11413086e163e41901bb81fdc5617c975Fa5a1A' - }, - - [TESTNET_NETWORK.genesisBlock.id]: { - registry: '0xcBFB30c1F267914816668d53AcBA7bA7c9806D13', - resolveUtils: '0xc403b8EA53F707d7d4de095f0A20bC491Cf2bc94' - }, - - [SOLO_NETWORK.genesisBlock.id]: { - registry: '0x1c4a602ed21f3d1dddd1142c81f231ef1a08c921', - resolveUtils: '0xb2f08bbfa8a42b1fbe63feec604cb147385203d7' - } -}; - -export { NetworkContracts }; diff --git a/packages/network/src/utils/vns/index.ts b/packages/network/src/utils/vns/index.ts deleted file mode 100644 index 9eea9480c..000000000 --- a/packages/network/src/utils/vns/index.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { ABIFunction, ABIItem, Address, ZERO_ADDRESS } from '@vechain/sdk-core'; -import { - type BlocksModule, - type ThorClient, - type TransactionsModule -} from '../../thor-client'; -import { NetworkContracts } from './addresses'; - -/** - * Returns a single address or null for a name resolved at vet.domains - * - * @param thorClient - The thor client instance to use. - * @param name - The name to resolve - * @returns The address or null - */ -const resolveName = async ( - thorClient: ThorClient, - name: string -): Promise => { - const [address] = await vnsUtils.resolveNames( - thorClient.blocks, - thorClient.transactions, - [name] - ); - return address ?? null; -}; - -/** - * Returns a list of addresses or null for names resolved by vet.domains - * - * @param thorClient - The thor client instance to use. - * @param names - The names to resolve - * @returns The list of the same size of names with the resolved address or null - */ -const resolveNames = async ( - blocksModule: BlocksModule, - transactionsModule: TransactionsModule, - names: string[] -): Promise> => { - // identify current chain - const genesisBlock = await blocksModule.getGenesisBlock(); - - // verify configuration for chain exists - if ( - genesisBlock === null || - !Address.isValid(NetworkContracts[genesisBlock.id]?.resolveUtils) - ) { - return names.map(() => null); - } - - const resolveUtilsAddress = NetworkContracts[genesisBlock.id].resolveUtils; - - // use the resolveUtils to lookup names - const callGetAddresses = await transactionsModule.executeCall( - resolveUtilsAddress, - ABIItem.ofSignature( - ABIFunction, - 'function getAddresses(string[] names) returns (address[] addresses)' - ), - [names] - ); - - const [addresses] = callGetAddresses.result.array as string[][]; - - return addresses.map((address) => { - // zero addresses are missing configuration entries - if (address === ZERO_ADDRESS || !Address.isValid(address)) { - return null; - } - - return address; - }); -}; - -/** - * Returns a single primary name for a given address resolved at vet.domains - * - * @param thorClient - The thor client instance to use. - * @param address - The address to lookup - * @returns The name or null - */ -const lookupAddress = async ( - thorClient: ThorClient, - address: string -): Promise => { - const [name] = await vnsUtils.lookupAddresses(thorClient, [address]); - return name ?? null; -}; - -/** - * Returns a list of names or null for addresses primary names resolved by vet.domains. Reverse lookup of name to address is verified. - * - * @param thorClient - The thor client instance to use. - * @param addresses - The addresses to lookup - * @returns The list of the same size of addresses with the resolved primary names or null - */ -const lookupAddresses = async ( - thorClient: ThorClient, - addresses: string[] -): Promise> => { - // identify current chain - const genesisBlock = await thorClient.blocks.getGenesisBlock(); - - // verify configuration for chain exists - if ( - genesisBlock === null || - !Address.isValid(NetworkContracts[genesisBlock.id]?.resolveUtils) - ) { - return addresses.map(() => null); - } - - const resolveUtilsAddress = NetworkContracts[genesisBlock.id].resolveUtils; - - // use the resolveUtils to lookup names - const callGetNames = await thorClient.contracts.executeCall( - resolveUtilsAddress, - ABIItem.ofSignature( - ABIFunction, - 'function getNames(address[] addresses) returns (string[] names)' - ), - [addresses] - ); - - const [names] = callGetNames.result.array as string[][]; - - return names.map((name) => { - // empty strings indicate a missing entry - if (name === '') { - return null; - } - - return name; - }); -}; - -const vnsUtils = { resolveName, resolveNames, lookupAddress, lookupAddresses }; -export { vnsUtils }; diff --git a/packages/network/tests/fixture.ts b/packages/network/tests/fixture.ts deleted file mode 100644 index 95d0cf6a5..000000000 --- a/packages/network/tests/fixture.ts +++ /dev/null @@ -1,895 +0,0 @@ -import { HexUInt, Secp256k1 } from '@vechain/sdk-core'; -import { - MAINNET_URL, - ProviderInternalBaseWallet, - type SignTransactionOptions, - TESTNET_URL, - THOR_SOLO_ACCOUNTS -} from '../src'; -import { SimpleHttpClient } from '../src/http'; - -/** - * Main network instance fixture - */ -const mainNetwork = new SimpleHttpClient(MAINNET_URL); - -/** - * Network instance fixture - */ -const testNetwork = new SimpleHttpClient(TESTNET_URL); - -/** - * Simple test account fixture - */ -const testAccount = '0xf077b491b355E64048cE21E3A6Fc4751eEeA77fa'; - -/** - * Zero address fixture - */ -const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; - -/** - * Test accounts into wallet fixture - */ -const THOR_SOLO_ACCOUNTS_BASE_WALLET: ProviderInternalBaseWallet = - new ProviderInternalBaseWallet( - THOR_SOLO_ACCOUNTS.map((account) => ({ - privateKey: HexUInt.of(account.privateKey).bytes, - publicKey: Secp256k1.derivePublicKey( - HexUInt.of(account.privateKey).bytes - ), - address: account.address - })) - ); - -/** - * Test accounts into wallet fixture with delegator - */ -const THOR_SOLO_ACCOUNTS_BASE_WALLET_WITH_DELEGATOR = ( - delegator: SignTransactionOptions -): ProviderInternalBaseWallet => - new ProviderInternalBaseWallet( - THOR_SOLO_ACCOUNTS.map((account) => ({ - privateKey: HexUInt.of(account.privateKey).bytes, - publicKey: Secp256k1.derivePublicKey( - HexUInt.of(account.privateKey).bytes - ), - address: account.address - })), - { - delegator - } - ); - -/** - * Delegate url fixture to test signing transactions with delegation by URL - */ -const TESTNET_DELEGATE_URL = 'https://sponsor-testnet.vechain.energy/by/299'; - -/** - * Test accounts fixture - */ -const TEST_ACCOUNTS = { - /** - * Accounts dedicated for testing account related operations. - */ - ACCOUNT: { - SIMPLE_ACCOUNT: THOR_SOLO_ACCOUNTS[0] - }, - - /** - * Accounts dedicated for testing transaction related operations. - */ - TRANSACTION: { - TRANSACTION_SENDER: THOR_SOLO_ACCOUNTS[1], - TRANSACTION_RECEIVER: THOR_SOLO_ACCOUNTS[2], - DELEGATOR: THOR_SOLO_ACCOUNTS[3], - CONTRACT_MANAGER: THOR_SOLO_ACCOUNTS[4] - }, - - /** - * Accounts dedicated for testing subscription related operations. - */ - SUBSCRIPTION: { - EVENT_SUBSCRIPTION: THOR_SOLO_ACCOUNTS[5], - VET_TRANSFERS_SUBSCRIPTION: THOR_SOLO_ACCOUNTS[6] - } -}; - -/** - * `TestingContract.sol` deployed contract address on thor-solo snapshot. - */ -const TESTING_CONTRACT_ADDRESS: string = - '0xb2c20a6de401003a671659b10629eb82ff254fb8'; - -/** - * `TestingContract.sol` contract bytecode on Solo Network - */ -const TESTING_CONTRACT_BYTECODE = - '0x608060405234801561001057600080fd5b50600436106102065760003560e01c80636188a79b1161011a578063bd255307116100ad578063da46084a1161007c578063da46084a146106a1578063e1967eae146106d1578063eb03555c146106ef578063f8b2cb4f1461071f578063fb3a4b941461074f57610206565b8063bd25530714610607578063c4e41b2214610637578063c7bce69d14610655578063cf98821c1461067157610206565b80637634787f116100e95780637634787f1461056f578063b2d144001461059f578063b6b55f25146105bb578063bd220e65146105d757610206565b80636188a79b146104d75780636765f626146105075780636a98ff2b1461052357806375f7286c1461055357610206565b80632e1a7d4d1161019d578063448dc9661161016c578063448dc96614610406578063459346c7146104245780634888df8d146104545780634d56c873146104725780635fb5fe3b146104a757610206565b80632e1a7d4d1461036c57806333956403146103885780633793077c146103b85780633f92958f146103d657610206565b806311c4ea65116101d957806311c4ea65146102b757806315a23066146102ee5780631d4a06de1461030c57806327e235e31461033c57610206565b806301cb08c51461020b57806301ec27bd146102275780630a9f3f05146102575780631083ac9214610287575b600080fd5b6102256004803603810190610220919061126e565b610759565b005b610241600480360381019061023c9190611457565b6107bb565b60405161024e919061156b565b60405180910390f35b610271600480360381019061026c919061126e565b6107cb565b60405161027e919061159c565b60405180910390f35b6102a1600480360381019061029c919061126e565b61086f565b6040516102ae919061159c565b60405180910390f35b6102d160048036038101906102cc91906117e9565b610879565b6040516102e5989796959493929190611b07565b60405180910390f35b6102f66108bf565b604051610303919061159c565b60405180910390f35b61032660048036038101906103219190611b9c565b610956565b6040516103339190611be5565b60405180910390f35b61035660048036038101906103519190611c07565b610960565b604051610363919061159c565b60405180910390f35b6103866004803603810190610381919061126e565b610978565b005b6103a2600480360381019061039d9190611c6c565b610a9a565b6040516103af9190611ca8565b60405180910390f35b6103c0610aa4565b6040516103cd919061159c565b60405180910390f35b6103f060048036038101906103eb919061126e565b610b3b565b6040516103fd9190611cc3565b60405180910390f35b61040e610bdf565b60405161041b9190611d19565b60405180910390f35b61043e60048036038101906104399190611d6a565b610c76565b60405161044b9190611da6565b60405180910390f35b61045c610c80565b6040516104699190611cc3565b60405180910390f35b61048c60048036038101906104879190611edc565b610d17565b60405161049e96959493929190611fb4565b60405180910390f35b6104c160048036038101906104bc9190611c07565b610d41565b6040516104ce9190612015565b60405180910390f35b6104f160048036038101906104ec9190612030565b610d4b565b6040516104fe919061205d565b60405180910390f35b610521600480360381019061051c919061126e565b610d55565b005b61053d60048036038101906105389190612119565b610d9b565b60405161054a9190611cc3565b60405180910390f35b61056d6004803603810190610568919061126e565b610e3f565b005b6105896004803603810190610584919061126e565b610e85565b6040516105969190612015565b60405180910390f35b6105b960048036038101906105b4919061126e565b610f29565b005b6105d560048036038101906105d0919061126e565b610f70565b005b6105f160048036038101906105ec919061126e565b61100e565b6040516105fe9190612162565b60405180910390f35b610621600480360381019061061c919061217d565b6110b2565b60405161062e91906121aa565b60405180910390f35b61063f6110c2565b60405161064c919061159c565b60405180910390f35b61066f600480360381019061066a919061126e565b611159565b005b61068b600480360381019061068691906121c5565b61116d565b604051610698919061220e565b60405180910390f35b6106bb60048036038101906106b69190612230565b611177565b6040516106c8919061225d565b60405180910390f35b6106d961118d565b6040516106e6919061159c565b60405180910390f35b61070960048036038101906107049190612278565b611193565b6040516107169190611cc3565b60405180910390f35b61073960048036038101906107349190611c07565b61119d565b604051610746919061159c565b60405180910390f35b6107576111e6565b005b60006001549050816001819055503373ffffffffffffffffffffffffffffffffffffffff1681837f300d5da673e2547b3469e683ff2c8c7efd661c408f45cd0be5a951392a00cfa3426040516107af919061159c565b60405180910390a45050565b6107c36111e8565b819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633b80eea2836040518263ffffffff1660e01b8152600401610827919061159c565b602060405180830381865afa158015610844573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086891906122ba565b9050919050565b6000819050919050565b60008060006060610888611202565b60606108926111e8565b60008f8f8f8f8f8f8f8f975097509750975097509750975097509850985098509850985098509850989050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663605df59c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561092d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095191906122ba565b905090565b6060819050919050565b60026020528060005260406000206000915090505481565b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f190612333565b60405180910390fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a499190612382565b925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a96573d6000803e3d6000fd5b5050565b6000819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6ddce6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3691906122ba565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d527e344836040518263ffffffff1660e01b8152600401610b97919061159c565b602060405180830381865afa158015610bb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd891906123cb565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e80558316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c719190612424565b905090565b6000819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639ac53dbb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1291906123cb565b905090565b6000806000806000808b8b8b8b8b8b95509550955095509550955096509650965096509650969050565b6000819050919050565b6000819050919050565b600a8111610d98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8f9061249d565b60405180910390fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166337245814836040518263ffffffff1660e01b8152600401610df79190612512565b602060405180830381865afa158015610e14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3891906123cb565b9050919050565b602a8114610e82576040517f8d6ea8be000000000000000000000000000000000000000000000000000000008152600401610e7990612580565b60405180910390fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340f9fafe836040518263ffffffff1660e01b8152600401610ee1919061159c565b602060405180830381865afa158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2291906125b5565b9050919050565b6005811015610f6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f649061262e565b60405180910390fd5b50565b8060008111610fb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fab9061269a565b60405180910390fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461100391906126ba565b925050819055505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166341f90721836040518263ffffffff1660e01b815260040161106a919061159c565b602060405180830381865afa158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab9190612703565b9050919050565b6110ba611202565b819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611130573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115491906122ba565b905090565b6000811461116a57611169612730565b5b50565b6060819050919050565b6000600182611186919061275f565b9050919050565b60015481565b6000819050919050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565bfe5b604051806040016040528060008152602001606081525090565b6040518060600160405280600390602082028036833780820191505090505090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61124b81611238565b811461125657600080fd5b50565b60008135905061126881611242565b92915050565b6000602082840312156112845761128361122e565b5b600061129284828501611259565b91505092915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6112e9826112a0565b810181811067ffffffffffffffff82111715611308576113076112b1565b5b80604052505050565b600061131b611224565b905061132782826112e0565b919050565b600080fd5b600080fd5b600080fd5b600067ffffffffffffffff821115611356576113556112b1565b5b61135f826112a0565b9050602081019050919050565b82818337600083830152505050565b600061138e6113898461133b565b611311565b9050828152602081018484840111156113aa576113a9611336565b5b6113b584828561136c565b509392505050565b600082601f8301126113d2576113d1611331565b5b81356113e284826020860161137b565b91505092915050565b6000604082840312156114015761140061129b565b5b61140b6040611311565b9050600061141b84828501611259565b600083015250602082013567ffffffffffffffff81111561143f5761143e61132c565b5b61144b848285016113bd565b60208301525092915050565b60006020828403121561146d5761146c61122e565b5b600082013567ffffffffffffffff81111561148b5761148a611233565b5b611497848285016113eb565b91505092915050565b6114a981611238565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156114e95780820151818401526020810190506114ce565b60008484015250505050565b6000611500826114af565b61150a81856114ba565b935061151a8185602086016114cb565b611523816112a0565b840191505092915050565b600060408301600083015161154660008601826114a0565b506020830151848203602086015261155e82826114f5565b9150508091505092915050565b60006020820190508181036000830152611585818461152e565b905092915050565b61159681611238565b82525050565b60006020820190506115b1600083018461158d565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006115e2826115b7565b9050919050565b6115f2816115d7565b81146115fd57600080fd5b50565b60008135905061160f816115e9565b92915050565b6000819050919050565b61162881611615565b811461163357600080fd5b50565b6000813590506116458161161f565b92915050565b600067ffffffffffffffff821115611666576116656112b1565b5b602082029050919050565b600080fd5b60006116896116848461164b565b611311565b905080602084028301858111156116a3576116a2611671565b5b835b818110156116cc57806116b88882611259565b8452602084019350506020810190506116a5565b5050509392505050565b600082601f8301126116eb576116ea611331565b5b60036116f8848285611676565b91505092915050565b600067ffffffffffffffff82111561171c5761171b6112b1565b5b602082029050602081019050919050565b600061174061173b84611701565b611311565b9050808382526020820190506020840283018581111561176357611762611671565b5b835b8181101561178c57806117788882611259565b845260208401935050602081019050611765565b5050509392505050565b600082601f8301126117ab576117aa611331565b5b81356117bb84826020860161172d565b91505092915050565b600381106117d157600080fd5b50565b6000813590506117e3816117c4565b92915050565b600080600080600080600080610140898b03121561180a5761180961122e565b5b60006118188b828c01611259565b98505060206118298b828c01611600565b975050604061183a8b828c01611636565b965050606089013567ffffffffffffffff81111561185b5761185a611233565b5b6118678b828c016113bd565b95505060806118788b828c016116d6565b94505060e089013567ffffffffffffffff81111561189957611898611233565b5b6118a58b828c01611796565b93505061010089013567ffffffffffffffff8111156118c7576118c6611233565b5b6118d38b828c016113eb565b9250506101206118e58b828c016117d4565b9150509295985092959890939650565b6118fe816115d7565b82525050565b61190d81611615565b82525050565b600082825260208201905092915050565b600061192f826114af565b6119398185611913565b93506119498185602086016114cb565b611952816112a0565b840191505092915050565b600060039050919050565b600081905092915050565b6000819050919050565b600061198983836114a0565b60208301905092915050565b6000602082019050919050565b6119ab8161195d565b6119b58184611968565b92506119c082611973565b8060005b838110156119f15781516119d8878261197d565b96506119e383611995565b9250506001810190506119c4565b505050505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000602082019050919050565b6000611a3d826119f9565b611a478185611a04565b9350611a5283611a15565b8060005b83811015611a83578151611a6a888261197d565b9750611a7583611a25565b925050600181019050611a56565b5085935050505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110611ad057611acf611a90565b5b50565b6000819050611ae182611abf565b919050565b6000611af182611ad3565b9050919050565b611b0181611ae6565b82525050565b600061014082019050611b1d600083018b61158d565b611b2a602083018a6118f5565b611b376040830189611904565b8181036060830152611b498188611924565b9050611b5860808301876119a2565b81810360e0830152611b6a8186611a32565b9050818103610100830152611b7f818561152e565b9050611b8f610120830184611af8565b9998505050505050505050565b600060208284031215611bb257611bb161122e565b5b600082013567ffffffffffffffff811115611bd057611bcf611233565b5b611bdc848285016113bd565b91505092915050565b60006020820190508181036000830152611bff8184611924565b905092915050565b600060208284031215611c1d57611c1c61122e565b5b6000611c2b84828501611600565b91505092915050565b60008115159050919050565b611c4981611c34565b8114611c5457600080fd5b50565b600081359050611c6681611c40565b92915050565b600060208284031215611c8257611c8161122e565b5b6000611c9084828501611c57565b91505092915050565b611ca281611c34565b82525050565b6000602082019050611cbd6000830184611c99565b92915050565b6000602082019050611cd86000830184611904565b92915050565b60007fffffffffffffffff00000000000000000000000000000000000000000000000082169050919050565b611d1381611cde565b82525050565b6000602082019050611d2e6000830184611d0a565b92915050565b6000819050919050565b611d4781611d34565b8114611d5257600080fd5b50565b600081359050611d6481611d3e565b92915050565b600060208284031215611d8057611d7f61122e565b5b6000611d8e84828501611d55565b91505092915050565b611da081611d34565b82525050565b6000602082019050611dbb6000830184611d97565b92915050565b600060ff82169050919050565b611dd781611dc1565b8114611de257600080fd5b50565b600081359050611df481611dce565b92915050565b600061ffff82169050919050565b611e1181611dfa565b8114611e1c57600080fd5b50565b600081359050611e2e81611e08565b92915050565b600063ffffffff82169050919050565b611e4d81611e34565b8114611e5857600080fd5b50565b600081359050611e6a81611e44565b92915050565b600067ffffffffffffffff82169050919050565b611e8d81611e70565b8114611e9857600080fd5b50565b600081359050611eaa81611e84565b92915050565b611eb9816115b7565b8114611ec457600080fd5b50565b600081359050611ed681611eb0565b92915050565b60008060008060008060c08789031215611ef957611ef861122e565b5b6000611f0789828a01611de5565b9650506020611f1889828a01611e1f565b9550506040611f2989828a01611e5b565b9450506060611f3a89828a01611e9b565b9350506080611f4b89828a01611ec7565b92505060a0611f5c89828a01611259565b9150509295509295509295565b611f7281611dc1565b82525050565b611f8181611dfa565b82525050565b611f9081611e34565b82525050565b611f9f81611e70565b82525050565b611fae816115b7565b82525050565b600060c082019050611fc96000830189611f69565b611fd66020830188611f78565b611fe36040830187611f87565b611ff06060830186611f96565b611ffd6080830185611fa5565b61200a60a083018461158d565b979650505050505050565b600060208201905061202a60008301846118f5565b92915050565b6000602082840312156120465761204561122e565b5b6000612054848285016117d4565b91505092915050565b60006020820190506120726000830184611af8565b92915050565b600067ffffffffffffffff821115612093576120926112b1565b5b61209c826112a0565b9050602081019050919050565b60006120bc6120b784612078565b611311565b9050828152602081018484840111156120d8576120d7611336565b5b6120e384828561136c565b509392505050565b600082601f830112612100576120ff611331565b5b81356121108482602086016120a9565b91505092915050565b60006020828403121561212f5761212e61122e565b5b600082013567ffffffffffffffff81111561214d5761214c611233565b5b612159848285016120eb565b91505092915050565b60006020820190506121776000830184611f96565b92915050565b6000606082840312156121935761219261122e565b5b60006121a1848285016116d6565b91505092915050565b60006060820190506121bf60008301846119a2565b92915050565b6000602082840312156121db576121da61122e565b5b600082013567ffffffffffffffff8111156121f9576121f8611233565b5b61220584828501611796565b91505092915050565b600060208201905081810360008301526122288184611a32565b905092915050565b6000602082840312156122465761224561122e565b5b600061225484828501611de5565b91505092915050565b60006020820190506122726000830184611f69565b92915050565b60006020828403121561228e5761228d61122e565b5b600061229c84828501611636565b91505092915050565b6000815190506122b481611242565b92915050565b6000602082840312156122d0576122cf61122e565b5b60006122de848285016122a5565b91505092915050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061231d601483611913565b9150612328826122e7565b602082019050919050565b6000602082019050818103600083015261234c81612310565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061238d82611238565b915061239883611238565b92508282039050818111156123b0576123af612353565b5b92915050565b6000815190506123c58161161f565b92915050565b6000602082840312156123e1576123e061122e565b5b60006123ef848285016123b6565b91505092915050565b61240181611cde565b811461240c57600080fd5b50565b60008151905061241e816123f8565b92915050565b60006020828403121561243a5761243961122e565b5b60006124488482850161240f565b91505092915050565b7f56616c7565206d7573742062652067726561746572207468616e203130000000600082015250565b6000612487601d83611913565b915061249282612451565b602082019050919050565b600060208201905081810360008301526124b68161247a565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006124e4826124bd565b6124ee81856124c8565b93506124fe8185602086016114cb565b612507816112a0565b840191505092915050565b6000602082019050818103600083015261252c81846124d9565b905092915050565b7f56616c7565206973206e6f742034320000000000000000000000000000000000600082015250565b600061256a600f83611913565b915061257582612534565b602082019050919050565b600060208201905081810360008301526125998161255d565b9050919050565b6000815190506125af816115e9565b92915050565b6000602082840312156125cb576125ca61122e565b5b60006125d9848285016125a0565b91505092915050565b7f56616c7565206d757374206265206174206c6561737420350000000000000000600082015250565b6000612618601883611913565b9150612623826125e2565b602082019050919050565b600060208201905081810360008301526126478161260b565b9050919050565b7f56616c7565206d75737420626520706f73697469766500000000000000000000600082015250565b6000612684601683611913565b915061268f8261264e565b602082019050919050565b600060208201905081810360008301526126b381612677565b9050919050565b60006126c582611238565b91506126d083611238565b92508282019050808211156126e8576126e7612353565b5b92915050565b6000815190506126fd81611e84565b92915050565b6000602082840312156127195761271861122e565b5b6000612727848285016126ee565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061276a82611dc1565b915061277583611dc1565b9250828201905060ff81111561278e5761278d612353565b5b9291505056fea264697066735822122090e8d98dff56f009773585884be02c1824429b468490cc66cf321ad52458c8b864736f6c63430008130033'; - -/** - * ABI of the `TestingContract` smart contract. - */ -const TESTING_CONTRACT_ABI = [ - { - inputs: [ - { - internalType: 'string', - name: 'message', - type: 'string' - } - ], - name: 'CustomError', - type: 'error' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'newValue', - type: 'uint256' - }, - { - indexed: true, - internalType: 'uint256', - name: 'oldValue', - type: 'uint256' - }, - { - indexed: true, - internalType: 'address', - name: 'sender', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'timestamp', - type: 'uint256' - } - ], - name: 'StateChanged', - type: 'event' - }, - { - inputs: [ - { - internalType: 'address', - name: '_addressData', - type: 'address' - } - ], - name: 'addressData', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - name: 'balances', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bool', - name: '_boolData', - type: 'bool' - } - ], - name: 'boolData', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: '_byteData', - type: 'bytes32' - } - ], - name: 'bytes32Data', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes', - name: '_data', - type: 'bytes' - } - ], - name: 'calculateBlake2b256', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_amount', - type: 'uint256' - } - ], - name: 'deposit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256[]', - name: '_dynamicArrayData', - type: 'uint256[]' - } - ], - name: 'dynamicArrayData', - outputs: [ - { - internalType: 'uint256[]', - name: '', - type: 'uint256[]' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'enum TestingContract.ExampleEnum', - name: '_enumData', - type: 'uint8' - } - ], - name: 'enumData', - outputs: [ - { - internalType: 'enum TestingContract.ExampleEnum', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256[3]', - name: '_fixedArrayData', - type: 'uint256[3]' - } - ], - name: 'fixedArrayData', - outputs: [ - { - internalType: 'uint256[3]', - name: '', - type: 'uint256[3]' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_address', - type: 'address' - } - ], - name: 'getBalance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockID', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockSigner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockTime', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNum', - type: 'uint256' - } - ], - name: 'getBlockTotalScore', - outputs: [ - { - internalType: 'uint64', - name: '', - type: 'uint64' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTotalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxBlockRef', - outputs: [ - { - internalType: 'bytes8', - name: '', - type: 'bytes8' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxExpiration', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxID', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getTxProvedWork', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'int256', - name: '_intData', - type: 'int256' - } - ], - name: 'intData', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_uintData', - type: 'uint256' - }, - { - internalType: 'address', - name: '_addressData', - type: 'address' - }, - { - internalType: 'bytes32', - name: '_byteData', - type: 'bytes32' - }, - { - internalType: 'string', - name: '_stringData', - type: 'string' - }, - { - internalType: 'uint256[3]', - name: '_fixedArrayData', - type: 'uint256[3]' - }, - { - internalType: 'uint256[]', - name: '_dynamicArrayData', - type: 'uint256[]' - }, - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '_structData', - type: 'tuple' - }, - { - internalType: 'enum TestingContract.ExampleEnum', - name: '_enumData', - type: 'uint8' - } - ], - name: 'multipleData', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - }, - { - internalType: 'address', - name: '', - type: 'address' - }, - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - }, - { - internalType: 'string', - name: '', - type: 'string' - }, - { - internalType: 'uint256[3]', - name: '', - type: 'uint256[3]' - }, - { - internalType: 'uint256[]', - name: '', - type: 'uint256[]' - }, - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '', - type: 'tuple' - }, - { - internalType: 'enum TestingContract.ExampleEnum', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint8', - name: '_uint8Data', - type: 'uint8' - }, - { - internalType: 'uint16', - name: '_uint16Data', - type: 'uint16' - }, - { - internalType: 'uint32', - name: '_uint32Data', - type: 'uint32' - }, - { - internalType: 'uint64', - name: '_uint64Data', - type: 'uint64' - }, - { - internalType: 'uint160', - name: '_uint160Data', - type: 'uint160' - }, - { - internalType: 'uint256', - name: '_uint256Data', - type: 'uint256' - } - ], - name: 'multipleIntData', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8' - }, - { - internalType: 'uint16', - name: '', - type: 'uint16' - }, - { - internalType: 'uint32', - name: '', - type: 'uint32' - }, - { - internalType: 'uint64', - name: '', - type: 'uint64' - }, - { - internalType: 'uint160', - name: '', - type: 'uint160' - }, - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_newValue', - type: 'uint256' - } - ], - name: 'setStateVariable', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'stateVariable', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'string', - name: '_stringData', - type: 'string' - } - ], - name: 'stringData', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '_structData', - type: 'tuple' - } - ], - name: 'structData', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'id', - type: 'uint256' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - } - ], - internalType: 'struct TestingContract.ExampleStruct', - name: '', - type: 'tuple' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testAssertError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testCustomError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [], - name: 'testInvalidOpcodeError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint8', - name: '_value', - type: 'uint8' - } - ], - name: 'testOverflowError', - outputs: [ - { - internalType: 'uint8', - name: '', - type: 'uint8' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testRequireError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'testRevertError', - outputs: [], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_uintData', - type: 'uint256' - } - ], - name: 'uintData', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_amount', - type: 'uint256' - } - ], - name: 'withdraw', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -export { - mainNetwork, - TEST_ACCOUNTS, - testAccount, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS, - TESTING_CONTRACT_BYTECODE, - TESTNET_DELEGATE_URL, - testNetwork, - THOR_SOLO_ACCOUNTS_BASE_WALLET, - THOR_SOLO_ACCOUNTS_BASE_WALLET_WITH_DELEGATOR, - ZERO_ADDRESS -}; diff --git a/packages/network/tests/http/SimpleHttpClient.solo.test.ts b/packages/network/tests/http/SimpleHttpClient.solo.test.ts deleted file mode 100644 index eeaf9d711..000000000 --- a/packages/network/tests/http/SimpleHttpClient.solo.test.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { HttpMethod, THOR_SOLO_URL } from '../../src'; -import { SimpleHttpClient, type HttpParams } from '../../src/http'; -import { InvalidHTTPRequest, stringifyData } from '@vechain/sdk-errors'; -import { fail } from 'assert'; - -const ACCOUNT_SOLO_1 = '0xf077b491b355E64048cE21E3A6Fc4751eEeA77fa'; - -const ACCOUNT_ZERO = '0x0000000000000000000000000000000000000000'; - -const ACCOUNT_ZERO_DETAILS = { - balance: '0x0', - energy: '0x0', - hasCode: false -}; - -/** - * Timeout for each test. - * Overrides the default timeout of 50000 milliseconds - * due to cases where the network request takes longer than 5 seconds. - */ -const TIMEOUT = 10000; - -/** - * Test SimpleHttpClient class. - * - * @group integration/network - */ -describe('SimpleHttpClient solo tests', () => { - describe('GET method tests', () => { - test('404 <- GET not found', async () => { - try { - const httpClient = new SimpleHttpClient(THOR_SOLO_URL); - await httpClient.get(`/invalid/path`); - fail(); - } catch (error) { - expect(error).toBeInstanceOf(InvalidHTTPRequest); - const innerError = (error as InvalidHTTPRequest).innerError; - expect(innerError).toBeInstanceOf(Error); - const cause = (innerError as Error).cause; - expect(cause).toBeInstanceOf(Response); - const response = cause as Response; - expect(response.status).toBe(404); - } - }); - - test( - 'ok <- GET', - async () => { - const httpClient = new SimpleHttpClient(THOR_SOLO_URL); - const response = await httpClient.get( - `/accounts/${ACCOUNT_ZERO}` - ); - const expected = stringifyData(ACCOUNT_ZERO_DETAILS); - const actual = stringifyData(response); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - - test('ok <- GET and validate', async () => { - const params: HttpParams = { - query: {}, - body: {}, - headers: { - 'X-Custom-Header': 'custom-value', - 'Cache-Control': - 'no-store, no-cache, max-age=0, must-revalidate, proxy-revalidate' - }, - validateResponseHeader: function ( - headers: Record - ): void { - expect(headers).toBeDefined(); - } - }; - const httpClient = new SimpleHttpClient(THOR_SOLO_URL); - const response = await httpClient.get( - `/accounts/${ACCOUNT_SOLO_1}`, - params - ); - expect(response).toBeDefined(); - }); - }); - - describe('POST method tests', () => { - test('400 <- POST bad request', async () => { - try { - const httpClient = new SimpleHttpClient(THOR_SOLO_URL); - await httpClient.post('/transactions', { - body: { - raw: '0xf901854a880104c9cf34b0f5701ef8e7f8e594058d4c951aa24ca012cef3408b259ac1c69d1258890254beb02d1dcc0000b8c469ff936b00000000000000000000000000000000000000000000000000000000ee6c7f95000000000000000000000000167f6cc1e67a615b51b5a2deaba6b9feca7069df000000000000000000000000000000000000000000000000000000000000136a00000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080830469978084cb6b32c5c101b88272da83429a49a354f566dd8c85ba288a7c86d1d3161c0aad6a276a7c9f8e69c14df3d76f0d3442a4f4a2a13d016c32c45e82d5010f27386eeb384dee3d8390c0006adead8b8ce8823c583e1ac15facef8f1cc665a707ade82b3c956a53a2b24e0c03d80504bc4b276b5d067b72636d8e88d2ffc65528f868df2cadc716962978a000' - } - }); - fail(); - } catch (error) { - expect(error).toBeInstanceOf(InvalidHTTPRequest); - const innerError = (error as InvalidHTTPRequest).innerError; - expect(innerError).toBeInstanceOf(Error); - const cause = (innerError as Error).cause; - expect(cause).toBeInstanceOf(Response); - const response = cause as Response; - expect(response.status).toBe(400); - } - }); - }); - - /* - NOTE: This test alters `global` context, hence must be the last one. - */ - test('timeout test - 100 ms', async () => { - const timeout = 100; // 100ms timeout - const httpClient = new SimpleHttpClient( - THOR_SOLO_URL, - new Headers(), - timeout - ); - - // Create a mock server that delays response - const mockServer = jest.fn().mockImplementation(async () => { - return await new Promise((resolve) => - setTimeout(() => { - resolve({ - ok: true, - json: () => ({}) - }); - }, timeout * 2) - ); // Delay longer than the timeout - }); - - global.fetch = mockServer as typeof fetch; - - const start = Date.now(); - await expect( - httpClient.http(HttpMethod.GET, `/accounts/${ACCOUNT_ZERO}`) - ).rejects.toThrow(); - const end = Date.now(); - - // Check if the request was aborted close to the timeout time - expect(end - start).toBeGreaterThanOrEqual(timeout); - expect(end - start).toBeLessThan(timeout * 4); // Allow some margin for execution time - - // // Verify that fetch was called - expect(mockServer).toHaveBeenCalled(); - jest.clearAllMocks(); - }); -}); diff --git a/packages/network/tests/http/SimpleHttpClient.testnet.test.ts b/packages/network/tests/http/SimpleHttpClient.testnet.test.ts deleted file mode 100644 index be70cbeb8..000000000 --- a/packages/network/tests/http/SimpleHttpClient.testnet.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { HttpMethod, SimpleHttpClient } from '../../src/http'; -import { TESTNET_URL } from '../../src'; -import { ZERO_ADDRESS } from '../fixture'; -import { stringifyData } from '@vechain/sdk-errors'; - -const TIMEOUT = 10000; - -const GENESIS_BLOCK = { - number: 0, - id: '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - size: 170, - parentID: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - timestamp: 1530014400, - gasLimit: 10000000, - beneficiary: ZERO_ADDRESS, - gasUsed: 0, - totalScore: 0, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: ZERO_ADDRESS, - isTrunk: true, - isFinalized: true, - transactions: [] -}; - -/** - * Test SimpleHttpClient class. - * - * @group integration/network/http - */ -describe('SimpleHttpClient testnet tests', () => { - describe('GET method tests', () => { - test( - 'ok <- GET /block/latest', - async () => { - const httpClient = new SimpleHttpClient(TESTNET_URL); - const response = await httpClient.get( - '/blocks/0?expanded=false' - ); - const expected = stringifyData(GENESIS_BLOCK); - const actual = stringifyData(response); - expect(actual).toEqual(expected); - }, - 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. - */ - // test('timeout <- GET in 1 ms', async () => { - // const httpClient = new SimpleHttpClient(TESTNET_URL, 0); - // try { - // await httpClient.get('/blocks/0?expanded=false'); - // fail(); - // } catch (error) { - // expect(error).toBeInstanceOf(InvalidHTTPRequest); - // const innerError = (error as InvalidHTTPRequest).innerError; - // expect(innerError).toBeInstanceOf(DOMException); - // expect((innerError as DOMException).name).toBe('AbortError'); - // } - // }); - }); -}); diff --git a/packages/network/tests/provider/fixture.ts b/packages/network/tests/provider/fixture.ts deleted file mode 100644 index 06d593be8..000000000 --- a/packages/network/tests/provider/fixture.ts +++ /dev/null @@ -1,181 +0,0 @@ -/** - * Block with transactions expanded fixture - */ -const blockWithTransactionsExpanded = { - hash: '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - parentHash: - '0x010b7a6c0bb58653b6f8498fc1607e5536c1fa69217cad09f6eb13084263af8c', - number: '0x10b7a6d', - size: '0x426', - stateRoot: - '0xa143fee4f9fb346d39c677c64a97253b2630634163cb4f70b2f2ee51881f3a82', - receiptsRoot: - '0xe77f938c98f4c4aa4237b6d0c7bc3dd8b8fd5b3db6dfb000ab6f646115baa3ee', - transactionsRoot: - '0x23128986cb0a75f076a3614881b1a5779571ba0a2627fc3f0f58244c45074af4', - timestamp: '0x65a53560', - gasLimit: '0x1c9c380', - gasUsed: '0x1ace8', - transactions: [ - { - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x7436', - chainId: '0x186aa', - hash: '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded', - nonce: '0xb8314776ce0bf5df', - transactionIndex: '0x0', - input: '0xd547741f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - }, - { - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0xbd30', - chainId: '0x186aa', - hash: '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - nonce: '0x176bbcbf79a3a672', - transactionIndex: '0x1', - input: '0x799161d500000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - }, - { - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0xd14a', - chainId: '0x186aa', - hash: '0xb476d1a43b8632c25a581465c944a1cb5dd99e48d41d326a250847a0a279afa5', - nonce: '0x7022eb9454a648b9', - transactionIndex: '0x2', - input: '0x2f2ff15d3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - } - ], - miner: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - difficulty: '0x0', - totalDifficulty: '0x0', - uncles: [], - sha3Uncles: - '0x0000000000000000000000000000000000000000000000000000000000000000', - nonce: '0x0000000000000000', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - extraData: '0x', - baseFeePerGas: '0x0', - mixHash: - '0x0000000000000000000000000000000000000000000000000000000000000000' -}; - -/** - * Block with transactions not expanded fixture - */ -const blockWithTransactionsNotExpanded = { - hash: '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - parentHash: - '0x010b7a6c0bb58653b6f8498fc1607e5536c1fa69217cad09f6eb13084263af8c', - number: '0x10b7a6d', - size: '0x426', - stateRoot: - '0xa143fee4f9fb346d39c677c64a97253b2630634163cb4f70b2f2ee51881f3a82', - receiptsRoot: - '0xe77f938c98f4c4aa4237b6d0c7bc3dd8b8fd5b3db6dfb000ab6f646115baa3ee', - transactionsRoot: - '0x23128986cb0a75f076a3614881b1a5779571ba0a2627fc3f0f58244c45074af4', - timestamp: '0x65a53560', - gasLimit: '0x1c9c380', - gasUsed: '0x1ace8', - transactions: [ - '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded', - '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - '0xb476d1a43b8632c25a581465c944a1cb5dd99e48d41d326a250847a0a279afa5' - ], - miner: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - difficulty: '0x0', - totalDifficulty: '0x0', - uncles: [], - sha3Uncles: - '0x0000000000000000000000000000000000000000000000000000000000000000', - nonce: '0x0000000000000000', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - extraData: '0x', - baseFeePerGas: '0x0', - mixHash: - '0x0000000000000000000000000000000000000000000000000000000000000000' -}; - -/** - * Valid transaction hash fixture - */ -const validTransactionHashTestnet = - '0xb2e3f6e9782f462d797b72f9cbf5a4c38ca20cabcc1a091f9de6d3e6736c1f7c'; - -/** - * Valid transaction detail fixture of the `validTransactionHashTestnet` transaction - */ -const validTransactionDetailTestnet = { - blockHash: - '0x010b7b5f0192003f70bf2a6a502221e075cb32d676e3443614d21003cc2ee440', - blockNumber: '0x10b7b5f', - from: '0x8c59c63d6458c71b6ff88d57698437524a703084', - gas: '0x618af', - chainId: '0x186aa', - hash: '0xb2e3f6e9782f462d797b72f9cbf5a4c38ca20cabcc1a091f9de6d3e6736c1f7c', - nonce: '0x19b4782', - transactionIndex: '0x0', - input: '0xf14fcbc8ad2a4a05c94893cc69b721955da2fb2e93ba001224f6ec7250ad110765065541', - to: '0xaeb29614bb9af450a7fff539bbba319455a1aca7', - value: '0x0', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' -}; - -export { - blockWithTransactionsExpanded, - blockWithTransactionsNotExpanded, - validTransactionHashTestnet, - validTransactionDetailTestnet -}; diff --git a/packages/network/tests/provider/formatter/blocks-formatter.unit.test.ts b/packages/network/tests/provider/formatter/blocks-formatter.unit.test.ts deleted file mode 100644 index 68d3a58f6..000000000 --- a/packages/network/tests/provider/formatter/blocks-formatter.unit.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { blockFixtures } from './fixture'; -import { blocksFormatter } from '../../../src'; - -/** - * Blocks formatter unit test - * @group unit/provider/formatter/blocks - */ -describe('Blocks formatter unit test', () => { - /** - * Should be able to format a block - */ - blockFixtures.forEach((blockFixture) => { - test(blockFixture.testName, () => { - const formattedBlock = blocksFormatter.formatToRPCStandard( - blockFixture.block, - '0x0' - ); - expect(formattedBlock).toStrictEqual(blockFixture.expected); - }); - }); -}); diff --git a/packages/network/tests/provider/formatter/fixture.ts b/packages/network/tests/provider/formatter/fixture.ts deleted file mode 100644 index ed9a51633..000000000 --- a/packages/network/tests/provider/formatter/fixture.ts +++ /dev/null @@ -1,367 +0,0 @@ -import { - type CompressedBlockDetail, - type ExpandedBlockDetail, - type TransactionDetailNoRaw -} from '../../../src'; - -/** - * Block fixtures - */ -const blockFixtures = [ - // Compressed block without transactions - { - testName: 'Compressed block without transactions', - block: { - number: 0, - id: '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - size: 170, - parentID: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - timestamp: 1530014400, - gasLimit: 10000000, - beneficiary: '0x0000000000000000000000000000000000000000', - gasUsed: 0, - totalScore: 0, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x0000000000000000000000000000000000000000', - isTrunk: true, - isFinalized: true, - transactions: [] - } satisfies CompressedBlockDetail, - expected: { - hash: '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - parentHash: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - number: '0x0', - size: '0xaa', - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - transactionsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - timestamp: '0x5b322ac0', - gasLimit: '0x989680', - gasUsed: '0x0', - transactions: [], - miner: '0x0000000000000000000000000000000000000000', - difficulty: '0x0', - totalDifficulty: '0x0', - uncles: [], - sha3Uncles: - '0x0000000000000000000000000000000000000000000000000000000000000000', - nonce: '0x0000000000000000', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - extraData: '0x', - baseFeePerGas: '0x0', - mixHash: - '0x0000000000000000000000000000000000000000000000000000000000000000' - } - }, - // Compressed block with transactions - { - testName: 'Compressed block with transactions', - block: { - number: 0, - id: '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - size: 170, - parentID: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - timestamp: 1530014400, - gasLimit: 10000000, - beneficiary: '0x0000000000000000000000000000000000000000', - gasUsed: 0, - totalScore: 0, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x0000000000000000000000000000000000000000', - isTrunk: true, - isFinalized: true, - transactions: [ - '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded' - ] - } satisfies CompressedBlockDetail, - expected: { - hash: '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - parentHash: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - number: '0x0', - size: '0xaa', - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - transactionsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - timestamp: '0x5b322ac0', - gasLimit: '0x989680', - gasUsed: '0x0', - transactions: [ - '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded' - ], - miner: '0x0000000000000000000000000000000000000000', - difficulty: '0x0', - totalDifficulty: '0x0', - uncles: [], - sha3Uncles: - '0x0000000000000000000000000000000000000000000000000000000000000000', - nonce: '0x0000000000000000', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - extraData: '0x', - baseFeePerGas: '0x0', - mixHash: - '0x0000000000000000000000000000000000000000000000000000000000000000' - } - }, - // Expanded block with transactions - { - testName: 'Expanded block with transactions', - block: { - number: 0, - id: '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - size: 170, - parentID: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - timestamp: 1530014400, - gasLimit: 10000000, - beneficiary: '0x0000000000000000000000000000000000000000', - gasUsed: 0, - totalScore: 0, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x0000000000000000000000000000000000000000', - isTrunk: true, - isFinalized: true, - transactions: [ - { - id: '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded', - chainTag: '39', - blockRef: '0x010b7a6c0bb58653', - expiration: 18, - clauses: [ - { - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - data: '0xd547741f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290' - } - ], - gasPriceCoef: 64, - gas: 29750, - origin: '0x7487d912d03ab9de786278f679592b3730bdd540', - delegator: 'null', - nonce: '0xb8314776ce0bf5df', - dependsOn: 'null', - size: 191, - gasUsed: 24792, - gasPayer: '0x7487d912d03ab9de786278f679592b3730bdd540', - paid: '0x44dd97802ba8700', - reward: '0x14a8e0a6737f54c', - reverted: false, - outputs: [ - { - contractAddress: null, - events: [], - transfers: [] - } - ] - }, - { - id: '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - chainTag: '39', - blockRef: '0x010b7a6c0bb58653', - expiration: 18, - clauses: [ - { - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - data: '0x799161d500000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290' - }, - { - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - data: '0x799161d500000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290' - } - ], - gasPriceCoef: 64, - gas: 48432, - origin: '0x7487d912d03ab9de786278f679592b3730bdd540', - delegator: 'null', - nonce: '0x176bbcbf79a3a672', - dependsOn: 'null', - size: 219, - gasUsed: 40360, - gasPayer: '0x7487d912d03ab9de786278f679592b3730bdd540', - paid: '0x701bff39d048900', - reward: '0x21a1ffc48b48f80', - reverted: false, - outputs: [ - { - contractAddress: null, - events: [], - transfers: [] - }, - { - contractAddress: null, - events: [], - transfers: [] - } - ] - } - ] - } satisfies ExpandedBlockDetail, - expected: { - hash: '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - parentHash: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - number: '0x0', - size: '0xaa', - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - transactionsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - timestamp: '0x5b322ac0', - gasLimit: '0x989680', - gasUsed: '0x0', - transactions: [ - { - blockHash: - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - blockNumber: '0x0', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x7436', - chainId: '0x0', - hash: '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded', - nonce: '0xb8314776ce0bf5df', - transactionIndex: '0x0', - input: '0xd547741f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - }, - { - blockHash: - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - blockNumber: '0x0', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0xbd30', - chainId: '0x0', - hash: '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - nonce: '0x176bbcbf79a3a672', - transactionIndex: '0x1', - input: '0x799161d500000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - } - ], - miner: '0x0000000000000000000000000000000000000000', - difficulty: '0x0', - totalDifficulty: '0x0', - uncles: [], - sha3Uncles: - '0x0000000000000000000000000000000000000000000000000000000000000000', - nonce: '0x0000000000000000', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - extraData: '0x', - baseFeePerGas: '0x0', - mixHash: - '0x0000000000000000000000000000000000000000000000000000000000000000' - } - } -]; - -/** - * Transaction fixtures - */ -const transactionFixtures = [ - { - testName: 'No clauses transaction', - transaction: { - id: '0xb2e3f6e9782f462d797b72f9cbf5a4c38ca20cabcc1a091f9de6d3e6736c1f7c', - chainTag: 39, - blockRef: '0x010b7b5e57827fe3', - expiration: 18, - clauses: [], - gasPriceCoef: 0, - gas: 399535, - origin: '0x8c59c63d6458c71b6ff88d57698437524a703084', - delegator: null, - nonce: '0x19b4782', - dependsOn: null, - size: 709, - meta: { - blockID: - '0x010b7b5f0192003f70bf2a6a502221e075cb32d676e3443614d21003cc2ee440', - blockNumber: 17529695, - blockTimestamp: 1705328340 - } - } satisfies TransactionDetailNoRaw, - expected: { - blockHash: - '0x010b7b5f0192003f70bf2a6a502221e075cb32d676e3443614d21003cc2ee440', - blockNumber: '0x10b7b5f', - from: '0x8c59c63d6458c71b6ff88d57698437524a703084', - gas: '0x618af', - chainId: '0x0', - hash: '0xb2e3f6e9782f462d797b72f9cbf5a4c38ca20cabcc1a091f9de6d3e6736c1f7c', - nonce: '0x19b4782', - transactionIndex: '0x0', - input: '', - to: null, - value: '', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - } - } -]; - -export { blockFixtures, transactionFixtures }; diff --git a/packages/network/tests/provider/formatter/transactions-formatter.unit.test.ts b/packages/network/tests/provider/formatter/transactions-formatter.unit.test.ts deleted file mode 100644 index 2da96b79f..000000000 --- a/packages/network/tests/provider/formatter/transactions-formatter.unit.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { transactionFixtures } from './fixture'; -import { transactionsFormatter } from '../../../src'; - -/** - * Transactions formatter unit test - * @group unit/provider/formatter/transactions - */ -describe('Transactions formatter unit test', () => { - /** - * Should be able to format a block - */ - transactionFixtures.forEach((transactionFixture) => { - test(transactionFixture.testName, () => { - const formattedTransaction = - transactionsFormatter.formatToRPCStandard( - transactionFixture.transaction, - '0x0', - 0 - ); - expect(formattedTransaction).toStrictEqual( - transactionFixture.expected - ); - }); - }); -}); diff --git a/packages/network/tests/provider/helpers/provider-internal-wallets/base-wallet/fixture.ts b/packages/network/tests/provider/helpers/provider-internal-wallets/base-wallet/fixture.ts deleted file mode 100644 index 45db7b488..000000000 --- a/packages/network/tests/provider/helpers/provider-internal-wallets/base-wallet/fixture.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Generate 10 random accounts -import { Address, Secp256k1 } from '@vechain/sdk-core'; -import { type ProviderInternalWalletAccount } from '../../../../../src'; -import { secp256k1 as nc_secp256k1 } from '@noble/curves/secp256k1'; - -/** - * Fixture of ProviderInternalWalletAccount randomly generated. - */ -const accountsFixture: ProviderInternalWalletAccount[] = Array.from( - { length: 10 }, - () => { - const privateKey = nc_secp256k1.utils.randomPrivateKey(); - const publicKey = Secp256k1.derivePublicKey(privateKey); - const address = Address.ofPublicKey(publicKey).toString(); - - return { - privateKey, - publicKey, - address - } satisfies ProviderInternalWalletAccount; - } -); - -export { accountsFixture }; diff --git a/packages/network/tests/provider/helpers/provider-internal-wallets/base-wallet/provider-internal-base-wallet.unit.test.ts b/packages/network/tests/provider/helpers/provider-internal-wallets/base-wallet/provider-internal-base-wallet.unit.test.ts deleted file mode 100644 index 8d54c56fc..000000000 --- a/packages/network/tests/provider/helpers/provider-internal-wallets/base-wallet/provider-internal-base-wallet.unit.test.ts +++ /dev/null @@ -1,221 +0,0 @@ -import { Hex, Secp256k1, ZERO_ADDRESS } from '@vechain/sdk-core'; -import { InvalidDataType } from '@vechain/sdk-errors'; -import { accountsFixture } from './fixture'; -import { describe, expect, test } from '@jest/globals'; -import { - ProviderInternalBaseWallet, - type SignTransactionOptions -} from '../../../../../src'; - -/** - * Unit test for ProviderInternalBaseWallet class. - * - * @group unit/provider/helpers/provider-internal-base-wallet - */ -describe('Base wallet tests', () => { - /** - * Test 'getAddresses' function. - */ - describe('getAddresses sync and async version', () => { - /** - * Test without blocking execution on steps - */ - test('Should be able to create a wallet and get addresses from them', async () => { - // Initialize a wallet with the accounts - const baseWallet = new ProviderInternalBaseWallet(accountsFixture); - - // Get the addresses from the wallet - expect(baseWallet.accounts).toEqual(accountsFixture); - - // Get the addresses from the wallet - const addresses = await baseWallet.getAddresses(); - expect(addresses).toEqual( - accountsFixture.map((account) => account.address) - ); - - // Get addresses synchronously - const addressesSync = baseWallet.getAddressesSync(); - expect(addressesSync).toEqual( - accountsFixture.map((account) => account.address) - ); - - // Expect the addresses to be the same - expect(addresses).toEqual(addressesSync); - }); - }); - - /** - * Test 'getAccount' function. - */ - describe('getAccount sync and async version', () => { - /** - * Should be able to get an account by address - */ - test('Should be able to get an account by address', async () => { - // Initialize a wallet with the accounts - const baseWallet = new ProviderInternalBaseWallet(accountsFixture); - - // Get the addresses from the wallet - const randomAccount = - accountsFixture[ - // eslint-disable-next-line sonarjs/pseudo-random - Math.floor(Math.random() * accountsFixture.length) - ]; - - // Get the account by address - const randomAccountFromWallet = await baseWallet.getAccount( - randomAccount.address - ); - expect(randomAccountFromWallet).toEqual(randomAccount); - - // Get the account by address synchronously - const randomAccountFromWalletSync = baseWallet.getAccountSync( - randomAccount.address - ); - expect(randomAccountFromWalletSync).toEqual(randomAccount); - - // Expect the addresses to be the same - expect(randomAccountFromWallet).toEqual( - randomAccountFromWalletSync - ); - }); - - /** - * Should be able to get an account by index - */ - test('Should be able to get an account by index', async () => { - // Initialize a wallet with the accounts - const baseWallet = new ProviderInternalBaseWallet(accountsFixture); - - // Random index - const randomIndex = Math.floor( - // eslint-disable-next-line sonarjs/pseudo-random - Math.random() * accountsFixture.length - ); - - // Get the addresses from the wallet - const randomAccount = accountsFixture[randomIndex]; - - // Get the account by address - const randomAccountFromWallet = - await baseWallet.getAccount(randomIndex); - - expect(randomAccountFromWallet).toEqual(randomAccount); - }); - - /** - * Should be able to get the first account if account index is not provided - */ - test('Should be able to get the first account', async () => { - // Initialize a wallet with the accounts - const baseWallet = new ProviderInternalBaseWallet(accountsFixture); - - // Get the account by address - const randomAccountFromWallet = await baseWallet.getAccount(); - - expect(randomAccountFromWallet).toEqual(accountsFixture[0]); - }); - - /** - * Should get null when trying to get an account by a not existing address - */ - test('Should get null when trying to get an account by a not existing address', async () => { - // Initialize a wallet with the accounts - const baseWallet = new ProviderInternalBaseWallet(accountsFixture); - - // Get the account by not existing address - const notExistingAccount = - await baseWallet.getAccount(ZERO_ADDRESS); - - expect(notExistingAccount).toEqual(null); - }); - - /** - * Should throw error when trying to get an account by invalid address - */ - test('Should throw error when trying to get an account by invalid address', async () => { - // Initialize a wallet with the accounts - const baseWallet = new ProviderInternalBaseWallet(accountsFixture); - - // Get the account by address - const invalidAddress = 'INVALID_ADDRESS'; - await expect( - baseWallet.getAccount(invalidAddress) - ).rejects.toThrowError(InvalidDataType); - }); - - /** - * Should get null when trying to get an account by a not existing index - */ - test('Should get null when trying to get an account by a wallet without accounts', async () => { - // Initialize a wallet with the accounts - const baseWallet = new ProviderInternalBaseWallet([]); - - // Get the account by not existing index - const notExistingAccount = await baseWallet.getAccount(); - - expect(notExistingAccount).toEqual(null); - }); - }); - - /** - * Test 'getDelegator' function. - */ - describe('getDelegator sync and async version', () => { - /** - * Should be able to get the delegator options - */ - test('Should be able to get the delegator', async () => { - // Initialize delegator - const delegators: SignTransactionOptions[] = [ - { - delegatorPrivateKey: Hex.of( - await Secp256k1.generatePrivateKey() - ).digits - }, - { - delegatorUrl: - 'https://sponsor-testnet.vechain.energy/by/269' - } - ]; - - for (const delegator of delegators) { - // Initialize a wallet with the accounts and delegator - const baseWalletWithDelegator = new ProviderInternalBaseWallet( - accountsFixture, - { - delegator - } - ); - - // Get the delegator from the wallet - const currentDelegator = - await baseWalletWithDelegator.getDelegator(); - expect(currentDelegator).toEqual(delegator); - - // Get the delegator from the wallet synchronously - const currentDelegatorSync = - baseWalletWithDelegator.getDelegatorSync(); - expect(currentDelegatorSync).toEqual(delegator); - - // Expect the delegators to be the same - expect(currentDelegator).toEqual(currentDelegatorSync); - } - }); - - /** - * Should get null if delegator is not set - */ - test('Should get null if delegator is not set', async () => { - // Initialize a wallet with the accounts - const baseWalletWithoutDelegator = new ProviderInternalBaseWallet( - accountsFixture - ); - - // Get the delegator from the wallet that has no delegator - const delegator = await baseWalletWithoutDelegator.getDelegator(); - - expect(delegator).toBeNull(); - }); - }); -}); diff --git a/packages/network/tests/provider/helpers/provider-internal-wallets/hd-wallet/fixture.ts b/packages/network/tests/provider/helpers/provider-internal-wallets/hd-wallet/fixture.ts deleted file mode 100644 index 7b9a62dc5..000000000 --- a/packages/network/tests/provider/helpers/provider-internal-wallets/hd-wallet/fixture.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { HDKey } from '@vechain/sdk-core'; -import { type SignTransactionOptions } from '../../../../../src'; - -/** - * HDNode fixtures - */ -const hdNodeFixtures = [ - { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - path: HDKey.VET_DERIVATION_PATH, - count: 5, - initialIndex: 0, - delegator: { - delegatorPrivateKey: - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - } satisfies SignTransactionOptions, - expectedAddress: [ - '0x783DE01F06b4F2a068A7b3Bb6ff3db821A08f8c1', - '0x2406180BCa83983d40191Febc6d939C62152B71b', - '0xB381e7da548601B1CCB05C66d415b20baE40d828', - '0x9829EF01aD8F7C042613d4Dc5a54D54e2c140bae', - '0x2C5d39ebB1be41a62BcC9c50F4f49149dc1BB256' - ] - }, - { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - count: 1, - initialIndex: 6, - delegator: { - delegatorUrl: 'https://sponsor-testnet.vechain.energy/by/269' - } satisfies SignTransactionOptions, - expectedAddress: ['0x8ef651aC457C9bf5206EC3D2cbD4232Df0438607'] - }, - { - mnemonic: - 'vivid any call mammal mosquito budget midnight expose spirit approve reject system', - expectedAddress: ['0x783DE01F06b4F2a068A7b3Bb6ff3db821A08f8c1'] - } -]; - -export { hdNodeFixtures }; diff --git a/packages/network/tests/provider/helpers/provider-internal-wallets/hd-wallet/provider-internal-hd-wallet.unit.test.ts b/packages/network/tests/provider/helpers/provider-internal-wallets/hd-wallet/provider-internal-hd-wallet.unit.test.ts deleted file mode 100644 index 5f22312e2..000000000 --- a/packages/network/tests/provider/helpers/provider-internal-wallets/hd-wallet/provider-internal-hd-wallet.unit.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; - -import { hdNodeFixtures } from './fixture'; -import { - DelegationHandler, - ProviderInternalHDWallet -} from '../../../../../src'; - -/** - * Unit test for ProviderInternalHDWallet class. - * - * @group unit/provider/helpers/provider-internal-hd-wallet - */ -describe('ProviderInternalHDWallet wallet tests', () => { - /** - * Test the creation of the hd wallet - */ - describe('Test wallet creation', () => { - /** - * Test without blocking execution on steps - */ - hdNodeFixtures.forEach((hdNodeFixture) => { - /** - * Test wallet creation and execution of wallet functions - */ - test('Should be able to create a wallet and execute functions', async () => { - const hdWallet = new ProviderInternalHDWallet( - hdNodeFixture.mnemonic.split(' '), - hdNodeFixture.count, - hdNodeFixture.initialIndex, - hdNodeFixture.path, - { delegator: hdNodeFixture.delegator } - ); - - const addresses = await hdWallet.getAddresses(); - const delegator = await hdWallet.getDelegator(); - - expect(addresses).toEqual(hdNodeFixture.expectedAddress); - expect(delegator).toEqual( - DelegationHandler(delegator).delegatorOrNull() - ); - }); - }); - }); -}); diff --git a/packages/network/tests/provider/helpers/transaction/fixture.ts b/packages/network/tests/provider/helpers/transaction/fixture.ts deleted file mode 100644 index fefd2ea8b..000000000 --- a/packages/network/tests/provider/helpers/transaction/fixture.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - blockWithTransactionsExpanded, - blockWithTransactionsNotExpanded -} from '../../fixture'; - -/** - * Test cases for getTransactionIndex - */ -const getTransactionIndexTestCases = [ - { - block: blockWithTransactionsExpanded, - hash: '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - expected: 1 - }, - { - block: blockWithTransactionsExpanded, - hash: '0xb476d1a43b8632c25a581465c944a1cb5dd99e48d41d326a250847a0a279afa5', - expected: 2 - }, - { - block: blockWithTransactionsNotExpanded, - hash: '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded', - expected: 0 - } -]; - -/** - * Test cases for getTransactionIndex with invalid data - */ -const invalidGetTransactionIndexTestCases = [ - { - block: blockWithTransactionsExpanded, - hash: '0x' - }, - { - block: blockWithTransactionsExpanded, - hash: '0xf476d1a43b8632c25a581465c944a1cb5dd99e48541d326a250847a0a279afa5' - }, - { - block: blockWithTransactionsNotExpanded, - hash: 'invalid-hash' - } -]; - -export { getTransactionIndexTestCases, invalidGetTransactionIndexTestCases }; diff --git a/packages/network/tests/provider/helpers/transaction/transaction-helpers.unit.test.ts b/packages/network/tests/provider/helpers/transaction/transaction-helpers.unit.test.ts deleted file mode 100644 index b20687309..000000000 --- a/packages/network/tests/provider/helpers/transaction/transaction-helpers.unit.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { - getTransactionIndexTestCases, - invalidGetTransactionIndexTestCases -} from './fixture'; - -import { InvalidDataType } from '@vechain/sdk-errors'; -import { getTransactionIndexIntoBlock } from '../../../../src'; - -/** - * Provider transaction helpers test suite - * - * @group unit/helpers/transaction - */ -describe('Provider Transaction Helpers', () => { - /** - * Test suite for getTransactionIndex - */ - describe('getTransactionIndex', () => { - /** - * Test cases for getTransactionIndex - */ - getTransactionIndexTestCases.forEach(({ block, hash, expected }) => { - test(`should return ${expected} for ${hash}`, () => { - const idx = getTransactionIndexIntoBlock(block, hash); - expect(idx).toBe(expected); - }); - }); - - /** - * Test cases for getTransactionIndex with invalid data - */ - invalidGetTransactionIndexTestCases.forEach(({ block, hash }) => { - test(`should throw error for ${hash}`, () => { - expect(() => - getTransactionIndexIntoBlock(block, hash) - ).toThrowError(InvalidDataType); - }); - }); - }); -}); diff --git a/packages/network/tests/provider/providers/ethers/ethers-provider.mainnet.test.ts b/packages/network/tests/provider/providers/ethers/ethers-provider.mainnet.test.ts deleted file mode 100644 index 2d5fb4c82..000000000 --- a/packages/network/tests/provider/providers/ethers/ethers-provider.mainnet.test.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { - HardhatVeChainProvider, - JSONRPCEthersProvider, - MAINNET_URL, - ProviderInternalBaseWallet, - type SubscriptionEvent -} from '../../../../src'; - -import { MAINNET_NETWORK } from '@vechain/sdk-core'; -import { providerMethodsTestCasesMainnet } from '../fixture'; - -/** - *VeChain provider tests - Main Network - * - * @group integration/providers/vechain-provider-mainnet - */ -describe('VeChain provider tests - solo', () => { - let hardhatVeChainProvider: HardhatVeChainProvider; - let jsonRPCEthersProvider: JSONRPCEthersProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - hardhatVeChainProvider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - MAINNET_URL, - (message: string, parent?: Error) => new Error(message, parent), - false - ); - jsonRPCEthersProvider = new JSONRPCEthersProvider( - MAINNET_NETWORK.chainTag, - MAINNET_URL, - hardhatVeChainProvider - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - hardhatVeChainProvider.destroy(); - jsonRPCEthersProvider.destroy(); - }); - - /** - * eth_getBalance RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await jsonRPCEthersProvider.send('eth_blockNumber', []); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesMainnet.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await jsonRPCEthersProvider.send( - method, - params - ); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * eth_subscribe latest blocks RPC call test - */ - test('Should be able to get to subscribe to the latest blocks', async () => { - const messageReceived = new Promise((resolve) => { - void jsonRPCEthersProvider.on('block', (message) => { - resolve(message); - jsonRPCEthersProvider.destroy(); - }); - }); - - const message = (await messageReceived) as SubscriptionEvent; - - // Optionally, you can do assertions or other operations with the message - expect(message).toBeDefined(); - }, 30000); - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(jsonRPCEthersProvider).toBeDefined(); - - // Call RPC function - await expect( - async () => await jsonRPCEthersProvider.send('INVALID_METHOD', [-1]) - ).rejects.toThrowError(); - }); -}); diff --git a/packages/network/tests/provider/providers/ethers/ethers-provider.solo.test.ts b/packages/network/tests/provider/providers/ethers/ethers-provider.solo.test.ts deleted file mode 100644 index 384f843ef..000000000 --- a/packages/network/tests/provider/providers/ethers/ethers-provider.solo.test.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { - HardhatVeChainProvider, - JSONRPCEthersProvider, - ProviderInternalBaseWallet, - type SubscriptionEvent, - THOR_SOLO_URL -} from '../../../../src'; - -import { SOLO_NETWORK } from '@vechain/sdk-core'; -import { providerMethodsTestCasesSolo } from '../fixture'; - -/** - *VeChain provider tests - Solo Network - * - * @group integration/providers/vechain-provider-solo - */ -describe('VeChain provider tests - solo', () => { - let hardhatVeChainProvider: HardhatVeChainProvider; - let jsonRPCEthersProvider: JSONRPCEthersProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - hardhatVeChainProvider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - THOR_SOLO_URL, - (message: string, parent?: Error) => new Error(message, parent), - false - ); - jsonRPCEthersProvider = new JSONRPCEthersProvider( - SOLO_NETWORK.chainTag, - THOR_SOLO_URL, - hardhatVeChainProvider - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - hardhatVeChainProvider.destroy(); - jsonRPCEthersProvider.destroy(); - }); - - /** - * eth_getBalance RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await jsonRPCEthersProvider.send('eth_blockNumber', []); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesSolo.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await jsonRPCEthersProvider.send( - method, - params - ); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * eth_subscribe latest blocks RPC call test - */ - test('Should be able to get to subscribe to the latest blocks', async () => { - const messageReceived = new Promise((resolve) => { - void jsonRPCEthersProvider.on('block', (message) => { - resolve(message); - jsonRPCEthersProvider.destroy(); - }); - }); - - const message = (await messageReceived) as SubscriptionEvent; - - // Optionally, you can do assertions or other operations with the message - expect(message).toBeDefined(); - }, 30000); - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(jsonRPCEthersProvider).toBeDefined(); - - // Call RPC function - await expect( - async () => await jsonRPCEthersProvider.send('INVALID_METHOD', [-1]) - ).rejects.toThrowError(); - }); -}); diff --git a/packages/network/tests/provider/providers/ethers/ethers-provider.testnet.test.ts b/packages/network/tests/provider/providers/ethers/ethers-provider.testnet.test.ts deleted file mode 100644 index 00c30b186..000000000 --- a/packages/network/tests/provider/providers/ethers/ethers-provider.testnet.test.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { - HardhatVeChainProvider, - JSONRPCEthersProvider, - ProviderInternalBaseWallet, - type SubscriptionEvent, - TESTNET_URL -} from '../../../../src'; - -import { TESTNET_NETWORK } from '@vechain/sdk-core'; -import { providerMethodsTestCasesTestnet } from '../fixture'; - -/** - *VeChain provider tests - Test Network - * - * @group integration/providers/vechain-provider-testnet - */ -describe('Vechain provider tests - solo', () => { - let hardhatVeChainProvider: HardhatVeChainProvider; - let jsonRPCEthersProvider: JSONRPCEthersProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - hardhatVeChainProvider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - TESTNET_URL, - (message: string, parent?: Error) => new Error(message, parent), - false - ); - jsonRPCEthersProvider = new JSONRPCEthersProvider( - TESTNET_NETWORK.chainTag, - TESTNET_URL, - hardhatVeChainProvider - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - hardhatVeChainProvider.destroy(); - jsonRPCEthersProvider.destroy(); - }); - - /** - * eth_getBalance RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await jsonRPCEthersProvider.send('eth_blockNumber', []); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesTestnet.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await jsonRPCEthersProvider.send( - method, - params - ); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - }, - 8000 - ); - - /** - * eth_subscribe latest blocks RPC call test - */ - test('Should be able to get to subscribe to the latest blocks', async () => { - const messageReceived = new Promise((resolve) => { - void jsonRPCEthersProvider.on('block', (message) => { - resolve(message); - jsonRPCEthersProvider.destroy(); - }); - }); - - const message = (await messageReceived) as SubscriptionEvent; - - // Optionally, you can do assertions or other operations with the message - expect(message).toBeDefined(); - }, 30000); - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(jsonRPCEthersProvider).toBeDefined(); - - // Call RPC function - await expect( - async () => await jsonRPCEthersProvider.send('INVALID_METHOD', [-1]) - ).rejects.toThrowError(); - }); -}); diff --git a/packages/network/tests/provider/providers/fixture.ts b/packages/network/tests/provider/providers/fixture.ts deleted file mode 100644 index ed9c74885..000000000 --- a/packages/network/tests/provider/providers/fixture.ts +++ /dev/null @@ -1,282 +0,0 @@ -import { Quantity, Units } from '@vechain/sdk-core'; -import { zeroBlock } from '../rpc-mapper/methods/eth_getBlockByNumber/fixture'; -import { - validTransactionDetailTestnet, - validTransactionHashTestnet -} from '../fixture'; -import { - TESTING_CONTRACT_ADDRESS, - TESTING_CONTRACT_BYTECODE -} from '../../fixture'; -import { THOR_SOLO_ACCOUNTS } from '../../../src'; - -/** - * Test cases for provider methods - Testnet - */ -const providerMethodsTestCasesTestnet = [ - { - description: - "Should be able to call eth_getBlockByNumber with '0x0' as the block number", - method: 'eth_getBlockByNumber', - params: [Quantity.of(0).toString(), false], - expected: zeroBlock - }, - { - description: 'Should be able to call eth_chainId', - method: 'eth_chainId', - params: [], - expected: '0x186aa' - }, - { - description: `Should be able to call eth_getTransactionByHash with ${validTransactionHashTestnet} as the transaction hash`, - method: 'eth_getTransactionByHash', - params: [validTransactionHashTestnet], - expected: validTransactionDetailTestnet - } -]; - -/** - * Test cases for provider methods - Solo Network - */ -const providerMethodsTestCasesSolo = [ - { - description: - 'Should be able to call eth_getBalance of an address with balance more than 0 VET', - method: 'eth_getBalance', - params: [THOR_SOLO_ACCOUNTS[0].address, 'latest'], - expected: Quantity.of(Units.parseEther('500000000').bi).toString() - }, - { - description: 'Should be able to call eth_getCode of a smart contract', - method: 'eth_getCode', - params: [TESTING_CONTRACT_ADDRESS, 'latest'], - expected: TESTING_CONTRACT_BYTECODE - } -]; - -const logsInput = { - address: [ - '0x0000000000000000000000000000456e65726779', - '0x0000000000000000000000000000456e65726779' - ], - fromBlock: Quantity.of(0).toString(), - toBlock: Quantity.of(100000).toString(), - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ] -}; - -/** - * Test cases for provider methods - Mainnet - */ -const providerMethodsTestCasesMainnet = [ - { - description: - 'Should be able to call eth_getStorageAt of a smart contract that has a storage slot not empty', - method: 'eth_getStorageAt', - params: [ - '0x93Ae8aab337E58A6978E166f8132F59652cA6C56', // Contract with non-null storage slot at position 1 - '0x1', - '0x10afdf1' // Block n. 17497585 - ], - expected: - '0x0000000000000000000000000000000000000000000000000000000061474260' - } -]; - -const ERC20_BYTECODE: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600b81526020017f53616d706c65546f6b656e0000000000000000000000000000000000000000008152506040518060400160405280600281526020017f535400000000000000000000000000000000000000000000000000000000000081525081600390816200008f91906200062c565b508060049081620000a191906200062c565b505050620000e633620000b9620000ec60201b60201c565b60ff16600a620000ca919062000896565b620f4240620000da9190620008e7565b620000f560201b60201c565b62000a3a565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200016a5760006040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000161919062000977565b60405180910390fd5b6200017e600083836200018260201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603620001d8578060026000828254620001cb919062000994565b92505081905550620002ae565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101562000267578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016200025e93929190620009e0565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620002f9578060026000828254039250508190555062000346565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620003a5919062000a1d565b60405180910390a3505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043457607f821691505b6020821081036200044a5762000449620003ec565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620004b47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000475565b620004c0868362000475565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200050d620005076200050184620004d8565b620004e2565b620004d8565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b84845462000482565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000450565b620005b18462000465565b81016020851015620005c1578190505b620005d9620005d08562000465565b8301826200056a565b50505b505050565b600082821c905092915050565b60006200060160001984600802620005e1565b1980831691505092915050565b60006200061c8383620005ee565b9150826002028217905092915050565b6200063782620003b2565b67ffffffffffffffff811115620006535762000652620003bd565b5b6200065f82546200041b565b6200066c82828562000591565b600060209050601f831160018114620006a457600084156200068f578287015190505b6200069b85826200060e565b8655506200070b565b601f198416620006b48662000450565b60005b82811015620006de57848901518255600182019150602085019450602081019050620006b7565b86831015620006fe5784890151620006fa601f891682620005ee565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620007a15780860481111562000779576200077862000713565b5b6001851615620007895780820291505b8081029050620007998562000742565b945062000759565b94509492505050565b600082620007bc57600190506200088f565b81620007cc57600090506200088f565b8160018114620007e55760028114620007f05762000826565b60019150506200088f565b60ff84111562000805576200080462000713565b5b8360020a9150848211156200081f576200081e62000713565b5b506200088f565b5060208310610133831016604e8410600b8410161715620008605782820a9050838111156200085a576200085962000713565b5b6200088f565b6200086f84848460016200074f565b9250905081840481111562000889576200088862000713565b5b81810290505b9392505050565b6000620008a382620004d8565b9150620008b083620004d8565b9250620008df7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620007aa565b905092915050565b6000620008f482620004d8565b91506200090183620004d8565b92508282026200091181620004d8565b915082820484148315176200092b576200092a62000713565b5b5092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200095f8262000932565b9050919050565b620009718162000952565b82525050565b60006020820190506200098e600083018462000966565b92915050565b6000620009a182620004d8565b9150620009ae83620004d8565b9250828201905080821115620009c957620009c862000713565b5b92915050565b620009da81620004d8565b82525050565b6000606082019050620009f7600083018662000966565b62000a066020830185620009cf565b62000a156040830184620009cf565b949350505050565b600060208201905062000a346000830184620009cf565b92915050565b610e558062000a4a6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610aa9565b60405180910390f35b6100d060048036038101906100cb9190610b64565b610292565b6040516100dd9190610bbf565b60405180910390f35b6100ee6102b5565b6040516100fb9190610be9565b60405180910390f35b61011e60048036038101906101199190610c04565b6102bf565b60405161012b9190610bbf565b60405180910390f35b61013c6102ee565b6040516101499190610c73565b60405180910390f35b61016c60048036038101906101679190610c8e565b6102f7565b6040516101799190610be9565b60405180910390f35b61018a61033f565b6040516101979190610aa9565b60405180910390f35b6101ba60048036038101906101b59190610b64565b6103d1565b6040516101c79190610bbf565b60405180910390f35b6101ea60048036038101906101e59190610cbb565b6103f4565b6040516101f79190610be9565b60405180910390f35b60606003805461020f90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461023b90610d2a565b80156102885780601f1061025d57610100808354040283529160200191610288565b820191906000526020600020905b81548152906001019060200180831161026b57829003601f168201915b5050505050905090565b60008061029d61047b565b90506102aa818585610483565b600191505092915050565b6000600254905090565b6000806102ca61047b565b90506102d7858285610495565b6102e2858585610529565b60019150509392505050565b60006012905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461034e90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610d2a565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050505050905090565b6000806103dc61047b565b90506103e9818585610529565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b610490838383600161061d565b505050565b60006104a184846103f4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146105235781811015610513578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161050a93929190610d6a565b60405180910390fd5b6105228484848403600061061d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361059b5760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105929190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361060d5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016106049190610da1565b60405180910390fd5b6106188383836107f4565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361068f5760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016106869190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036107015760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016106f89190610da1565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080156107ee578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516107e59190610be9565b60405180910390a35b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084657806002600082825461083a9190610deb565b92505081905550610919565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156108d2578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016108c993929190610d6a565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361096257806002600082825403925050819055506109af565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a0c9190610be9565b60405180910390a3505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610a53578082015181840152602081019050610a38565b60008484015250505050565b6000601f19601f8301169050919050565b6000610a7b82610a19565b610a858185610a24565b9350610a95818560208601610a35565b610a9e81610a5f565b840191505092915050565b60006020820190508181036000830152610ac38184610a70565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610afb82610ad0565b9050919050565b610b0b81610af0565b8114610b1657600080fd5b50565b600081359050610b2881610b02565b92915050565b6000819050919050565b610b4181610b2e565b8114610b4c57600080fd5b50565b600081359050610b5e81610b38565b92915050565b60008060408385031215610b7b57610b7a610acb565b5b6000610b8985828601610b19565b9250506020610b9a85828601610b4f565b9150509250929050565b60008115159050919050565b610bb981610ba4565b82525050565b6000602082019050610bd46000830184610bb0565b92915050565b610be381610b2e565b82525050565b6000602082019050610bfe6000830184610bda565b92915050565b600080600060608486031215610c1d57610c1c610acb565b5b6000610c2b86828701610b19565b9350506020610c3c86828701610b19565b9250506040610c4d86828701610b4f565b9150509250925092565b600060ff82169050919050565b610c6d81610c57565b82525050565b6000602082019050610c886000830184610c64565b92915050565b600060208284031215610ca457610ca3610acb565b5b6000610cb284828501610b19565b91505092915050565b60008060408385031215610cd257610cd1610acb565b5b6000610ce085828601610b19565b9250506020610cf185828601610b19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610d4257607f821691505b602082108103610d5557610d54610cfb565b5b50919050565b610d6481610af0565b82525050565b6000606082019050610d7f6000830186610d5b565b610d8c6020830185610bda565b610d996040830184610bda565b949350505050565b6000602082019050610db66000830184610d5b565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df682610b2e565b9150610e0183610b2e565b9250828201905080821115610e1957610e18610dbc565b5b9291505056fea2646970667358221220912f5265edaea44910db734f0d00fccd257c78dba79c126931551eaad1a334f764736f6c63430008170033'; - -const ERC721_BYTECODE: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600981526020017f53616d706c654e465400000000000000000000000000000000000000000000008152506040518060400160405280600481526020017f534e46540000000000000000000000000000000000000000000000000000000081525081600090816200008f919062000324565b508060019081620000a1919062000324565b5050506200040b565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200012c57607f821691505b602082108103620001425762000141620000e4565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001ac7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200016d565b620001b886836200016d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600062000205620001ff620001f984620001d0565b620001da565b620001d0565b9050919050565b6000819050919050565b6200022183620001e4565b6200023962000230826200020c565b8484546200017a565b825550505050565b600090565b6200025062000241565b6200025d81848462000216565b505050565b5b8181101562000285576200027960008262000246565b60018101905062000263565b5050565b601f821115620002d4576200029e8162000148565b620002a9846200015d565b81016020851015620002b9578190505b620002d1620002c8856200015d565b83018262000262565b50505b505050565b600082821c905092915050565b6000620002f960001984600802620002d9565b1980831691505092915050565b6000620003148383620002e6565b9150826002028217905092915050565b6200032f82620000aa565b67ffffffffffffffff8111156200034b576200034a620000b5565b5b62000357825462000113565b6200036482828562000289565b600060209050601f8311600181146200039c576000841562000387578287015190505b62000393858262000306565b86555062000403565b601f198416620003ac8662000148565b60005b82811015620003d657848901518255600182019150602085019450602081019050620003af565b86831015620003f65784890151620003f2601f891682620002e6565b8355505b6001600288020188555050505b505050505050565b611ea0806200041b6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063691c65d41161008c578063a22cb46511610066578063a22cb4651461026f578063b88d4fde1461028b578063c87b56dd146102a7578063e985e9c5146102d7576100ea565b8063691c65d4146101f157806370a082311461022157806395d89b4114610251576100ea565b8063095ea7b3116100c8578063095ea7b31461016d57806323b872dd1461018957806342842e0e146101a55780636352211e146101c1576100ea565b806301ffc9a7146100ef57806306fdde031461011f578063081812fc1461013d575b600080fd5b61010960048036038101906101049190611673565b610307565b60405161011691906116bb565b60405180910390f35b6101276103e9565b6040516101349190611766565b60405180910390f35b610157600480360381019061015291906117be565b61047b565b604051610164919061182c565b60405180910390f35b61018760048036038101906101829190611873565b610497565b005b6101a3600480360381019061019e91906118b3565b6104ad565b005b6101bf60048036038101906101ba91906118b3565b6105af565b005b6101db60048036038101906101d691906117be565b6105cf565b6040516101e8919061182c565b60405180910390f35b61020b60048036038101906102069190611906565b6105e1565b6040516102189190611942565b60405180910390f35b61023b60048036038101906102369190611906565b610610565b6040516102489190611942565b60405180910390f35b6102596106ca565b6040516102669190611766565b60405180910390f35b61028960048036038101906102849190611989565b61075c565b005b6102a560048036038101906102a09190611afe565b610772565b005b6102c160048036038101906102bc91906117be565b61078f565b6040516102ce9190611766565b60405180910390f35b6102f160048036038101906102ec9190611b81565b6107f8565b6040516102fe91906116bb565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806103d257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806103e257506103e18261088c565b5b9050919050565b6060600080546103f890611bf0565b80601f016020809104026020016040519081016040528092919081815260200182805461042490611bf0565b80156104715780601f1061044657610100808354040283529160200191610471565b820191906000526020600020905b81548152906001019060200180831161045457829003601f168201915b5050505050905090565b6000610486826108f6565b506104908261097e565b9050919050565b6104a982826104a46109bb565b6109c3565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361051f5760006040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401610516919061182c565b60405180910390fd5b6000610533838361052e6109bb565b6109d5565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146105a9578382826040517f64283d7b0000000000000000000000000000000000000000000000000000000081526004016105a093929190611c21565b60405180910390fd5b50505050565b6105ca83838360405180602001604052806000815250610772565b505050565b60006105da826108f6565b9050919050565b600080600660008154809291906105f790611c87565b9190505590506106078382610bef565b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036106835760006040517f89c62b6400000000000000000000000000000000000000000000000000000000815260040161067a919061182c565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600180546106d990611bf0565b80601f016020809104026020016040519081016040528092919081815260200182805461070590611bf0565b80156107525780601f1061072757610100808354040283529160200191610752565b820191906000526020600020905b81548152906001019060200180831161073557829003601f168201915b5050505050905090565b61076e6107676109bb565b8383610c0d565b5050565b61077d8484846104ad565b61078984848484610d7c565b50505050565b606061079a826108f6565b5060006107a5610f33565b905060008151116107c557604051806020016040528060008152506107f0565b806107cf84610f4a565b6040516020016107e0929190611d0b565b6040516020818303038152906040525b915050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008061090283611018565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361097557826040517f7e27328900000000000000000000000000000000000000000000000000000000815260040161096c9190611942565b60405180910390fd5b80915050919050565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600033905090565b6109d08383836001611055565b505050565b6000806109e184611018565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610a2357610a2281848661121a565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610ab457610a65600085600080611055565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614610b37576001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b846002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4809150509392505050565b610c098282604051806020016040528060008152506112de565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610c7e57816040517f5b08ba18000000000000000000000000000000000000000000000000000000008152600401610c75919061182c565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610d6f91906116bb565b60405180910390a3505050565b60008373ffffffffffffffffffffffffffffffffffffffff163b1115610f2d578273ffffffffffffffffffffffffffffffffffffffff1663150b7a02610dc06109bb565b8685856040518563ffffffff1660e01b8152600401610de29493929190611d84565b6020604051808303816000875af1925050508015610e1e57506040513d601f19601f82011682018060405250810190610e1b9190611de5565b60015b610ea2573d8060008114610e4e576040519150601f19603f3d011682016040523d82523d6000602084013e610e53565b606091505b506000815103610e9a57836040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401610e91919061182c565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610f2b57836040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401610f22919061182c565b60405180910390fd5b505b50505050565b606060405180602001604052806000815250905090565b606060006001610f59846112fa565b01905060008167ffffffffffffffff811115610f7857610f776119d3565b5b6040519080825280601f01601f191660200182016040528015610faa5781602001600182028036833780820191505090505b509050600082602001820190505b60011561100d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161100157611000611e12565b5b04945060008503610fb8575b819350505050919050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b808061108e5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156111c257600061109e846108f6565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561110957508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b801561111c575061111a81846107f8565b155b1561115e57826040517fa9fbf51f000000000000000000000000000000000000000000000000000000008152600401611155919061182c565b60405180910390fd5b81156111c057838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b836004600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b61122583838361144d565b6112d957600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361129a57806040517f7e2732890000000000000000000000000000000000000000000000000000000081526004016112919190611942565b60405180910390fd5b81816040517f177e802f0000000000000000000000000000000000000000000000000000000081526004016112d0929190611e41565b60405180910390fd5b505050565b6112e8838361150e565b6112f56000848484610d7c565b505050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611358577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161134e5761134d611e12565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310611395576d04ee2d6d415b85acef8100000000838161138b5761138a611e12565b5b0492506020810190505b662386f26fc1000083106113c457662386f26fc1000083816113ba576113b9611e12565b5b0492506010810190505b6305f5e10083106113ed576305f5e10083816113e3576113e2611e12565b5b0492506008810190505b612710831061141257612710838161140857611407611e12565b5b0492506004810190505b60648310611435576064838161142b5761142a611e12565b5b0492506002810190505b600a8310611444576001810190505b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561150557508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806114c657506114c584846107f8565b5b8061150457508273ffffffffffffffffffffffffffffffffffffffff166114ec8361097e565b73ffffffffffffffffffffffffffffffffffffffff16145b5b90509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036115805760006040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401611577919061182c565b60405180910390fd5b600061158e838360006109d5565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146116025760006040517f73c6ac6e0000000000000000000000000000000000000000000000000000000081526004016115f9919061182c565b60405180910390fd5b505050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6116508161161b565b811461165b57600080fd5b50565b60008135905061166d81611647565b92915050565b60006020828403121561168957611688611611565b5b60006116978482850161165e565b91505092915050565b60008115159050919050565b6116b5816116a0565b82525050565b60006020820190506116d060008301846116ac565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156117105780820151818401526020810190506116f5565b60008484015250505050565b6000601f19601f8301169050919050565b6000611738826116d6565b61174281856116e1565b93506117528185602086016116f2565b61175b8161171c565b840191505092915050565b60006020820190508181036000830152611780818461172d565b905092915050565b6000819050919050565b61179b81611788565b81146117a657600080fd5b50565b6000813590506117b881611792565b92915050565b6000602082840312156117d4576117d3611611565b5b60006117e2848285016117a9565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611816826117eb565b9050919050565b6118268161180b565b82525050565b6000602082019050611841600083018461181d565b92915050565b6118508161180b565b811461185b57600080fd5b50565b60008135905061186d81611847565b92915050565b6000806040838503121561188a57611889611611565b5b60006118988582860161185e565b92505060206118a9858286016117a9565b9150509250929050565b6000806000606084860312156118cc576118cb611611565b5b60006118da8682870161185e565b93505060206118eb8682870161185e565b92505060406118fc868287016117a9565b9150509250925092565b60006020828403121561191c5761191b611611565b5b600061192a8482850161185e565b91505092915050565b61193c81611788565b82525050565b60006020820190506119576000830184611933565b92915050565b611966816116a0565b811461197157600080fd5b50565b6000813590506119838161195d565b92915050565b600080604083850312156119a05761199f611611565b5b60006119ae8582860161185e565b92505060206119bf85828601611974565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611a0b8261171c565b810181811067ffffffffffffffff82111715611a2a57611a296119d3565b5b80604052505050565b6000611a3d611607565b9050611a498282611a02565b919050565b600067ffffffffffffffff821115611a6957611a686119d3565b5b611a728261171c565b9050602081019050919050565b82818337600083830152505050565b6000611aa1611a9c84611a4e565b611a33565b905082815260208101848484011115611abd57611abc6119ce565b5b611ac8848285611a7f565b509392505050565b600082601f830112611ae557611ae46119c9565b5b8135611af5848260208601611a8e565b91505092915050565b60008060008060808587031215611b1857611b17611611565b5b6000611b268782880161185e565b9450506020611b378782880161185e565b9350506040611b48878288016117a9565b925050606085013567ffffffffffffffff811115611b6957611b68611616565b5b611b7587828801611ad0565b91505092959194509250565b60008060408385031215611b9857611b97611611565b5b6000611ba68582860161185e565b9250506020611bb78582860161185e565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611c0857607f821691505b602082108103611c1b57611c1a611bc1565b5b50919050565b6000606082019050611c36600083018661181d565b611c436020830185611933565b611c50604083018461181d565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611c9282611788565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611cc457611cc3611c58565b5b600182019050919050565b600081905092915050565b6000611ce5826116d6565b611cef8185611ccf565b9350611cff8185602086016116f2565b80840191505092915050565b6000611d178285611cda565b9150611d238284611cda565b91508190509392505050565b600081519050919050565b600082825260208201905092915050565b6000611d5682611d2f565b611d608185611d3a565b9350611d708185602086016116f2565b611d798161171c565b840191505092915050565b6000608082019050611d99600083018761181d565b611da6602083018661181d565b611db36040830185611933565b8181036060830152611dc58184611d4b565b905095945050505050565b600081519050611ddf81611647565b92915050565b600060208284031215611dfb57611dfa611611565b5b6000611e0984828501611dd0565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000604082019050611e56600083018561181d565b611e636020830184611933565b939250505056fea2646970667358221220af86505f0580469a6f5c34114f42782e33b1678efb535f9aeaeb0817e598ec2c64736f6c63430008160033'; - -const ERC20_ABI = [ - { inputs: [], stateMutability: 'nonpayable', type: 'constructor' }, - { - inputs: [ - { internalType: 'address', name: 'spender', type: 'address' }, - { internalType: 'uint256', name: 'allowance', type: 'uint256' }, - { internalType: 'uint256', name: 'needed', type: 'uint256' } - ], - name: 'ERC20InsufficientAllowance', - type: 'error' - }, - { - inputs: [ - { internalType: 'address', name: 'sender', type: 'address' }, - { internalType: 'uint256', name: 'balance', type: 'uint256' }, - { internalType: 'uint256', name: 'needed', type: 'uint256' } - ], - name: 'ERC20InsufficientBalance', - type: 'error' - }, - { - inputs: [ - { internalType: 'address', name: 'approver', type: 'address' } - ], - name: 'ERC20InvalidApprover', - type: 'error' - }, - { - inputs: [ - { internalType: 'address', name: 'receiver', type: 'address' } - ], - name: 'ERC20InvalidReceiver', - type: 'error' - }, - { - inputs: [{ internalType: 'address', name: 'sender', type: 'address' }], - name: 'ERC20InvalidSender', - type: 'error' - }, - { - inputs: [{ internalType: 'address', name: 'spender', type: 'address' }], - name: 'ERC20InvalidSpender', - type: 'error' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'spender', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256' - } - ], - name: 'Approval', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256' - } - ], - name: 'Transfer', - type: 'event' - }, - { - inputs: [ - { internalType: 'address', name: 'owner', type: 'address' }, - { internalType: 'address', name: 'spender', type: 'address' } - ], - name: 'allowance', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { internalType: 'address', name: 'spender', type: 'address' }, - { internalType: 'uint256', name: 'value', type: 'uint256' } - ], - name: 'approve', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [{ internalType: 'address', name: 'account', type: 'address' }], - name: 'balanceOf', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'decimals', - outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'name', - outputs: [{ internalType: 'string', name: '', type: 'string' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'symbol', - outputs: [{ internalType: 'string', name: '', type: 'string' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'totalSupply', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { internalType: 'address', name: 'to', type: 'address' }, - { internalType: 'uint256', name: 'value', type: 'uint256' } - ], - name: 'transfer', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'address', name: 'from', type: 'address' }, - { internalType: 'address', name: 'to', type: 'address' }, - { internalType: 'uint256', name: 'value', type: 'uint256' } - ], - name: 'transferFrom', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -const TEST_ACCOUNT: { privateKey: string; address: string } = { - privateKey: - '706e6acd567fdc22db54aead12cb39db01c4832f149f95299aa8dd8bef7d28ff', - address: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54' -}; - -export { - providerMethodsTestCasesTestnet, - providerMethodsTestCasesSolo, - providerMethodsTestCasesMainnet, - logsInput, - ERC20_BYTECODE, - ERC20_ABI, - ERC721_BYTECODE, - TEST_ACCOUNT -}; diff --git a/packages/network/tests/provider/providers/hardhat/hardhat-provider.mainnet.test.ts b/packages/network/tests/provider/providers/hardhat/hardhat-provider.mainnet.test.ts deleted file mode 100644 index b5ccdf3d7..000000000 --- a/packages/network/tests/provider/providers/hardhat/hardhat-provider.mainnet.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { providerMethodsTestCasesMainnet } from '../fixture'; -import { - HardhatVeChainProvider, - MAINNET_URL, - ProviderInternalBaseWallet -} from '../../../../src'; - -/** - * Hardhat provider tests - Mainnet - * - * @group integration/providers/hardhat-provider-mainnet - */ -describe('Hardhat provider tests', () => { - /** - * Hardhat provider instances - */ - let provider: HardhatVeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - MAINNET_URL, - (message: string, parent?: Error) => new Error(message, parent) - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesMainnet.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await provider.request({ - method, - params - }); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * eth_getBalance RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await provider.request({ - method: 'eth_blockNumber', - params: [] - }); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * The methods request, send, sendAsync must give the same result - */ - test('Should be able to get chain id using request, send and sendAsync methods', async () => { - // Call RPC function - const rpcCall = await provider.send('eth_chainId', []); - - // Call RPC function using send method (same result as above) - const rpcCallSend = await provider.send('eth_chainId', []); - - // Call RPC function using send-async method (same result as above) - await provider.sendAsync( - { - jsonrpc: '2.0', - id: 1, - method: 'eth_chainId', - params: [] - }, - (error, response) => { - // Response should be defined - expect(response).toBeDefined(); - - // An error should not be thrown - expect(error).toBeNull(); - - // Expected result - expect(response.result).toBe(rpcCall); - expect(response.result).toBe(rpcCallSend); - } - ); - - // Compare the result with the expected value - expect(rpcCall).toBe(rpcCallSend); - }); - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(provider).toBeDefined(); - - // Call RPC function - await expect( - async () => - await provider.request({ - method: 'INVALID_METHOD', - params: [-1] - }) - ).rejects.toThrowError(); - - // Call RPC function and throw error using send method (same result as above) - await expect( - async () => await provider.send('INVALID_METHOD', [-1]) - ).rejects.toThrowError(); - - // Call RPC function and throw error using send-async method (same result as above) - await provider.sendAsync( - { - jsonrpc: '2.0', - id: 1, - method: 'INVALID_METHOD', - params: [-1] - }, - (error, response) => { - // Response should be undefined - expect(response).toBeDefined(); - - // An error should be thrown - expect(error).toBeDefined(); - } - ); - }); -}); diff --git a/packages/network/tests/provider/providers/hardhat/hardhat-provider.mock.mainnet.test.ts b/packages/network/tests/provider/providers/hardhat/hardhat-provider.mock.mainnet.test.ts deleted file mode 100644 index d94438cc8..000000000 --- a/packages/network/tests/provider/providers/hardhat/hardhat-provider.mock.mainnet.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; - -import { VeChainSDKLogger } from '@vechain/sdk-logging'; -import { - HardhatVeChainProvider, - MAINNET_URL, - ProviderInternalBaseWallet -} from '../../../../src'; - -/** - * Hardhat provider tests - Mainnet - * - * @group integration/providers/hardhat-provider-mainnet - */ -describe('Hardhat provider tests', () => { - /** - * Hardhat provider instances - */ - let providerInDebugMode: HardhatVeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - providerInDebugMode = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - MAINNET_URL, - (message: string, parent?: Error) => new Error(message, parent), - true - ); - }); - - /** - * Test debug mode. - */ - test('Should be able to enable debug mode', async () => { - // Spy on VeChainSDKLogger - const logSpy = jest.spyOn(VeChainSDKLogger('log'), 'log'); - - // Call an RPC function (e.g., eth_blockNumber) - await providerInDebugMode.request({ - method: 'eth_blockNumber', - params: [] - }); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - - /** - * Test debug mode errors. - */ - - /** - * Test debug mode errors in send function. - */ - test('Should be able to log errors in debug mode - send function', async () => { - // Spy on VeChainSDKLogger - const logSpy = jest.spyOn(VeChainSDKLogger('error'), 'log'); - - // Error during call - await expect( - async () => await providerInDebugMode.send('INVALID_METHOD', [-1]) - ).rejects.toThrowError(); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); -}); diff --git a/packages/network/tests/provider/providers/hardhat/hardhat-provider.solo.test.ts b/packages/network/tests/provider/providers/hardhat/hardhat-provider.solo.test.ts deleted file mode 100644 index 6e3576474..000000000 --- a/packages/network/tests/provider/providers/hardhat/hardhat-provider.solo.test.ts +++ /dev/null @@ -1,354 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { ABIContract, HexUInt } from '@vechain/sdk-core'; -import { - HardhatVeChainProvider, - ProviderInternalBaseWallet, - type SubscriptionEvent, - THOR_SOLO_URL, - ThorClient, - type VeChainProvider, - type VeChainSigner -} from '../../../../src'; -import { providerMethodsTestCasesSolo, TEST_ACCOUNT } from '../fixture'; -import { - deployERC20Contract, - deployERC721Contract, - waitForMessage -} from '../helpers'; - -/** - *VeChain provider tests - Solo Network - * - * @group integration/providers/vechain-provider-solo - */ -describe('Hardhat provider tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: HardhatVeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(THOR_SOLO_URL); - provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([ - { - privateKey: HexUInt.of(TEST_ACCOUNT.privateKey).bytes, - address: TEST_ACCOUNT.address - } - ]), - THOR_SOLO_URL, - (message: string, parent?: Error) => new Error(message, parent), - true - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesSolo.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await provider.request({ - method, - params - }); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * eth_getBalance RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await provider.request({ - method: 'eth_blockNumber', - params: [] - }); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * eth_subscribe latest blocks RPC call test - */ - test('Should be able to get to subscribe to the latest blocks', async () => { - // Call RPC function - const subscriptionId = await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - }); - - const messageReceived = new Promise((resolve) => { - provider.on('message', (message) => { - resolve(message); - provider.destroy(); - }); - }); - - const message = (await messageReceived) as SubscriptionEvent; - - // Optionally, you can do assertions or other operations with the message - expect(message).toBeDefined(); - expect(message.method).toBe('eth_subscription'); - expect(message.params).toBeDefined(); - expect(message.params.subscription).toBe(subscriptionId); - expect(message.params.result).toBeDefined(); - }, 12000); - - /** - * eth_subscribe latest blocks and then unsubscribe RPC call test - */ - test('Should be able to get to subscribe to the latest blocks and then unsubscribe', async () => { - expect(provider.getPollInstance()).toBeUndefined(); - // Call RPC function - const subscriptionId = await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - }); - - expect(provider.getPollInstance()).toBeDefined(); - - expect(subscriptionId).toBeDefined(); - expect( - provider.subscriptionManager.newHeadsSubscription?.subscriptionId - ).toBe(subscriptionId); - - await provider.request({ - method: 'eth_unsubscribe', - params: [subscriptionId] - }); - - expect(provider.getPollInstance()).toBeUndefined(); - - expect( - provider.subscriptionManager.newHeadsSubscription?.subscriptionId - ).toBeUndefined(); - }); - - /** - * eth_getSubscribe invalid call - */ - test('Should not be able to subscribe since the subscription type is invalid', async () => { - // Call RPC function - await expect( - async () => - await provider.request({ - method: 'eth_subscribe', - params: ['invalid'] - }) - ).rejects.toThrowError(); - }, 12000); - - /** - * Tests the ability to subscribe to and receive the latest log events from an ERC20 contract using the `eth_subscribe` RPC call. - * - * The test performs the following operations: - * 1. Deploys an ERC20 contract to simulate a real-world token contract scenario. - * 2. Sets up a log subscription for the deployed contract's address to listen for all emitted events (no specific topics). - * 3. Executes a `transfer` transaction on the ERC20 contract to simulate activity that would generate a log event. - * 4. Waits for a message from the subscription, indicating a log event was captured. - * 5. Validates the received message to ensure it contains the expected structure and data: - * - The message is defined and has the correct method. - * - The log event's address matches the ERC20 contract's address. - * - Topics and data within the log event are present and correctly formatted. - * - * @remarks - * - The `waitForMessage` function is assumed to be a utility that returns a Promise which resolves when a new message is received from the subscription. - * - The test uses `@ts-expect-error` annotations to bypass TypeScript's type checking for certain properties we expect to be present in the log event message. This is due to the generic nature of the `message` object, which doesn't have a predefined type that includes the expected fields. - * - An extended timeout of 30 seconds is set to accommodate potential delays in contract deployment, transaction execution, and event propagation. - * - * @throws {Error} If the received message doesn't match the expected format or if the log event details are incorrect, indicating an issue with the subscription or the event emission process. - */ - test('Should be able to get to subscribe to the latest logs of an erc20 contract', async () => { - const contract = await deployERC20Contract( - thorClient, - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner - ); - - const logsParams = { - address: [contract.address], - topics: [] - }; - - // Call RPC function to subscribe to logs - const rpcCall = await provider.request({ - method: 'eth_subscribe', - params: ['logs', logsParams] - }); - // Wait for the subscription to receive a message (log event) - const messageReceived = waitForMessage(provider as VeChainProvider); - - // Execute a contract transaction to generate a log event - await thorClient.contracts.executeTransaction( - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner, - contract.address, - ABIContract.ofAbi(contract.abi).getFunction('transfer'), - [TEST_ACCOUNT.address, 100] - ); - - const message = await messageReceived; - - // Clean up the subscription - provider.destroy(); - - // Assertions to validate the received message - expect(message).toBeDefined(); - expect(message.method).toBeDefined(); - expect(message.params).toBeDefined(); - - // @ts-expect-error - Asserting that the log event contains the expected contract address - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(message.params.result[0].address).toBe(contract.address); - - // @ts-expect-error - Asserting that the log event contains defined topics - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(message.params.result[0].topics).toBeDefined(); - - // @ts-expect-error - Asserting that the log event contains data - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(message.params.result[0].data).toBeDefined(); - - // Validate the RPC call was successful - expect(rpcCall).not.toBe('0x0'); - }, 30000); - - /** - * Tests the ability to subscribe to and receive log events for both ERC20 and ERC721 token contracts. - * - * This test performs the following operations: - * 1. Deploys an ERC20 and an ERC721 contract to simulate token transactions. - * 2. Sets up subscriptions to listen for log events from both contracts using the `eth_subscribe` method. - * 3. Executes transactions on both contracts: - * - For the ERC20 contract, it simulates a token transfer. - * - For the ERC721 contract, it simulates minting a new token. - * 4. Waits for and collects log events emitted by these transactions. - * 5. Asserts that the received log events match the expected results, including: - * - The presence and count of the log events. - * - Matching subscription IDs to verify the correct source of the events. - * - Non-empty log data to ensure event details are captured. - * - * Note: The test uses `@ts-expect-error` to assert the presence of `params.result` in log events, - * acknowledging potential TypeScript type safety concerns while expecting the data to be present. - * - * @remarks - * The test includes an extended timeout of 10 seconds to accommodate the asynchronous nature of - * blockchain transactions and event subscriptions. - * - * @throws {Error} If any of the assertions fail, indicating a problem with event subscription or log data capture. - */ - test('Should be able to subscribe to the latest logs of an erc20 and erc721 contract', async () => { - // Test setup: Deploy contracts and set up event subscriptions - const erc20Contract = await deployERC20Contract( - thorClient, - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner - ); - const erc721Contract = await deployERC721Contract( - thorClient, - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner - ); - - const erc20logsParams = { - address: [erc20Contract.address], - topics: [] - }; - - const erc721logsParams = { - address: [erc721Contract.address], - topics: [] - }; - - const erc20Subscription = await provider.request({ - method: 'eth_subscribe', - params: ['logs', erc20logsParams] - }); - - const erc721Subscription = await provider.request({ - method: 'eth_subscribe', - params: ['logs', erc721logsParams] - }); - - // Collect and assert log events - let results: SubscriptionEvent[] = []; - const eventPromise = new Promise((resolve) => { - provider.on('message', (message: SubscriptionEvent) => { - results.push(message); - if (results.length >= 2) { - provider.destroy(); - resolve(results); - } - }); - }); - - // Execute transactions that should emit events - await thorClient.contracts.executeTransaction( - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner, - erc20Contract.address, - ABIContract.ofAbi(erc20Contract.abi).getFunction('transfer'), - [TEST_ACCOUNT.address, 100] - ); - - await thorClient.contracts.executeTransaction( - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner, - erc721Contract.address, - ABIContract.ofAbi(erc721Contract.abi).getFunction('mintItem'), - [TEST_ACCOUNT.address] - ); - - results = (await eventPromise) as SubscriptionEvent[]; - - // Assertions to validate the received log events - expect(results).toBeDefined(); - expect(results.length).toBeGreaterThan(1); - expect( - results.filter((x) => x.params.subscription === erc20Subscription) - .length - ).toBeGreaterThan(0); - expect( - results.filter((x) => x.params.subscription === erc721Subscription) - .length - ).toBeGreaterThan(0); - - expect(results[0].method).toBe('eth_subscription'); - expect(results[1].method).toBe('eth_subscription'); - - // @ts-expect-error - Asserting that log data is present - expect(results[0].params.result.length).toBeGreaterThan(0); - - // @ts-expect-error - Asserting that log data is present - expect(results[1].params.result.length).toBeGreaterThan(0); - }, 30000); - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(provider).toBeDefined(); - - // Call RPC function - await expect( - async () => - await provider.request({ - method: 'INVALID_METHOD', - params: [-1] - }) - ).rejects.toThrowError(); - }); -}); diff --git a/packages/network/tests/provider/providers/hardhat/hardhat-provider.testnet.test.ts b/packages/network/tests/provider/providers/hardhat/hardhat-provider.testnet.test.ts deleted file mode 100644 index f3a3efc54..000000000 --- a/packages/network/tests/provider/providers/hardhat/hardhat-provider.testnet.test.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { providerMethodsTestCasesTestnet } from '../fixture'; -import { waitForMessage } from '../helpers'; -import { - HardhatVeChainProvider, - ProviderInternalBaseWallet, - TESTNET_URL, - type VeChainProvider -} from '../../../../src'; - -/** - *VeChain provider tests - * - * @group integration/providers/vechain-provider-testnet - */ -describe('Hardhat provider tests - testnet', () => { - /** - * Hardhat provider instances - */ - let provider: HardhatVeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - provider = new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - TESTNET_URL, - (message: string, parent?: Error) => new Error(message, parent) - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesTestnet.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await provider.request({ - method, - params - }); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * eth_blockNumber RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await provider.request({ - method: 'eth_blockNumber', - params: [] - }); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * eth_subscribe latest blocks RPC call test - */ - test('Should be able to get to subscribe to the latest blocks', async () => { - // Call RPC function - const rpcCall = await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - }); - - const messageReceived = waitForMessage(provider as VeChainProvider); - - const message = await messageReceived; - - // Optionally, you can do assertions or other operations with the message - expect(message).toBeDefined(); - expect(message.method).toBe('eth_subscription'); - expect(message.params.subscription).toBeDefined(); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }, 12000); - - /** - * eth_getBalance RPC call test - */ - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(provider).toBeDefined(); - - // Call RPC function - await expect( - async () => - await provider.request({ - method: 'INVALID_METHOD', - params: [-1] - }) - ).rejects.toThrowError(); - }); - - /** - * Custom RPC configuration tests - */ - describe('Custom RPC configuration tests', () => { - /** - * Should return 0 when calling eth_getTransactionCount with rpcConfiguration.ethGetTransactionCountDefaultValue set to true - */ - test('Should return 0 when calling eth_getTransactionCount with rpcConfiguration.ethGetTransactionCountMustReturn0 set to true', async () => { - // Set the custom RPC configuration - const providerWithCustomRPCConfiguration = - new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - TESTNET_URL, - (message: string, parent?: Error) => - new Error(message, parent), - false, - false, - { ethGetTransactionCountMustReturn0: true } - ); - - // Call RPC function - const rpcCall = await providerWithCustomRPCConfiguration.request({ - method: 'eth_getTransactionCount', - params: ['0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', 'latest'] - }); - - // Compare the result with the expected value - expect(rpcCall).toBe('0x0'); - }); - - /** - * Should NOT return 0 when calling eth_getTransactionCount with rpcConfiguration.ethGetTransactionCountDefaultValue set to false - */ - test('Should NOT return 0 when calling eth_getTransactionCount with rpcConfiguration.ethGetTransactionCountMustReturn0 set to false', async () => { - // Set the custom RPC configuration - const providerWithCustomRPCConfiguration = - new HardhatVeChainProvider( - new ProviderInternalBaseWallet([]), - TESTNET_URL, - (message: string, parent?: Error) => - new Error(message, parent), - false, - false, - { ethGetTransactionCountMustReturn0: false } - ); - - // Call RPC function - const rpcCall = await providerWithCustomRPCConfiguration.request({ - method: 'eth_getTransactionCount', - params: ['0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', 'latest'] - }); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - }); -}); diff --git a/packages/network/tests/provider/providers/helpers.ts b/packages/network/tests/provider/providers/helpers.ts deleted file mode 100644 index 6fdf4dbfa..000000000 --- a/packages/network/tests/provider/providers/helpers.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { ERC20_ABI, ERC20_BYTECODE, ERC721_BYTECODE } from './fixture'; - -import { ERC721_ABI } from '@vechain/sdk-core'; -import { - type SubscriptionEvent, - type ThorClient, - type VeChainProvider, - type VeChainSigner, - type Contract -} from '../../../src'; - -export async function waitForMessage( - provider: VeChainProvider -): Promise { - return await new Promise((resolve) => { - provider.on('message', (message) => { - resolve(message as SubscriptionEvent); - provider.destroy(); - }); - }); -} - -export async function deployERC20Contract( - thorClient: ThorClient, - signer: VeChainSigner -): Promise> { - const factory = thorClient.contracts.createContractFactory( - ERC20_ABI, - ERC20_BYTECODE, - signer - ); - - await factory.startDeployment(); - - return await factory.waitForDeployment(); -} - -export async function deployERC721Contract( - thorClient: ThorClient, - signer: VeChainSigner -): Promise> { - const factory = thorClient.contracts.createContractFactory( - ERC721_ABI, - ERC721_BYTECODE, - signer - ); - - await factory.startDeployment(); - - return await factory.waitForDeployment(); -} diff --git a/packages/network/tests/provider/providers/vechain/vechain-provider.mainnet.test.ts b/packages/network/tests/provider/providers/vechain/vechain-provider.mainnet.test.ts deleted file mode 100644 index ab3df5240..000000000 --- a/packages/network/tests/provider/providers/vechain/vechain-provider.mainnet.test.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { JSONRPCMethodNotFound } from '@vechain/sdk-errors'; -import { mainNetwork } from '../../../fixture'; -import { providerMethodsTestCasesMainnet } from '../fixture'; -import { ThorClient, VeChainProvider } from '../../../../src'; - -/** - *VeChain provider tests - Mainnet - * - * @group integration/providers/vechain-provider-mainnet - */ -describe('VeChain provider tests - mainnet', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = new ThorClient(mainNetwork); - provider = new VeChainProvider(thorClient); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesMainnet.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await provider.request({ - method, - params - }); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * eth_getBalance RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await provider.request({ - method: 'eth_blockNumber', - params: [] - }); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(provider).toBeDefined(); - - // Call RPC function - await expect( - async () => - await provider.request({ - method: 'INVALID_METHOD', - params: [-1] - }) - ).rejects.toThrowError(JSONRPCMethodNotFound); - }); -}); diff --git a/packages/network/tests/provider/providers/vechain/vechain-provider.solo.test.ts b/packages/network/tests/provider/providers/vechain/vechain-provider.solo.test.ts deleted file mode 100644 index 1782748b7..000000000 --- a/packages/network/tests/provider/providers/vechain/vechain-provider.solo.test.ts +++ /dev/null @@ -1,399 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { ABIContract, Address, Clause, HexUInt } from '@vechain/sdk-core'; -import { JSONRPCMethodNotFound } from '@vechain/sdk-errors'; -import { - ProviderInternalBaseWallet, - type SubscriptionEvent, - THOR_SOLO_URL, - ThorClient, - VeChainProvider, - type VeChainSigner -} from '../../../../src'; -import { providerMethodsTestCasesSolo, TEST_ACCOUNT } from '../fixture'; -import { - deployERC20Contract, - deployERC721Contract, - waitForMessage -} from '../helpers'; -import { fail } from 'assert'; - -/** - *VeChain provider tests - Solo Network - * - * @group integration/providers/vechain-provider-solo - */ -describe('VeChain provider tests - solo', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(THOR_SOLO_URL); - provider = new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([ - { - privateKey: HexUInt.of(TEST_ACCOUNT.privateKey).bytes, - address: TEST_ACCOUNT.address - } - ]) - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesSolo.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await provider.request({ - method, - params - }); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * eth_getBalance RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await provider.request({ - method: 'eth_blockNumber', - params: [] - }); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * eth_subscribe latest blocks RPC call test - */ - test('Should be able to get to subscribe to the latest blocks', async () => { - // Call RPC function - const subscriptionId = await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - }); - - const messageReceived = new Promise((resolve) => { - provider.on('message', (message) => { - resolve(message); - provider.destroy(); - }); - }); - - const message = (await messageReceived) as SubscriptionEvent; - - // Optionally, you can do assertions or other operations with the message - expect(message).toBeDefined(); - expect(message.method).toBe('eth_subscription'); - expect(message.params).toBeDefined(); - expect(message.params.subscription).toBe(subscriptionId); - expect(message.params.result).toBeDefined(); - }, 12000); - - /** - * eth_subscribe latest blocks and then unsubscribe RPC call test - */ - test('Should be able to get to subscribe to the latest blocks and then unsubscribe', async () => { - expect(provider.getPollInstance()).toBeUndefined(); - // Call RPC function - const subscriptionId = await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - }); - - expect(provider.getPollInstance()).toBeDefined(); - - expect(subscriptionId).toBeDefined(); - expect( - provider.subscriptionManager.newHeadsSubscription?.subscriptionId - ).toBe(subscriptionId); - - await provider.request({ - method: 'eth_unsubscribe', - params: [subscriptionId] - }); - - expect(provider.getPollInstance()).toBeUndefined(); - - expect( - provider.subscriptionManager.newHeadsSubscription?.subscriptionId - ).toBeUndefined(); - }); - - /** - * eth_getSubscribe invalid call - */ - test('Should not be able to subscribe since the subscription type is invalid', async () => { - // Call RPC function - await expect( - async () => - await provider.request({ - method: 'eth_subscribe', - params: ['invalid'] - }) - ).rejects.toThrowError('Invalid subscription type'); - }, 12000); - - /** - * Tests the ability to subscribe to and receive the latest log events from an ERC20 contract using the `eth_subscribe` RPC call. - * - * The test performs the following operations: - * 1. Deploys an ERC20 contract to simulate a real-world token contract scenario. - * 2. Sets up a log subscription for the deployed contract's address to listen for all emitted events (no specific topics). - * 3. Executes a `transfer` transaction on the ERC20 contract to simulate activity that would generate a log event. - * 4. Waits for a message from the subscription, indicating a log event was captured. - * 5. Validates the received message to ensure it contains the expected structure and data: - * - The message is defined and has the correct method. - * - The log event's address matches the ERC20 contract's address. - * - Topics and data within the log event are present and correctly formatted. - * - * @remarks - * - The `waitForMessage` function is assumed to be a utility that returns a Promise which resolves when a new message is received from the subscription. - * - The test uses `@ts-expect-error` annotations to bypass TypeScript's type checking for certain properties we expect to be present in the log event message. This is due to the generic nature of the `message` object, which doesn't have a predefined type that includes the expected fields. - * - An extended timeout of 30 seconds is set to accommodate potential delays in contract deployment, transaction execution, and event propagation. - * - * @throws {Error} If the received message doesn't match the expected format or if the log event details are incorrect, indicating an issue with the subscription or the event emission process. - */ - test('Should be able to get to subscribe to the latest logs of an erc20 contract', async () => { - const contract = await deployERC20Contract( - thorClient, - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner - ); - - const logsParams = { - address: [contract.address], - topics: [] - }; - - // Call RPC function to subscribe to logs - const rpcCall = await provider.request({ - method: 'eth_subscribe', - params: ['logs', logsParams] - }); - // Wait for the subscription to receive a message (log event) - const messageReceived = waitForMessage(provider); - - // Execute a contract transaction to generate a log event - await thorClient.contracts.executeTransaction( - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner, - contract.address, - ABIContract.ofAbi(contract.abi).getFunction('transfer'), - [TEST_ACCOUNT.address, 100] - ); - - const message = await messageReceived; - - // Clean up the subscription - provider.destroy(); - - // Assertions to validate the received message - expect(message).toBeDefined(); - expect(message.method).toBeDefined(); - expect(message.params).toBeDefined(); - - // @ts-expect-error - Asserting that the log event contains the expected contract address - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(message.params.result[0].address).toBe(contract.address); - - // @ts-expect-error - Asserting that the log event contains defined topics - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(message.params.result[0].topics).toBeDefined(); - - // @ts-expect-error - Asserting that the log event contains data - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(message.params.result[0].data).toBeDefined(); - - // Validate the RPC call was successful - expect(rpcCall).not.toBe('0x0'); - }, 30000); - - /** - * Tests the ability to subscribe to and receive log events for both ERC20 and ERC721 token contracts. - * - * This test performs the following operations: - * 1. Deploys an ERC20 and an ERC721 contract to simulate token transactions. - * 2. Sets up subscriptions to listen for log events from both contracts using the `eth_subscribe` method. - * 3. Executes transactions on both contracts: - * - For the ERC20 contract, it simulates a token transfer. - * - For the ERC721 contract, it simulates minting a new token. - * 4. Waits for and collects log events emitted by these transactions. - * 5. Asserts that the received log events match the expected results, including: - * - The presence and count of the log events. - * - Matching subscription IDs to verify the correct source of the events. - * - Non-empty log data to ensure event details are captured. - * - * Note: The test uses `@ts-expect-error` to assert the presence of `params.result` in log events, - * acknowledging potential TypeScript type safety concerns while expecting the data to be present. - * - * @remarks - * The test includes an extended timeout of 10 seconds to accommodate the asynchronous nature of - * blockchain transactions and event subscriptions. - * - * @throws {Error} If any of the assertions fail, indicating a problem with event subscription or log data capture. - */ - test('Should be able to subscribe to the latest logs of an erc20 and erc721 contract', async () => { - // Test setup: Deploy contracts and set up event subscriptions - const erc20Contract = await deployERC20Contract( - thorClient, - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner - ); - const erc721Contract = await deployERC721Contract( - thorClient, - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner - ); - - const erc20logsParams = { - address: [erc20Contract.address], - topics: [] - }; - - const erc721logsParams = { - address: [erc721Contract.address], - topics: [] - }; - - const erc20Subscription = await provider.request({ - method: 'eth_subscribe', - params: ['logs', erc20logsParams] - }); - - const erc721Subscription = await provider.request({ - method: 'eth_subscribe', - params: ['logs', erc721logsParams] - }); - - // Collect and assert log events - let results: SubscriptionEvent[] = []; - const eventPromise = new Promise((resolve) => { - provider.on('message', (message: SubscriptionEvent) => { - results.push(message); - if (results.length >= 2) { - provider.destroy(); - resolve(results); - } - }); - }); - - // Execute transactions that should emit events - await thorClient.contracts.executeTransaction( - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner, - erc20Contract.address, - ABIContract.ofAbi(erc20Contract.abi).getFunction('transfer'), - [TEST_ACCOUNT.address, 100] - ); - - const clauses = Clause.callFunction( - Address.of(erc721Contract.address), - ABIContract.ofAbi(erc721Contract.abi).getFunction('mintItem'), - [TEST_ACCOUNT.address] - ); - - const gas = await thorClient.gas.estimateGas([clauses]); - - await thorClient.contracts.executeTransaction( - (await provider.getSigner(TEST_ACCOUNT.address)) as VeChainSigner, - erc721Contract.address, - ABIContract.ofAbi(erc721Contract.abi).getFunction('mintItem'), - [TEST_ACCOUNT.address], - { gas: gas.totalGas } - ); - - results = (await eventPromise) as SubscriptionEvent[]; - - // Assertions to validate the received log events - expect(results).toBeDefined(); - expect(results.length).toBeGreaterThan(1); - expect( - results.filter((x) => x.params.subscription === erc20Subscription) - .length - ).toBeGreaterThan(0); - expect( - results.filter((x) => x.params.subscription === erc721Subscription) - .length - ).toBeGreaterThan(0); - - expect(results[0].method).toBe('eth_subscription'); - expect(results[1].method).toBe('eth_subscription'); - - // @ts-expect-error - Asserting that log data is present - expect(results[0].params.result.length).toBeGreaterThan(0); - - // @ts-expect-error - Asserting that log data is present - expect(results[1].params.result.length).toBeGreaterThan(0); - }, 30000); - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(provider).toBeDefined(); - - // Call RPC function - try { - await provider.request({ - method: 'INVALID_METHOD', - params: [-1] - }); - fail('Should throw an error'); - } catch (error) { - expect(error).toBeInstanceOf(JSONRPCMethodNotFound); - if (error instanceof JSONRPCMethodNotFound) { - expect(error.message).toBe( - `Method 'VeChainProvider.request()' failed.` + - `\n-Reason: 'Method not found. Invalid RPC method given as input.'` + - `\n-Parameters: \n\t{\n "code": -32601,\n "message": "Method not found. Invalid RPC method given as input.",\n "data": {\n "method": "INVALID_METHOD"\n }\n}` - ); - } - } - }); - - describe('resolveName(vnsName)', () => { - test('Should be able to resolve an address by name', async () => { - const name = 'test-sdk.vet'; - const address = await provider.resolveName(name); - expect(address).toBe('0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54'); - }); - - test('Should resolve to null for unknown names', async () => { - const name = 'unknown.test-sdk.vet'; - const address = await provider.resolveName(name); - expect(address).toBe(null); - }); - }); - - describe('lookupAddress(address)', () => { - test('Should be able to lookup a name for an address', async () => { - const address = '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54'; - const name = await provider.lookupAddress(address); - expect(name).toBe('test-sdk.vet'); - }); - - test('Should resolve to null for unknown names', async () => { - const address = '0x0000000000000000000000000000000000000001'; - const name = await provider.resolveName(address); - expect(name).toBe(null); - }); - }); -}); diff --git a/packages/network/tests/provider/providers/vechain/vechain-provider.testnet.test.ts b/packages/network/tests/provider/providers/vechain/vechain-provider.testnet.test.ts deleted file mode 100644 index 7684c8b18..000000000 --- a/packages/network/tests/provider/providers/vechain/vechain-provider.testnet.test.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; - -import { JSONRPCMethodNotFound } from '@vechain/sdk-errors'; -import { TESTNET_URL, ThorClient, VeChainProvider } from '../../../../src'; -import { providerMethodsTestCasesTestnet } from '../fixture'; -import { waitForMessage } from '../helpers'; - -/** - *VeChain provider tests - * - * @group integration/providers/vechain-provider - */ -describe('VeChain provider tests - testnet', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - provider = new VeChainProvider(thorClient); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Provider methods tests - */ - providerMethodsTestCasesTestnet.forEach( - ({ description, method, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await provider.request({ - method, - params - }); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * eth_blockNumber RPC call test - */ - test('Should be able to get the latest block number', async () => { - // Call RPC function - const rpcCall = await provider.request({ - method: 'eth_blockNumber', - params: [] - }); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }); - - /** - * eth_subscribe latest blocks RPC call test - */ - test('Should be able to get to subscribe to the latest blocks', async () => { - // Call RPC function - const rpcCall = await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - }); - - const messageReceived = waitForMessage(provider); - - const message = await messageReceived; - - // Optionally, you can do assertions or other operations with the message - expect(message).toBeDefined(); - expect(message.method).toBe('eth_subscription'); - expect(message.params.subscription).toBeDefined(); - - // Compare the result with the expected value - expect(rpcCall).not.toBe('0x0'); - }, 12000); - - /** - * eth_getBalance RPC call test - */ - - /** - * Invalid RPC method tests - */ - test('Should throw an error when calling an invalid RPC method', async () => { - // Check if the provider is defined - expect(provider).toBeDefined(); - - // Call RPC function - await expect( - async () => - await provider.request({ - method: 'INVALID_METHOD', - params: [-1] - }) - ).rejects.toThrowError(JSONRPCMethodNotFound); - }); - - /** - * Return null signer if wallet is not defined - */ - test('Should throw an error if delegation is enabled and delegator is not defined', async () => { - const nullSigner = await provider.getSigner( - '0x0000000000000000000000000000456e65726779' - ); - expect(nullSigner).toBeNull(); - }); -}); diff --git a/packages/network/tests/provider/providers/vechain/vechain-provider.unit.test.ts b/packages/network/tests/provider/providers/vechain/vechain-provider.unit.test.ts deleted file mode 100644 index 5161c43ab..000000000 --- a/packages/network/tests/provider/providers/vechain/vechain-provider.unit.test.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { - afterEach, - beforeEach, - describe, - expect, - jest, - test -} from '@jest/globals'; - -import { - TESTNET_URL, - ThorClient, - VeChainProvider, - vnsUtils -} from '../../../../src'; - -/** - *VeChain provider tests - * - * @group integration/providers/vechain-provider - */ -describe('VeChain provider tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - provider = new VeChainProvider(thorClient); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - describe('resolveName(vnsName)', () => { - test('Should use vnsUtils.resolveNames() to resolve an address by name', async () => { - jest.spyOn(vnsUtils, 'resolveName'); - const name = 'test-sdk.vet'; - await provider.resolveName(name); - expect(vnsUtils.resolveName).toHaveBeenCalledWith( - provider.thorClient, - name - ); - }); - - test('Should return null if there were invalid result', async () => { - const name = 'error.vet'; - jest.spyOn(vnsUtils, 'resolveNames').mockImplementation( - async () => { - return await Promise.resolve([]); - } - ); - const address = await provider.resolveName(name); - expect(address).toEqual(null); - }); - - test('Should pass address provided by resolveNames()', async () => { - const name = 'address1.vet'; - jest.spyOn(vnsUtils, 'resolveName').mockImplementation(async () => { - return await Promise.resolve( - '0x0000000000000000000000000000000000000001' - ); - }); - const address = await provider.resolveName(name); - expect(address).toEqual( - '0x0000000000000000000000000000000000000001' - ); - }); - }); - - describe('lookupAddress(address)', () => { - test('Should use vnsUtils.lookupAddress() to resolve an address by name', async () => { - jest.spyOn(vnsUtils, 'lookupAddress'); - const address = '0x105199a26b10e55300CB71B46c5B5e867b7dF427'; - await provider.lookupAddress(address); - expect(vnsUtils.lookupAddress).toHaveBeenCalledWith( - provider.thorClient, - address - ); - }); - - test('Should return null if there were invalid results', async () => { - const address = '0x0000000000000000000000000000000000000001'; - jest.spyOn(vnsUtils, 'lookupAddresses').mockImplementation( - async () => { - return await Promise.resolve([]); - } - ); - const name = await provider.lookupAddress(address); - expect(name).toEqual(null); - }); - - test('Should pass name provided by vnsUtils.resolveName()', async () => { - const address = '0x0000000000000000000000000000000000000001'; - jest.spyOn(vnsUtils, 'resolveName').mockImplementation(async () => { - return await Promise.resolve('test.vet'); - }); - const name = await provider.resolveName(address); - expect(name).toEqual('test.vet'); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getBadBlocks/debug_getBadBlocks.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getBadBlocks/debug_getBadBlocks.testnet.test.ts deleted file mode 100644 index fd9d3cffb..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_getBadBlocks/debug_getBadBlocks.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'debug_getBadBlocks' method - * - * @group integration/rpc-mapper/methods/debug_getBadBlocks - */ -describe('RPC Mapper - debug_getBadBlocks method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_getBadBlocks RPC call tests - Positive cases - */ - describe('debug_getBadBlocks - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('debug_getBadBlocks - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.debug_getBadBlocks]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getBadBlocks/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getBadBlocks/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawBlock/debug_getRawBlock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getRawBlock/debug_getRawBlock.testnet.test.ts deleted file mode 100644 index dd7adfdff..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawBlock/debug_getRawBlock.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'debug_getRawBlock' method - * - * @group integration/rpc-mapper/methods/debug_getRawBlock - */ -describe('RPC Mapper - debug_getRawBlock method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_getRawBlock RPC call tests - Positive cases - */ - describe('debug_getRawBlock - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('debug_getRawBlock - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.debug_getRawBlock]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawBlock/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getRawBlock/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawHeader/debug_getRawHeader.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getRawHeader/debug_getRawHeader.testnet.test.ts deleted file mode 100644 index 5f0535534..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawHeader/debug_getRawHeader.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'debug_getRawHeader' method - * - * @group integration/rpc-mapper/methods/debug_getRawHeader - */ -describe('RPC Mapper - debug_getRawHeader method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_getRawHeader RPC call tests - Positive cases - */ - describe('debug_getRawHeader - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('debug_getRawHeader - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.debug_getRawHeader]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawHeader/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getRawHeader/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawReceipts/debug_getRawReceipts.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getRawReceipts/debug_getRawReceipts.testnet.test.ts deleted file mode 100644 index eb634c2b1..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawReceipts/debug_getRawReceipts.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'debug_getRawReceipts' method - * - * @group integration/rpc-mapper/methods/debug_getRawReceipts - */ -describe('RPC Mapper - debug_getRawReceipts method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_getRawReceipts RPC call tests - Positive cases - */ - describe('debug_getRawReceipts - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('debug_getBadBlocks - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.debug_getRawReceipts]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawReceipts/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getRawReceipts/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawTransaction/debug_getRawTransaction.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getRawTransaction/debug_getRawTransaction.testnet.test.ts deleted file mode 100644 index e8e92c3ff..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawTransaction/debug_getRawTransaction.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'debug_getRawTransaction' method - * - * @group integration/rpc-mapper/methods/debug_getRawTransaction - */ -describe('RPC Mapper - debug_getRawTransaction method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_getRawTransaction RPC call tests - Positive cases - */ - describe('debug_getRawTransaction - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('debug_getRawTransaction - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_getRawTransaction - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_getRawTransaction/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_getRawTransaction/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.mock.testnet.test.ts deleted file mode 100644 index 31ed91f25..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.mock.testnet.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'debug_traceBlockByHash' method - * - * @group integration/rpc-mapper/methods/debug_traceBlockByHash-mock - */ -describe('RPC Mapper - debug_traceBlockByHash method mock tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_traceTransaction RPC call tests - Negative cases - */ - describe('debug_traceTransaction - Negative cases', () => { - /** - * Should return [] if blockHash does not exist - */ - test('Should return [] if blockHash does not exist', async () => { - // Mock the getBlockCompressed method to return null - jest.spyOn( - thorClient.blocks, - 'getBlockCompressed' - ).mockResolvedValue(null); - - // Get traces - const traces = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByHash - ]([ - '0x010e80e4c2b06efb61a86f33155d7a1e3f3bd2ae7b676e7d62270079bd1fe329', - { - tracer: 'presStateTracer', - tracerConfig: { onlyTopCall: true } - } - ]); - - expect(traces).toEqual([]); - }); - - /** - * Should throw `JSONRPCInternalError` if an error occurs while tracing the block - */ - test('Should throw `JSONRPCInternalError` if an error occurs while tracing the block', async () => { - // Mock the getBlockCompressed method to return null - jest.spyOn( - thorClient.blocks, - 'getBlockCompressed' - ).mockRejectedValue(new Error()); - - // Get traces - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByHash - ]([ - '0x010e80e4c2b06efb61a86f33155d7a1e3f3bd2ae7b676e7d62270079bd1fe329', - { - tracer: 'presStateTracer', - tracerConfig: { onlyTopCall: true } - } - ]); - }).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.testnet.test.ts deleted file mode 100644 index 4e94c3bbb..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/debug_traceBlockByHash.testnet.test.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { debugTraceBlockByHashFixture } from './fixture'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'debug_traceBlockByHash' method - * - * @group integration/rpc-mapper/methods/debug_traceBlockByHash - */ -describe('RPC Mapper - debug_traceBlockByHash method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_traceBlockByHash RPC call tests - Positive cases - */ - describe('debug_traceBlockByHash - Positive cases', () => { - /** - * Should return traces for the block. - */ - test('Should return traces for the block', async () => { - for (const debugTraceBlockByHashFixtureElement of debugTraceBlockByHashFixture) { - // Get traces - const traces = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByHash - ](debugTraceBlockByHashFixtureElement.input.params); - - // Compare - expect(traces).toEqual( - debugTraceBlockByHashFixtureElement.expected - ); - } - }, 30000); - }); - - /** - * debug_traceTransaction RPC call tests - Negative cases - */ - describe('debug_traceTransaction - Negative cases', () => { - /** - * Should throw an error if the input params are invalid. - */ - test('Should throw an error if the input params are invalid', async () => { - // No params - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByHash - ]([]); - }).rejects.toThrowError(JSONRPCInvalidParams); - - // Invalid block hash - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByHash - ]([ - 'INVALID_BLOCK_HASH', - { - tracer: 'presStateTracer', - tracerConfig: { onlyTopCall: true } - } - ]); - }).rejects.toThrowError(JSONRPCInvalidParams); - - // No options - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByHash - ]([ - '0x010e80e4c2b06efb61a86f33155d7a1e3f3bd2ae7b676e7d62270079bd1fe329' - ]); - }).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/fixture.ts deleted file mode 100644 index 69f74d1d3..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByHash/fixture.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * debug_traceBlockByHash fixture - */ -const debugTraceBlockByHashFixture = [ - // Call tracer - { - input: { - params: [ - '0x010e80e4c2b06efb61a86f33155d7a1e3f3bd2ae7b676e7d62270079bd1fe329', - { - tracer: 'callTracer', - tracerConfig: { onlyTopCall: true } - } - ] - }, - expected: [ - { - txHash: '0x7e7d7ec1510425fd6f68e3dd2369e57af44114fb95b5a26fade14621821c74f3', - result: { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x135e', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0xd547741f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - value: '0x0', - type: 'CALL', - revertReason: '' - } - }, - { - txHash: '0x5f1eb314b18a906e26f68a6b8a79fcea47edc65d1c30bccccdb5ff3f92f4acee', - result: { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x22e2', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0x2f2ff15d3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - value: '0x0', - type: 'CALL', - revertReason: '' - } - } - ] - } -]; - -export { debugTraceBlockByHashFixture }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.mock.testnet.test.ts deleted file mode 100644 index a8af7d964..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.mock.testnet.test.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { HexInt } from '@vechain/sdk-core'; - -/** - * RPC Mapper integration tests for 'debug_traceBlockByNumber' method - * - * @group integration/rpc-mapper/methods/debug_traceBlockByNumber-mock - */ -describe('RPC Mapper - debug_traceBlockByNumber method mock tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_traceTransaction RPC call tests - Negative cases - */ - describe('debug_traceBlockByNumber - Negative cases', () => { - /** - * Should return [] if blockHash does not exist - */ - test('Should return [] if blockHash does not exist', async () => { - // Mock the getBlockCompressed method to return null - jest.spyOn( - thorClient.blocks, - 'getBlockCompressed' - ).mockResolvedValue(null); - - // Get traces - const traces = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByNumber - ]([ - HexInt.of(17727716).toString(), - { - tracer: 'presStateTracer', - tracerConfig: { onlyTopCall: true } - } - ]); - - expect(traces).toEqual([]); - }); - - /** - * Should throw `JSONRPCInternalError` if an error occurs while tracing the block - */ - test('Should throw `JSONRPCInternalError` if an error occurs while tracing the block', async () => { - // Mock the getBlockCompressed method to return null - jest.spyOn( - thorClient.blocks, - 'getBlockCompressed' - ).mockRejectedValue(new Error()); - - // Get traces - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByNumber - ]([ - HexInt.of(17727716).toString(), - { - tracer: 'presStateTracer', - tracerConfig: { onlyTopCall: true } - } - ]); - }).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.testnet.test.ts deleted file mode 100644 index 027d626d6..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/debug_traceBlockByNumber.testnet.test.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { debugTraceBlockByNumberFixture } from './fixture'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; -import { HexInt } from '@vechain/sdk-core'; - -/** - * RPC Mapper integration tests for 'debug_traceBlockByNumber' method - * - * @group integration/rpc-mapper/methods/debug_traceBlockByNumber - */ -describe('RPC Mapper - debug_traceBlockByNumber method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_traceBlockByNumber RPC call tests - Positive cases - */ - describe('debug_traceBlockByNumber - Positive cases', () => { - /** - * Should return traces for the block. - */ - test('Should return traces for the block', async () => { - for (const debugTraceBlockByNumberFixtureElement of debugTraceBlockByNumberFixture) { - // Get traces - const traces = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByNumber - ](debugTraceBlockByNumberFixtureElement.input.params); - - console.log('traces', traces); - - // Compare - expect(traces).toEqual( - debugTraceBlockByNumberFixtureElement.expected - ); - } - }, 30000); - }); - - /** - * debug_traceTransaction RPC call tests - Negative cases - */ - describe('debug_traceTransaction - Negative cases', () => { - /** - * Should throw an error if the input params are invalid. - */ - test('Should throw an error if the input params are invalid', async () => { - // No params - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByNumber - ]([]); - }).rejects.toThrowError(JSONRPCInvalidParams); - - // Invalid block hash - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByNumber - ]([ - 'INVALID_BLOCK_NUMBER', - { - tracer: 'presStateTracer', - tracerConfig: { onlyTopCall: true } - } - ]); - }).rejects.toThrowError(JSONRPCInternalError); - - // No options - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceBlockByNumber - ]([HexInt.of(17727716).toString()]); - }).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/fixture.ts deleted file mode 100644 index 2eb5f178b..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceBlockByNumber/fixture.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { HexInt } from '@vechain/sdk-core'; - -/** - * debug_traceBlockByNumber fixture - */ -const debugTraceBlockByNumberFixture = [ - // Call tracer - { - input: { - params: [ - HexInt.of(17727716).toString(), - { - tracer: 'callTracer', - tracerConfig: { onlyTopCall: true } - } - ] - }, - expected: [ - { - txHash: '0x7e7d7ec1510425fd6f68e3dd2369e57af44114fb95b5a26fade14621821c74f3', - result: { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x135e', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0xd547741f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - value: '0x0', - type: 'CALL', - revertReason: '' - } - }, - { - txHash: '0x5f1eb314b18a906e26f68a6b8a79fcea47edc65d1c30bccccdb5ff3f92f4acee', - result: { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x22e2', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0x2f2ff15d3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - value: '0x0', - type: 'CALL', - revertReason: '' - } - } - ] - } -]; - -export { debugTraceBlockByNumberFixture }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/debug_traceCall.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/debug_traceCall.solo.test.ts deleted file mode 100644 index 085d3e744..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/debug_traceCall.solo.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; -import { - sendTransactionWithAccountIndex, - traceContractCallTestnetFixture -} from '../../../../thor-client/debug/fixture-thorest'; -import { transfer1VTHOClause } from '../../../../thor-client/transactions/fixture'; - -/** - * RPC Mapper integration tests for 'debug_traceCall' method on solo - * Since prestateTracer is not available on testnet, we only test the solo network. - * - * @group integration/rpc-mapper/methods/debug_traceCall-solo - */ -describe('RPC Mapper - debug_traceCall method tests on solo', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * debug_traceCall RPC call tests - Positive cases - */ - describe('debug_traceCall - Positive cases', () => { - /** - * Should be able to trace a call with prestateTracer - */ - test('debug_traceCall - Should be able to trace a call with prestateTracer', async () => { - const txReceipt = await sendTransactionWithAccountIndex( - 19, - thorClient - ); - - const result = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceCall - ]([ - { - from: txReceipt?.meta.txOrigin, - // VTHO contract address - to: traceContractCallTestnetFixture.positiveCases[0].to, - value: '0x0', - // Transfer 1 VTHO clause - data: transfer1VTHOClause.data, - gas: '0x0' - }, - 'latest', - { - tracer: 'prestateTracer', - tracerConfig: { - onlyTopCall: true - } - } - ]); - expect(result).toBeDefined(); - }, 30000); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/debug_traceCall.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/debug_traceCall.testnet.test.ts deleted file mode 100644 index 0693e7c11..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/debug_traceCall.testnet.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - debugTraceCallNegativeCasesFixtureTestnet, - debugTraceCallPositiveCasesFixtureTestnet -} from './fixture'; - -/** - * RPC Mapper integration tests for 'debug_traceCall' method on testnet - * - * @group integration/rpc-mapper/methods/debug_traceCall-testnet - */ -describe('RPC Mapper - debug_traceCall method tests testnet', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_traceCall RPC call tests - Positive cases - */ - describe('debug_traceCall - Positive cases', () => { - /** - * Positive cases - */ - test('debug_traceCall - positive cases', async () => { - for (const fixture of debugTraceCallPositiveCasesFixtureTestnet) { - const result = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceCall - ](fixture.input.params); - expect(result).toEqual(fixture.input.expected); - } - }); - - /** - * Should be able to trace a call with callTracer - */ - test('debug_traceCall - Should be able to trace a call with callTracer', async () => { - const fixtureTransaction = - debugTraceCallPositiveCasesFixtureTestnet[0]; - - const result = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceCall - ]([ - fixtureTransaction.input.params[0], - fixtureTransaction.input.params[1], - { tracer: 'callTracer' } - ]); - expect(result).toBeDefined(); - }); - }); - - /** - * debug_traceCall RPC call tests - Negative cases - */ - describe('debug_traceCall - Negative cases', () => { - /** - * Negative cases - */ - test('debug_traceCall - negative cases', async () => { - for (const fixture of debugTraceCallNegativeCasesFixtureTestnet) { - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceCall - ](fixture.input.params); - }).rejects.toThrowError(fixture.input.expectedError); - } - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/fixture.ts deleted file mode 100644 index ddf80a49f..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceCall/fixture.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * debug_traceCall positive cases fixture - */ -const debugTraceCallPositiveCasesFixtureTestnet = [ - // Transfer token - Transaction 0x7bf1cbf0485e265075a771ac4b0875b09019163f93d8e281adb893875c36453f - { - input: { - params: [ - { - from: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - to: '0x0000000000000000000000000000456E65726779', - value: '0x0', - data: '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000', - gas: '0x0' - }, - 'latest', - { - tracer: 'callTracer', - tracerConfig: { - onlyTopCall: true - } - } - ], - expected: { - from: '0x625fce8dd8e2c05e82e77847f3da06af6e55a7af', - gas: '0x0', - gasUsed: '0x0', - to: '0x0000000000000000000000000000456e65726779', - input: '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000', - output: '0x0000000000000000000000000000000000000000000000000000000000000001', - value: '0x0', - type: 'CALL', - revertReason: '' - } - } - }, - - // Contract deployment transaction - callTracer - { - input: { - params: [ - { - from: '0x0000000000000000000000000000000000000000', - to: null, - data: '0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce5671461025957806370a082311461028a57806395d89b41146102e1578063a9059cbb14610371578063bb35783b146103d6578063d89135cd1461045b578063dd62ed3e14610486575b600080fd5b3480156100c057600080fd5b506100c96104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053a565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be61062b565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610865565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b506102f661094d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037d57600080fd5b506103bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098a565b604051808215151515815260200191505060405180910390f35b3480156103e257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b50610470610b67565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0d565b6040518082815260200191505060405180910390f35b60606040805190810160405280600681526020017f566554686f720000000000000000000000000000000000000000000000000000815250905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1663592b389c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b8101908080519060200190929190505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6275696c74696e3a20696e73756666696369656e7420616c6c6f77616e63650081525060200191505060405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061085a848484610c93565b600190509392505050565b60006012905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663ee660480836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b81019080805190602001909291905050509050919050565b60606040805190810160405280600481526020017f5654484f00000000000000000000000000000000000000000000000000000000815250905090565b6000610997338484610c93565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610add57503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663059950e9866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b1515610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6275696c74696e3a2073656c66206f72206d617374657220726571756972656481525060200191505060405180910390fd5b610b5c848484610c93565b600190509392505050565b60003073ffffffffffffffffffffffffffffffffffffffff1663138d4d0c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b8101908080519060200190929190505050905090565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000811115610eaa573073ffffffffffffffffffffffffffffffffffffffff166339ed08d584836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050506040513d6020811015610d6957600080fd5b81019080805190602001909291905050501515610dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6275696c74696e3a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631cedfac183836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820bd55cb9aff347dc60fe8280ae6b08a6f6deacc85a4e1c89ba0a8ef31fbcaecc60029' - }, - 'latest', - { - tracer: 'callTracer', - tracerConfig: { - onlyTopCall: true - } - } - ], - expected: { - from: '0x0000000000000000000000000000000000000000', - gas: '0x0', - gasUsed: '0x0', - input: '0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce5671461025957806370a082311461028a57806395d89b41146102e1578063a9059cbb14610371578063bb35783b146103d6578063d89135cd1461045b578063dd62ed3e14610486575b600080fd5b3480156100c057600080fd5b506100c96104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053a565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be61062b565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610865565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b506102f661094d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037d57600080fd5b506103bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098a565b604051808215151515815260200191505060405180910390f35b3480156103e257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b50610470610b67565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0d565b6040518082815260200191505060405180910390f35b60606040805190810160405280600681526020017f566554686f720000000000000000000000000000000000000000000000000000815250905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1663592b389c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b8101908080519060200190929190505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6275696c74696e3a20696e73756666696369656e7420616c6c6f77616e63650081525060200191505060405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061085a848484610c93565b600190509392505050565b60006012905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663ee660480836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b81019080805190602001909291905050509050919050565b60606040805190810160405280600481526020017f5654484f00000000000000000000000000000000000000000000000000000000815250905090565b6000610997338484610c93565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610add57503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663059950e9866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b1515610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6275696c74696e3a2073656c66206f72206d617374657220726571756972656481525060200191505060405180910390fd5b610b5c848484610c93565b600190509392505050565b60003073ffffffffffffffffffffffffffffffffffffffff1663138d4d0c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b8101908080519060200190929190505050905090565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000811115610eaa573073ffffffffffffffffffffffffffffffffffffffff166339ed08d584836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050506040513d6020811015610d6957600080fd5b81019080805190602001909291905050501515610dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6275696c74696e3a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631cedfac183836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820bd55cb9aff347dc60fe8280ae6b08a6f6deacc85a4e1c89ba0a8ef31fbcaecc60029', - error: 'execution reverted', - value: '0x0', - type: 'CREATE', - revertReason: '' - } - } - } -]; - -/** - * debug_traceCall negative cases fixture - */ -const debugTraceCallNegativeCasesFixtureTestnet = [ - // Invalid to - { - input: { - params: [ - { - from: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - to: 'INVALID', - value: '0x0', - data: '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000' - }, - 'latest', - { - tracer: 'callTracer', - tracerConfig: { - onlyTopCall: true - } - } - ], - expectedError: JSONRPCInternalError - } - }, - // Invalid data - { - input: { - params: [ - { - from: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - to: '0x0000000000000000000000000000456E65726779', - value: '0x0', - data: 'INVALID' - }, - 'latest', - { - tracer: 'callTracer', - tracerConfig: { - onlyTopCall: true - } - } - ], - expectedError: JSONRPCInternalError - } - }, - // Invalid input - { - input: { - params: ['INVALID'], - expectedError: JSONRPCInvalidParams - } - } -]; - -export { - debugTraceCallPositiveCasesFixtureTestnet, - debugTraceCallNegativeCasesFixtureTestnet -}; diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.solo.test.ts deleted file mode 100644 index 554e5d1ee..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.solo.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { beforeEach, describe, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; -import { sendTransactionWithAccountIndex } from '../../../../thor-client/debug/fixture-thorest'; - -/** - * RPC Mapper integration tests for 'debug_traceTransaction' method. - * Since prestateTracer is not available on testnet, we only test the solo network. - * - * @group integration/rpc-mapper/methods/debug_traceTransaction-solo - */ -describe('RPC Mapper - debug_traceTransaction method tests - solo', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * debug_traceTransaction RPC call tests - Positive cases - */ - describe('debug_traceTransaction - Positive cases', () => { - /** - * Positive cases - presetTracer - */ - test('debug_traceTransaction - prestate tracer', async () => { - const txReceipt = await sendTransactionWithAccountIndex( - 18, - thorClient - ); - - const result = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceTransaction - ]([ - txReceipt?.meta.txID, - { - tracer: 'prestateTracer', - timeout: '10s', - tracerConfig: { onlyTopCall: true } - } - ]); - expect(result).toBeDefined(); - }, 30000); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.testnet.test.ts deleted file mode 100644 index c1522b94f..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/debug_traceTransaction.testnet.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - debugTraceTransactionNegativeCasesFixtureTestnet, - debugTraceTransactionPositiveCasesFixtureTestnet -} from './fixture'; - -/** - * RPC Mapper integration tests for 'debug_traceTransaction' method - * - * @group integration/rpc-mapper/methods/debug_traceTransaction-testnet - */ -describe('RPC Mapper - debug_traceTransaction method tests testnet', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * debug_traceTransaction RPC call tests - Positive cases - */ - describe('debug_traceTransaction - Positive cases', () => { - /** - * Positive cases. - */ - test('debug_traceTransaction - positive cases', async () => { - for (const fixture of debugTraceTransactionPositiveCasesFixtureTestnet) { - const result = await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceTransaction - ](fixture.input.params); - expect(result).toEqual(fixture.input.expected); - } - }, 30000); - }); - - /** - * debug_traceTransaction RPC call tests - Negative cases - */ - describe('debug_traceTransaction - Negative cases', () => { - /** - * Negative cases. - */ - test('debug_traceTransaction - negative case', async () => { - for (const fixture of debugTraceTransactionNegativeCasesFixtureTestnet) { - await expect(async () => { - await RPCMethodsMap(thorClient)[ - RPC_METHODS.debug_traceTransaction - ](fixture.input.params); - }).rejects.toThrowError(fixture.input.expectedError); - } - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/fixture.ts deleted file mode 100644 index 026608893..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/debug_traceTransaction/fixture.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - InvalidDataType, - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * debug_traceTransaction positive cases fixture - Testnet - */ -const debugTraceTransactionPositiveCasesFixtureTestnet = [ - // Transaction 1 - callTracer - 0x2dbc8268a2dbf889abe828c0671cb9adce61f537aab8855480aff6967e0ed687 - { - input: { - params: [ - '0x2dbc8268a2dbf889abe828c0671cb9adce61f537aab8855480aff6967e0ed687', - { - tracer: 'callTracer', - timeout: '10s', - tracerConfig: { onlyTopCall: true } - } - ], - expected: { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x11c5', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0x02fe53050000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000f6e657742617365546f6b656e5552490000000000000000000000000000000000', - value: '0x0', - type: 'CALL', - revertReason: '' - } - } - }, - - // Transaction 2 - callTracer - 0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f - { - input: { - params: [ - '0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f', - { - tracer: 'callTracer', - timeout: '10s', - tracerConfig: { onlyTopCall: true } - } - ], - expected: { - from: '0x105199a26b10e55300cb71b46c5b5e867b7df427', - gas: '0x8b92', - gasUsed: '0x50fa', - to: '0xaa854565401724f7061e0c366ca132c87c1e5f60', - input: '0xf14fcbc800d770b9faa11ba944366f3e7a14c166f780ece542e557e0b7fe4870fcbe8dbe', - revertReason: '', - value: '0x0', - type: 'CALL' - } - } - } -]; - -/** - * debug_traceTransaction positive cases fixture. - */ -const debugTraceTransactionNegativeCasesFixtureTestnet = [ - // Transaction 1 Invalid transaction ID - { - input: { - params: [ - 'INVALID_TRANSACTION_ID', - { - tracer: 'callTracer', - timeout: '10s', - tracerConfig: { onlyTopCall: true } - } - ], - expectedError: InvalidDataType - } - }, - // Transaction not exists - { - input: { - params: [ - '0x000000000000000000000004e600000000000000000000000000000000000000', - { - tracer: 'callTracer', - timeout: '10s', - tracerConfig: { onlyTopCall: true } - } - ], - expectedError: JSONRPCInternalError - } - }, - // Invalid input - { - input: { - params: ['INVALID'], - expectedError: JSONRPCInvalidParams - } - } -]; - -export { - debugTraceTransactionPositiveCasesFixtureTestnet, - debugTraceTransactionNegativeCasesFixtureTestnet -}; diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeCapabilities/engine_exchangeCapabilities.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeCapabilities/engine_exchangeCapabilities.testnet.test.ts deleted file mode 100644 index b56e0839b..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeCapabilities/engine_exchangeCapabilities.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_exchangeCapabilities' method - * - * @group integration/rpc-mapper/methods/engine_exchangeCapabilities - */ -describe('RPC Mapper - engine_exchangeCapabilities method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_exchangeCapabilities RPC call tests - Positive cases - */ - describe('engine_exchangeCapabilities - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_exchangeCapabilities - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.engine_exchangeCapabilities - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeCapabilities/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeCapabilities/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/engine_exchangeTransitionConfigurationV1.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/engine_exchangeTransitionConfigurationV1.testnet.test.ts deleted file mode 100644 index 2b8bad905..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/engine_exchangeTransitionConfigurationV1.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_exchangeTransitionConfigurationV1' method - * - * @group integration/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1 - */ -describe('RPC Mapper - engine_exchangeTransitionConfigurationV1 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_exchangeTransitionConfigurationV1 RPC call tests - Positive cases - */ - describe('engine_exchangeTransitionConfigurationV1 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_exchangeTransitionConfigurationV1 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.engine_exchangeTransitionConfigurationV1 - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_exchangeTransitionConfigurationV1/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV1/engine_forkchoiceUpdatedV1.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV1/engine_forkchoiceUpdatedV1.testnet.test.ts deleted file mode 100644 index 2321087b6..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV1/engine_forkchoiceUpdatedV1.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_forkchoiceUpdatedV1' method - * - * @group integration/rpc-mapper/methods/engine_forkchoiceUpdatedV1 - */ -describe('RPC Mapper - engine_forkchoiceUpdatedV1 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_forkchoiceUpdatedV1 RPC call tests - Positive cases - */ - describe('engine_forkchoiceUpdatedV1 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_forkchoiceUpdatedV1 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.engine_forkchoiceUpdatedV1 - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV1/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV1/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV2/engine_forkchoiceUpdatedV2.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV2/engine_forkchoiceUpdatedV2.testnet.test.ts deleted file mode 100644 index a399d0cee..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV2/engine_forkchoiceUpdatedV2.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_forkchoiceUpdatedV2' method - * - * @group integration/rpc-mapper/methods/engine_forkchoiceUpdatedV2 - */ -describe('RPC Mapper - engine_forkchoiceUpdatedV2 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_forkchoiceUpdatedV2 RPC call tests - Positive cases - */ - describe('engine_forkchoiceUpdatedV2 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_forkchoiceUpdatedV2 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.engine_forkchoiceUpdatedV2 - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV2/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV2/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV3/engine_forkchoiceUpdatedV3.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV3/engine_forkchoiceUpdatedV3.testnet.test.ts deleted file mode 100644 index f4ecdd4ac..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV3/engine_forkchoiceUpdatedV3.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_forkchoiceUpdatedV3' method - * - * @group integration/rpc-mapper/methods/engine_forkchoiceUpdatedV3 - */ -describe('RPC Mapper - engine_forkchoiceUpdatedV3 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_forkchoiceUpdatedV3 RPC call tests - Positive cases - */ - describe('engine_forkchoiceUpdatedV3 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_forkchoiceUpdatedV3 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.engine_forkchoiceUpdatedV3 - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV3/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_forkchoiceUpdatedV3/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/engine_getPayloadBodiesByHashV1.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/engine_getPayloadBodiesByHashV1.testnet.test.ts deleted file mode 100644 index c9ec44b54..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/engine_getPayloadBodiesByHashV1.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_getPayloadBodiesByHashV1' method - * - * @group integration/rpc-mapper/methods/engine_getPayloadBodiesByHashV1 - */ -describe('RPC Mapper - engine_getPayloadBodiesByHashV1 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_getPayloadBodiesByHashV1 RPC call tests - Positive cases - */ - describe('engine_getPayloadBodiesByHashV1 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_getPayloadBodiesByHashV1 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.engine_getPayloadBodiesByHashV1 - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByHashV1/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/engine_getPayloadBodiesByRangeV1.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/engine_getPayloadBodiesByRangeV1.testnet.test.ts deleted file mode 100644 index b14290b03..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/engine_getPayloadBodiesByRangeV1.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_getPayloadBodiesByRangeV1' method - * - * @group integration/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1 - */ -describe('RPC Mapper - engine_getPayloadBodiesByRangeV1 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_getPayloadBodiesByRangeV1 RPC call tests - Positive cases - */ - describe('engine_getPayloadBodiesByRangeV1 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_getPayloadBodiesByRangeV1 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.engine_getPayloadBodiesByRangeV1 - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadBodiesByRangeV1/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV1/engine_getPayloadV1.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV1/engine_getPayloadV1.testnet.test.ts deleted file mode 100644 index d9f2b3807..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV1/engine_getPayloadV1.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_getPayloadV1' method - * - * @group integration/rpc-mapper/methods/engine_getPayloadV1 - */ -describe('RPC Mapper - engine_getPayloadV1 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_getPayloadV1 RPC call tests - Positive cases - */ - describe('engine_getPayloadV1 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_getPayloadV1 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.engine_getPayloadV1]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV1/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV1/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV2/engine_getPayloadV2.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV2/engine_getPayloadV2.testnet.test.ts deleted file mode 100644 index 3f96f7018..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV2/engine_getPayloadV2.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_getPayloadV2' method - * - * @group integration/rpc-mapper/methods/engine_getPayloadV2 - */ -describe('RPC Mapper - engine_getPayloadV2 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_getPayloadV1 RPC call tests - Positive cases - */ - describe('engine_getPayloadV2 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_getPayloadV2 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.engine_getPayloadV2]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV2/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV2/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV3/engine_getPayloadV3.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV3/engine_getPayloadV3.testnet.test.ts deleted file mode 100644 index caf088703..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV3/engine_getPayloadV3.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_getPayloadV1' method - * - * @group integration/rpc-mapper/methods/engine_getPayloadV1 - */ -describe('RPC Mapper - engine_getPayloadV1 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eengine_getPayloadV1 RPC call tests - Positive cases - */ - describe('engine_getPayloadV1 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_getPayloadV1 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.engine_getPayloadV3]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV3/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_getPayloadV3/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV1/engine_newPayloadV1.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV1/engine_newPayloadV1.testnet.test.ts deleted file mode 100644 index 5d359b72f..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV1/engine_newPayloadV1.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_newPayloadV1' method - * - * @group integration/rpc-mapper/methods/engine_newPayloadV1 - */ -describe('RPC Mapper - engine_newPayloadV1 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_newPayloadV1 RPC call tests - Positive cases - */ - describe('engine_newPayloadV1 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_newPayloadV1 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.engine_newPayloadV1]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV1/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV1/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV2/engine_newPayloadV2.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV2/engine_newPayloadV2.testnet.test.ts deleted file mode 100644 index 0f0b05e61..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV2/engine_newPayloadV2.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_newPayloadV2' method - * - * @group integration/rpc-mapper/methods/engine_newPayloadV2 - */ -describe('RPC Mapper - engine_newPayloadV2 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_newPayloadV2 RPC call tests - Positive cases - */ - describe('engine_newPayloadV2 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_newPayloadV2 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.engine_newPayloadV2]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV2/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV2/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV3/engine_newPayloadV3.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV3/engine_newPayloadV3.testnet.test.ts deleted file mode 100644 index 95d1fb40c..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV3/engine_newPayloadV3.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'engine_newPayloadV3' method - * - * @group integration/rpc-mapper/methods/engine_newPayloadV3 - */ -describe('RPC Mapper - engine_newPayloadV3 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * engine_newPayloadV3 RPC call tests - Positive cases - */ - describe('engine_newPayloadV3 - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('engine_newPayloadV3 - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.engine_newPayloadV3]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV3/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/engine_newPayloadV3/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_accounts/eth_accounts.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_accounts/eth_accounts.solo.test.ts deleted file mode 100644 index d0b6434f7..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_accounts/eth_accounts.solo.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - type ProviderInternalWallet, - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient, - VeChainProvider -} from '../../../../../src'; -import { THOR_SOLO_ACCOUNTS_BASE_WALLET } from '../../../../fixture'; - -/** - * RPC Mapper integration tests for 'eth_accounts' method - * - * @group integration/rpc-mapper/methods/eth_accounts - */ -describe('RPC Mapper - eth_accounts method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Provider instance - */ - let provider: VeChainProvider; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - - // Init provider - provider = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET as ProviderInternalWallet - ); - }); - - /** - * eth_accounts RPC call tests - Positive cases - */ - describe('eth_accounts - Positive cases', () => { - /** - * Positive case 1 - Should be able to get addresses from a NON-empty wallet - */ - test('eth_accounts - Should be able to get addresses from a NON-empty wallet', async () => { - // Get accounts - Instead of using RPCMethodsMap, we can use provider directly - const accounts = (await provider.request({ - method: RPC_METHODS.eth_accounts, - params: [] - })) as string[]; - - // Check if the accounts are the same - expect(accounts.length).toBeGreaterThan(0); - expect(accounts).toEqual( - THOR_SOLO_ACCOUNTS_BASE_WALLET.accounts.map( - (account) => account.address - ) - ); - }); - }); - - /** - * eth_accounts RPC call tests - Negative cases - */ - describe('eth_accounts - Negative cases', () => { - /** - * Negative case 1 - Should return empty array if wallet is not given - */ - test('eth_accounts - Should return empty array if wallet is not given', async () => { - // Get accounts (NO WALLET GIVEN) - const accounts = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_accounts - ]([])) as string[]; - - // Check if the accounts are the same - expect(accounts.length).toBe(0); - expect(accounts).toEqual([]); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_accounts/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_accounts/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.mock.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.mock.solo.test.ts deleted file mode 100644 index 65924a64e..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.mock.solo.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_blockNumber' method with Solo Network and mocked functionality - * - * @group integration/rpc-mapper/methods/eth_blockNumber - */ -describe('RPC Mapper - eth_blockNumber method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_blockNumber RPC call tests - Negative cases - */ - describe('eth_blockNumber - Negative cases', () => { - /** - * Test case that mocks an error thrown by the getBestBlock method - */ - test('Should throw `ProviderRpcError` if an error occurs while retrieving the block number', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getBestBlockCompressed' - ).mockRejectedValue(new Error()); - - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_blockNumber]([]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Test case where the best block is not defined - */ - test('Should return `0x0` if the genesis block is not defined', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getBestBlockCompressed' - ).mockResolvedValue(null); - - const rpcCallChainId = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_blockNumber - ]([])) as string; - - expect(rpcCallChainId).toBe('0x0'); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.solo.test.ts deleted file mode 100644 index 48797dc33..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.solo.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_blockNumber' method on Solo Network - * - * @group integration/rpc-mapper/methods/eth_blockNumber - */ -describe('RPC Mapper - eth_blockNumber method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_blockNumber RPC call tests - Positive cases - */ - describe('eth_blockNumber - Positive cases', () => { - /** - * Test case where the latest block number is returned and updated when a new block is mined - */ - test('Should return the latest block number and the updated latest block number when updated', async () => { - const rpcCallLatestBlockNumber = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_blockNumber - ]([]); - - expect(rpcCallLatestBlockNumber).not.toBe('0x0'); - - await thorClient.blocks.waitForBlockCompressed( - Number(rpcCallLatestBlockNumber) + 1 - ); - - const rpcCallUpdatedLatestBlockNumber = await RPCMethodsMap( - thorClient - )[RPC_METHODS.eth_blockNumber]([]); - - expect(rpcCallUpdatedLatestBlockNumber).not.toBe('0x0'); - expect( - Number(rpcCallUpdatedLatestBlockNumber) - ).toBeGreaterThanOrEqual(Number(rpcCallLatestBlockNumber) + 1); - }, 15000); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.testnet.test.ts deleted file mode 100644 index 9cf09eb83..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/eth_blockNumber.testnet.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { Quantity } from '@vechain/sdk-core'; - -/** - * RPC Mapper integration tests for 'eth_blockNumber' method on Testnet Network - * - * @group integration/rpc-mapper/methods/eth_blockNumber - */ -describe('RPC Mapper - eth_blockNumber method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_blockNumber RPC call tests - Positive cases - */ - describe('eth_blockNumber - Positive cases', () => { - /** - * Test case where the latest block number is returned and updated when a new block is mined - */ - test('Should return the latest block number and the updated latest block number when updated', async () => { - const rpcCallLatestBlockNumber = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_blockNumber - ]([]); - - expect(rpcCallLatestBlockNumber).not.toBe('0x0'); - - await thorClient.blocks.waitForBlockCompressed( - Number(rpcCallLatestBlockNumber) + 1 - ); - - const rpcCallUpdatedLatestBlockNumber = await RPCMethodsMap( - thorClient - )[RPC_METHODS.eth_blockNumber]([]); - - expect(rpcCallUpdatedLatestBlockNumber).not.toBe('0x0'); - expect(rpcCallUpdatedLatestBlockNumber).toBe( - Quantity.of(Number(rpcCallLatestBlockNumber) + 1).toString() - ); - }, 20000); - }); - - /** - * eth_blockNumber RPC call tests - Negative cases - */ - describe('eth_blockNumber - Negative cases', () => {}); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_blockNumber/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_call/eth_call.mock.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_call/eth_call.mock.solo.test.ts deleted file mode 100644 index 359c6024a..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_call/eth_call.mock.solo.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_call' method with Solo Network and mocked functionality - * - * @group integration/rpc-mapper/methods/eth_call - */ -describe('RPC Mapper - eth_call method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_call RPC call tests - Negative cases - */ - describe('eth_call - Negative cases', () => { - /** - * Test case that mocks an error thrown by the simulateTransaction method - */ - test('Should throw `ProviderRpcError` if an error occurs while simulating the transaction', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.transactions, - 'simulateTransaction' - ).mockRejectedValue(new Error()); - - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_call]([ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - 'latest' - ]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_call/eth_call.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_call/eth_call.testnet.test.ts deleted file mode 100644 index 900f3e237..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_call/eth_call.testnet.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { negativeCasesFixtures, positiveCasesFixtures } from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_call' method - * - * @group integration/rpc-mapper/methods/eth_call - */ -describe('RPC Mapper - eth_call method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_call RPC call tests - Positive cases - */ - describe('eth_call - Positive cases', () => { - /** - * Positive cases - */ - positiveCasesFixtures.forEach((fixture) => { - test(fixture.description, async () => { - const response = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_call - ](fixture.input); - expect(response).toBe(fixture.expected); - }); - }); - }); - - /** - * eth_call RPC call tests - Negative cases - */ - describe('eth_call - Negative cases', () => { - /** - * Negative cases - */ - negativeCasesFixtures.forEach((fixture) => { - test(fixture.description, async () => { - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_call]( - fixture.input - ) - ).rejects.toThrowError(fixture.expected); - }); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_call/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_call/fixture.ts deleted file mode 100644 index f7432ab4d..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_call/fixture.ts +++ /dev/null @@ -1,173 +0,0 @@ -import { Hex } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * Fixtures for positive cases - */ -const positiveCasesFixtures = [ - { - description: 'Sends 1 VET to the receiver. (latest tag)', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - 'latest' - ], - expected: '0x' - }, - { - description: 'Sends 1 VET to the receiver. (finalized tag)', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - 'finalized' - ], - expected: '0x' - }, - { - description: 'Sends 1 VET to the receiver. (safe tag)', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - 'safe' - ], - expected: '0x' - }, - { - description: 'Sends 1 VET to the receiver. (pending tag)', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - 'pending' - ], - expected: '0x' - }, - { - description: 'Sends 1 VET to the receiver. (using { blockNumber: 0 } )', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - { - blockNumber: 0 - } - ], - expected: '0x' - }, - { - description: 'Sends 1 VET to the receiver. (using { blockHash: 0x } )', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - { - blockHash: Hex.of(0).toString() - } - ], - expected: '0x' - }, - { - description: - 'Sends 1 VET to the receiver. (using 0x0 string blockHash)', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - Hex.of(0).toString() - ], - expected: '0x' - }, - { - description: 'Sends 1 VET to the receiver. (earliest tag)', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0x3db469a79593dcc67f07DE1869d6682fC1eaf535', - value: '1000000000000000000', - data: '0x' - }, - 'earliest' - ], - expected: '0x' - }, - { - description: 'Send complex transaction object.', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567', - gas: 30432, - gasPrice: '0x9184e72a000', - value: '0x9184e72a', - data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675' - }, - 'latest' - ], - expected: '0x' - }, - { - description: 'Send complex transaction object.', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567', - gas: 30432, - gasPrice: '0x9184e72a000', - value: '0x9184e72a', - data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675' - }, - 'latest' - ], - expected: '0x' - } -]; - -/** - * Negative cases fixtures - */ -const negativeCasesFixtures = [ - { - description: 'No parameter passed', - input: [], - expected: JSONRPCInvalidParams - }, - { - description: 'Missing parameters', - input: [ - { - from: '0x7487d912d03ab9de786278f679592b3730bdd540' - }, - 'latest' - ], - expected: JSONRPCInternalError - } -]; - -export { negativeCasesFixtures, positiveCasesFixtures }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.mainnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.mainnet.test.ts deleted file mode 100644 index 330a1506a..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.mainnet.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - CHAIN_ID, - RPC_METHODS, - RPCMethodsMap, - ThorClient -} from '../../../../../src'; -import { mainNetwork } from '../../../../fixture'; - -/** - * RPC Mapper integration tests for 'eth_chainId' method - * - * @group integration/rpc-mapper/methods/eth_chainId-mainnet - */ -describe('RPC Mapper - eth_chainId method tests mainnet', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = new ThorClient(mainNetwork); - }); - - /** - * eth_chainId RPC call tests - Positive cases - */ - describe('eth_chainId - Positive cases', () => { - /** - * Test case regarding obtaining the chain id - */ - test('Should return the chain id', async () => { - const rpcCallChainId = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_chainId - ]([])) as string; - - expect(rpcCallChainId).toBe(CHAIN_ID.MAINNET); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.mock.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.mock.solo.test.ts deleted file mode 100644 index eb21eaf4d..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.mock.solo.test.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_chainId' method - * - * @group integration/rpc-mapper/methods/eth_chainId-mock-solo - */ -describe('RPC Mapper - eth_chainId method tests mock on solo', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_chainId RPC call tests - Negative cases - */ - describe('eth_chainId - Negative cases', () => { - /** - * Test case that mocks an error thrown by the getGenesisBlock method - */ - test('Should throw `ProviderRpcError` if an error occurs while retrieving the chain id', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn(thorClient.blocks, 'getGenesisBlock').mockRejectedValue( - new Error() - ); - - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_chainId]([]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Test case where the genesis block is not defined - */ - test('Should return `0x0` if the genesis block is not defined', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn(thorClient.blocks, 'getGenesisBlock').mockResolvedValue( - null - ); - - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_chainId]([]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.solo.test.ts deleted file mode 100644 index b6e6830f4..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.solo.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - CHAIN_ID, - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_chainId' method - * - * @group integration/rpc-mapper/methods/eth_chainId-solo - */ -describe('RPC Mapper - eth_chainId method tests solo', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_chainId RPC call tests - Positive cases - */ - describe('eth_chainId - Positive cases', () => { - /** - * Test case regarding obtaining the chain id - */ - test('Should return the chain id', async () => { - const rpcCallChainId = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_chainId - ]([])) as string; - - expect(rpcCallChainId).toBe(CHAIN_ID.TESTNET); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.testnet.test.ts deleted file mode 100644 index 9ed63c43c..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/eth_chainId.testnet.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - CHAIN_ID, - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_chainId' method - * - * @group integration/rpc-mapper/methods/eth_chainId-testnet - */ -describe('RPC Mapper - eth_chainId method tests testnet', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_chainId RPC call tests - Positive cases - */ - describe('eth_chainId - Positive cases', () => { - /** - * Test case regarding obtaining the chain id - */ - test('Should return the chain id', async () => { - const rpcCallChainId = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_chainId - ]([])) as string; - - expect(rpcCallChainId).toBe(CHAIN_ID.TESTNET); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_chainId/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_coinbase/eth_coinbase.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_coinbase/eth_coinbase.testnet.test.ts deleted file mode 100644 index 6c39b3049..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_coinbase/eth_coinbase.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_coinbase' method - * - * @group integration/rpc-mapper/methods/eth_coinbase - */ -describe('RPC Mapper - eth_coinbase method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_coinbase RPC call tests - Positive cases - */ - describe('eth_coinbase - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_coinbase - negative case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_coinbase]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_coinbase/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_coinbase/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_createAccessList/eth_createAccessList.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_createAccessList/eth_createAccessList.testnet.test.ts deleted file mode 100644 index f45adeade..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_createAccessList/eth_createAccessList.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_createAccessList' method - * - * @group integration/rpc-mapper/methods/eth_createAccessList - */ -describe('RPC Mapper - eth_createAccessList method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_createAccessList RPC call tests - Positive cases - */ - describe('eth_createAccessList - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_createAccessList - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_createAccessList]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_createAccessList/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_createAccessList/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.mock.testnet.test.ts deleted file mode 100644 index 665f491bd..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.mock.testnet.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { Address, Clause, VET } from '@vechain/sdk-core'; - -/** - * RPC Mapper integration tests for 'eth_estimateGas' method with Solo Network and mocked functionality - * - * @group integration/rpc-mapper/methods/eth_estimateGas - */ -describe('RPC Mapper - eth_estimateGas method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_call RPC call tests - Negative cases - */ - describe('eth_call - Negative cases', () => { - /** - * Test case that mocks an error thrown by the estimateGas method - */ - test('Should throw `JSONRPCInternalError` if an error occurs while estimating the gas', async () => { - // Mock the estimateGas method to return null - jest.spyOn(thorClient.gas, 'estimateGas').mockRejectedValue( - new Error() - ); - - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_estimateGas]([ - Clause.transferVET( - Address.of( - '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' - ), - VET.of(1000) - ), - 'latest' - ]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.testnet.test.ts deleted file mode 100644 index 9bb6e265c..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.testnet.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { negativeCasesFixtures, positiveCasesFixtures } from './fixture'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_estimateGas' method - * - * @group integration/rpc-mapper/methods/eth_estimateGas - */ -describe('RPC Mapper - eth_estimateGas method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_estimateGas RPC call tests - Positive cases - */ - describe('eth_estimateGas - Positive cases', () => { - /** - * Positive cases - */ - positiveCasesFixtures.forEach((fixture) => { - test(fixture.description, async () => { - const response = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_estimateGas - ](fixture.input); - expect(response).toBe(fixture.expected); - }); - }); - }); - - /** - * eth_estimateGas RPC call tests - Negative cases - */ - describe('eth_estimateGas - Negative cases', () => { - /** - * Negative cases - */ - negativeCasesFixtures.forEach((fixture) => { - test(fixture.description, async () => { - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_estimateGas]( - fixture.input - ) - ).rejects.toThrowError(fixture.expected); - }); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/fixture.ts deleted file mode 100644 index e7ca9182d..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/fixture.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Address, Clause, VET } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * Fixtures for positive cases - */ -const positiveCasesFixtures = [ - { - description: 'Simple transfer.', - input: [ - Clause.transferVET( - Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'), - VET.of(1000) - ), - 'latest' - ], - expected: '0x5208' - }, - { - description: 'Missing to parameter', - input: [ - { - value: '0x16345785d8a0000', - from: '0x783DE01F06b4F2a068A7b3Bb6ff3db821A08f8c1', - data: '0x608060405260405161038f38038061038f833981810160405281019061002591906100c4565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600060146101000a81548160ff021916908360ff160217905550506100f1565b600080fd5b600060ff82169050919050565b6100a18161008b565b81146100ac57600080fd5b50565b6000815190506100be81610098565b92915050565b6000602082840312156100da576100d9610086565b5b60006100e8848285016100af565b91505092915050565b61028f806101006000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063268774ee146100465780638da5cb5b14610064578063ef5fb05b14610082575b600080fd5b61004e6100a0565b60405161005b9190610130565b60405180910390f35b61006c6100b3565b604051610079919061018c565b60405180910390f35b61008a6100d7565b6040516100979190610237565b60405180910390f35b600060149054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280601981526020017f48656c6c6f20776f726c642066726f6d205665636861696e2100000000000000815250905090565b600060ff82169050919050565b61012a81610114565b82525050565b60006020820190506101456000830184610121565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101768261014b565b9050919050565b6101868161016b565b82525050565b60006020820190506101a1600083018461017d565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156101e15780820151818401526020810190506101c6565b60008484015250505050565b6000601f19601f8301169050919050565b6000610209826101a7565b61021381856101b2565b93506102238185602086016101c3565b61022c816101ed565b840191505092915050565b6000602082019050818103600083015261025181846101fe565b90509291505056fea2646970667358221220a8d9cb0429fef46fb1c7c9a58e4dfac76fe050709cf08e59aca68614cd6d6c9a64736f6c63430008110033000000000000000000000000000000000000000000000000000000000000000a' - }, - 'latest' - ], - expected: '0x45015' - }, - { - description: 'Missing block reference', - input: [ - { - from: '0x37cce5c8bd6141cbe8172b277faa65af5cc83c6a', - data: '0x' - } - ], - expected: '0xcf08' - } -]; - -/** - * Negative cases fixtures - */ -const negativeCasesFixtures = [ - { - description: 'No parameter passed', - input: [], - expected: JSONRPCInvalidParams - }, - { - description: 'Missing parameters', - input: [ - { - to: '0x7487d912d03ab9de786278f679592b3730bdd540' - }, - 'latest' - ], - expected: JSONRPCInternalError - } -]; - -export { negativeCasesFixtures, positiveCasesFixtures }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_feeHistory/eth_feeHistory.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_feeHistory/eth_feeHistory.testnet.test.ts deleted file mode 100644 index 5c74ae4cf..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_feeHistory/eth_feeHistory.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_feeHistory' method - * - * @group integration/rpc-mapper/methods/eth_feeHistory - */ -describe('RPC Mapper - eth_feeHistory method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_feeHistory RPC call tests - Positive cases - */ - describe('eth_feeHistory - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_feeHistory - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_feeHistory]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_feeHistory/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_feeHistory/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.mainnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.mainnet.test.ts deleted file mode 100644 index a699f39f5..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.mainnet.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - MAINNET_URL, - RPC_METHODS, - RPCMethodsMap, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_gasPrice' method - * - * @group integration/rpc-mapper/methods/eth_gasPrice - */ -describe('RPC Mapper - eth_gasPrice method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(MAINNET_URL); - }); - - /** - * eth_gasPrice RPC call tests - Positive cases - */ - describe('eth_gasPrice - Positive cases', () => { - /** - * Positive case 1 - Get a dummy gas price value. - */ - test('eth_gasPrice - Dummy gas price value', async () => { - const gasPrice = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_gasPrice - ]([]); - expect(gasPrice).toBe('0x9184e72a000'); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.testnet.test.ts deleted file mode 100644 index 341a19e57..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/eth_gasPrice.testnet.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_gasPrice' method - * - * @group integration/rpc-mapper/methods/eth_gasPrice - */ -describe('RPC Mapper - eth_gasPrice method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_gasPrice RPC call tests - Positive cases - */ - describe('eth_gasPrice - Positive cases', () => { - /** - * Positive case 1 - Get a dummy gas price value. - */ - test('eth_gasPrice - Dummy gas price value', async () => { - const gasPrice = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_gasPrice - ]([]); - expect(gasPrice).toBe('0x9184e72a000'); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_gasPrice/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBalance/eth_getBalance.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBalance/eth_getBalance.solo.test.ts deleted file mode 100644 index f900e69ea..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBalance/eth_getBalance.solo.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; -import { - ethGetBalanceTestCases, - invalidEthGetBalanceTestCases -} from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getBalance' method - * - * @group integration/rpc-mapper/methods/eth_getBalance - */ -describe('RPC Mapper - eth_getBalance method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_getBalance RPC call tests - Positive cases - */ - describe('eth_getBalance - Positive cases', () => { - /** - * Test cases for eth_getBalance RPC method that do not throw an error - */ - ethGetBalanceTestCases.forEach(({ description, params, expected }) => { - test(description, async () => { - const rpcCall = - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_getBalance]( - params - ); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - }); - - /** - * Test cases for eth_getBalance RPC method that throw an error - */ - invalidEthGetBalanceTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - // Call RPC method - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_getBalance]( - params - ) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); - - /** - * eth_getBalance RPC call tests - Negative cases - */ - describe('eth_getBalance - Negative cases', () => {}); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBalance/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBalance/fixture.ts deleted file mode 100644 index 024322dab..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBalance/fixture.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Hex, Quantity, ZERO_BYTES, Units } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; -import { THOR_SOLO_ACCOUNTS } from '../../../../../src'; - -/** - * eth_getBalance RPC call tests - Positive cases - */ -const ethGetBalanceTestCases = [ - { - description: 'Should return correct balance of the test account', - params: [THOR_SOLO_ACCOUNTS[0].address, 'latest'], - expected: Quantity.of(Units.parseEther('500000000').bi).toString() - }, - { - description: 'Should return correct balance of the test account', - params: [THOR_SOLO_ACCOUNTS[0].address, 'best'], - expected: Quantity.of(Units.parseEther('500000000').bi).toString() - }, - { - description: - 'Should return correct balance of the test account before seeding', - params: [ - THOR_SOLO_ACCOUNTS[0].address, - Quantity.of(0).toString() // 0 is the genesis block - ], - expected: '0x0' // Expected balance is 0 - }, - { - description: - 'Should return correct balance of the test account after seeding', - params: [ - // Zero address - Hex.of(ZERO_BYTES(20)).toString(), - Quantity.of(1).toString() - ], - expected: '0x0' - }, - { - description: 'Should return error for block number not as hex string', - params: [THOR_SOLO_ACCOUNTS[0].address, '1'], // VeChainThor also supports block number as number instead of hex string - expected: '0x0' // Expected balance is 0 - } -]; - -/** - * eth_getBalance RPC call tests - Negative cases - */ -const invalidEthGetBalanceTestCases = [ - { - description: 'Should throw error for too many params', - params: [THOR_SOLO_ACCOUNTS[0].address, 'latest', 'latest'], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw error for invalid address', - params: ['0x-123', 'latest'], - expectedError: JSONRPCInternalError - }, - { - description: 'Should throw error for invalid block number', - params: [THOR_SOLO_ACCOUNTS[0].address, '0x123z'], - expectedError: JSONRPCInternalError - }, - { - description: 'Should throw error for too few params', - params: [THOR_SOLO_ACCOUNTS[0].address], - expectedError: JSONRPCInvalidParams - } -]; - -export { ethGetBalanceTestCases, invalidEthGetBalanceTestCases }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.mock.testnet.test.ts deleted file mode 100644 index 8a2fe63b0..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.mock.testnet.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { ethGetBlockByHashTestCases } from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getBlockByHash' method - * - * @group integration/rpc-mapper/methods/eth_getBlockByHash - */ -describe('RPC Mapper - eth_getBlockByHash method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getBlockByHash RPC call tests - Negative cases - */ - describe('Negative cases', () => { - /** - * Test case where request fails - */ - test('Should throw `JSONRPCInternalError` when request fails', async () => { - // Mock the getBlock method to throw error - jest.spyOn(thorClient.blocks, 'getBlockExpanded').mockRejectedValue( - new Error() - ); - - jest.spyOn( - thorClient.blocks, - 'getBlockCompressed' - ).mockRejectedValue(new Error()); - - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockByHash - ](ethGetBlockByHashTestCases[0].params) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.testnet.test.ts deleted file mode 100644 index 711cd28d8..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/eth_getBlockByHash.testnet.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - ethGetBlockByHashTestCases, - invalidEthGetBlockByHashTestCases -} from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getBlockByHash' method - * - * @group integration/rpc-mapper/methods/eth_getBlockByHash - */ -describe('RPC Mapper - eth_getBlockByHash method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getBlockByHash RPC call tests - Positive cases - */ - describe('eth_getBlockByHash - Positive cases', () => { - /** - * Test cases for eth_getBlockByHash RPC method - */ - ethGetBlockByHashTestCases.forEach( - ({ description, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockByHash - ](params); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - }); - - /** - * eth_getBlockByHash RPC call tests - Negative cases - */ - describe('eth_getBlockByHash - Negative cases', () => { - /** - * Invalid eth_getBlockByHash RPC method test cases - */ - invalidEthGetBlockByHashTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - // Call RPC function - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockByHash - ](params) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/fixture.ts deleted file mode 100644 index f7beaf305..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByHash/fixture.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { blockWithTransactionsExpanded } from '../../../fixture'; -import { zeroBlock } from '../eth_getBlockByNumber/fixture'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * Test cases for eth_getBlockByHash RPC method - */ -const ethGetBlockByHashTestCases = [ - { - description: 'Should get block zero block', - params: [ - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - false - ], - expected: zeroBlock, - expectedTransactionsLength: 0 - }, - { - description: 'Should get block zero block with transaction details', - params: [ - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - true - ], - // Because genesis block doesn't have any transactions on testnet - expected: zeroBlock, - expectedTransactionsLength: 0 - }, - { - description: 'Should get block which has transactions with details', - params: [ - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - true - ], - expected: blockWithTransactionsExpanded, - expectedTransactionsLength: 3 - }, - { - description: 'Should get null if block does not exist', - params: [ - '0x00000000000000000000000000083d49db800000000000000000000000000000', - true - ], - expected: null, - expectedTransactionsLength: 0 - } -]; - -/** - * Invalid eth_getBlockByHash RPC method test cases - */ -const invalidEthGetBlockByHashTestCases = [ - { - description: 'Should throw an error when there are too many params', - params: ['0x0', false, "I'm an extra param"], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when first param is not a string', - params: [0, false], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when second param is not a boolean', - params: ['0x0', 'false'], - expectedError: JSONRPCInvalidParams - }, - { - description: - 'Should throw an error when we use getBlockByNumber parameters for block number', - params: ['latest', false], - expectedError: JSONRPCInvalidParams - } -]; - -export { ethGetBlockByHashTestCases, invalidEthGetBlockByHashTestCases }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByNumber/eth_getBlockByNumber.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByNumber/eth_getBlockByNumber.testnet.test.ts deleted file mode 100644 index eda1a42c2..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByNumber/eth_getBlockByNumber.testnet.test.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - ethGetBlockByNumberTestCases, - invalidEthGetBlockByNumberTestCases -} from './fixture'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_getBlockByNumber' method - * - * @group integration/rpc-mapper/methods/eth_getBlockByNumber - */ -describe('RPC Mapper - eth_getBlockByNumber method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getBlockByNumber RPC call tests - Positive cases - */ - describe('Positive cases', () => { - /** - * Test cases for eth_getBlockByNumber RPC method - */ - ethGetBlockByNumberTestCases.forEach( - ({ description, params, expected }) => { - test(description, async () => { - // Call RPC function - const rpcCall = - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockByNumber - ](params); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - - /** - * Test case where the revision is valid but doesn't refer to an existing block - */ - test('Should be able to get block with `latest`', async () => { - // Null block - const rpcCallNullBlock = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockByNumber - ](['latest', false]); - expect(rpcCallNullBlock).toBeDefined(); - }); - - /** - * Test case where the revision is valid but doesn't refer to an existing block - */ - test('Should be able to get block with `finalized`', async () => { - // Null block - const rpcCallNullBlock = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockByNumber - ](['finalized', false]); - expect(rpcCallNullBlock).toBeDefined(); - }); - }); - - /** - * eth_getBlockByNumber RPC call tests - Negative cases - */ - describe('Negative cases', () => { - /** - * Invalid eth_getBlockByNumber RPC method test cases - */ - invalidEthGetBlockByNumberTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - // Call RPC function - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockByNumber - ](params) - ).rejects.toThrowError(expectedError); - }); - } - ); - - /** - * Test case where the block number is negative - */ - test('Should throw `JSONRPCInternalError` for negative block number', async () => { - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockByNumber - ]([`0x${BigInt(-1).toString(16)}`, false]) // Block number is negative (-1) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByNumber/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByNumber/fixture.ts deleted file mode 100644 index 1aa2a31a9..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockByNumber/fixture.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { HexInt } from '@vechain/sdk-core'; -import { - blockWithTransactionsExpanded, - blockWithTransactionsNotExpanded -} from '../../../fixture'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * Zero block fixture - */ -const zeroBlock = { - hash: '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - parentHash: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - number: '0x0', - size: '0xaa', - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - transactionsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - timestamp: '0x5b322ac0', - gasLimit: '0x989680', - gasUsed: '0x0', - transactions: [], - miner: '0x0000000000000000000000000000000000000000', - difficulty: '0x0', - totalDifficulty: '0x0', - uncles: [], - sha3Uncles: - '0x0000000000000000000000000000000000000000000000000000000000000000', - nonce: '0x0000000000000000', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - extraData: '0x', - baseFeePerGas: '0x0', - mixHash: - '0x0000000000000000000000000000000000000000000000000000000000000000' -}; - -/** - * Test cases for eth_getBlockByNumber RPC method - */ -const ethGetBlockByNumberTestCases = [ - // NOTE: hydrate true or false is the same, Because genesis block doesn't have any transactions on testnet - { - description: "Should get block by number '0x0'", - params: [HexInt.of(0).toString(), false], - expected: zeroBlock - }, - { - description: - "Should get block by number '0x0' with transaction details", - params: [HexInt.of(0).toString(), true], - expected: zeroBlock - }, - { - description: 'Should get block which has transactions with details', - params: [HexInt.of(17529453).toString(), true], - expected: blockWithTransactionsExpanded - }, - { - description: - 'Should get block which has transactions with transaction NOT expanded', - params: [HexInt.of(17529453).toString(), false], - expected: blockWithTransactionsNotExpanded - } -]; - -/** - * Invalid eth_getBlockByNumber RPC method test cases - */ -const invalidEthGetBlockByNumberTestCases = [ - { - description: 'Should throw an error when there are too many params', - params: ['0x0', false, "I'm an extra param"], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when first param is not a string', - params: [0, false], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when second param is not a boolean', - params: ['0x0', 'false'], - expectedError: JSONRPCInvalidParams - } -]; - -export { - zeroBlock, - ethGetBlockByNumberTestCases, - invalidEthGetBlockByNumberTestCases -}; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.mock.testnet.test.ts deleted file mode 100644 index 10d2bb723..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.mock.testnet.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_getBlockReceipts' method - * - * @group integration/sdk-network/rpc-mapper/methods/eth_getBlockReceipts-mock - */ -describe('RPC Mapper - eth_getBlockReceipts mock method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getBlockReceipts RPC call tests - Positive cases - */ - describe('eth_getBlockReceipts - Positive cases', () => { - /** - * Positive case 1 - Simple block receipts retrieval - */ - test('Should return null if the fetched block is null', async () => { - // Mock the estimateGas method to return null - jest.spyOn(thorClient.blocks, 'getBlockExpanded').mockResolvedValue( - null - ); - - // Call RPC function - const rpcCall = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockReceipts - ](['latest']); - - // Compare the result with the expected value - expect(rpcCall).toEqual(null); - }); - }); - - /** - * eth_getBlockReceipts RPC call tests - Negative cases - */ - describe('eth_getBlockReceipts - Negative cases', () => { - /** - * Negative case 1 - Throws error if any error occurs while fetching block number - */ - test('Should throw error if errors while fetching block number', async () => { - // Mock the estimateGas method to return null - jest.spyOn(thorClient.blocks, 'getBlockExpanded').mockRejectedValue( - new Error() - ); - - // Call RPC function and expect an error - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockReceipts - ](['latest']) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.testnet.test.ts deleted file mode 100644 index 2a94116d7..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/eth_getBlockReceipts.testnet.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { blockReceiptsFixture, blockReceiptsInvalidFixture } from './fixture'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_getBlockReceipts' method - * - * @group integration/sdk-network/rpc-mapper/methods/eth_getBlockReceipts - */ -describe('RPC Mapper - eth_getBlockReceipts method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getBlockReceipts RPC call tests - Positive cases - */ - describe('eth_getBlockReceipts - Positive cases', () => { - /** - * Positive case 1 - Simple block receipts retrieval - */ - test('Should be able to get block receipts', async () => { - for (const fixture of blockReceiptsFixture) { - // Call RPC function - const rpcCall = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockReceipts - ]([fixture.blockNumber]); - - // Compare the result with the expected value - expect(rpcCall).toEqual(fixture.expected); - } - }, 20000); - - /** - * Should get a result with block tags 'latest' and 'finalized' - */ - test('Should get a result with block tags "latest" and "finalized"', async () => { - for (const blockNumber of ['latest', 'finalized']) { - // Call RPC function - const rpcCall = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockReceipts - ]([blockNumber]); - - // Compare the result with the expected value - expect(rpcCall).toBeDefined(); - } - }, 20000); - }); - - /** - * eth_getBlockReceipts RPC call tests - Negative cases - */ - describe('eth_getBlockReceipts - Negative cases', () => { - /** - * Throw error if RPC parameters are invalid - */ - test('Should throw error with invalid parameters', async () => { - for (const fixture of blockReceiptsInvalidFixture) { - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockReceipts - ]([fixture]) - ).rejects.toThrowError(JSONRPCInvalidParams); - } - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/fixture.ts deleted file mode 100644 index 9efc39b4c..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockReceipts/fixture.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { HexInt } from '@vechain/sdk-core'; - -/** - * Fixtures for the `eth_getBlockReceipts` RPC method. - * - * This fixtures are used to test the `eth_getBlockReceipts` RPC method to - * test positive cases. - */ -const blockReceiptsFixture = [ - { - blockNumber: '0x122c99a', - expected: [ - { - blockHash: - '0x0122c99aaf2b9ee1e4d4835c0dc78e799b09101b06b67733ff58b416c8b0b870', - blockNumber: '0x122c99a', - contractAddress: null, - from: '0x4f6fc409e152d33843cf4982d414c1dd0879277e', - gasUsed: '0xcd66', - logs: [ - { - blockHash: - '0x0122c99aaf2b9ee1e4d4835c0dc78e799b09101b06b67733ff58b416c8b0b870', - blockNumber: '0x122c99a', - transactionHash: - '0x43b02a0dac2503d3e8d9540bf3174466267c558a3a50fa997a8f5a590711c10c', - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000004f6fc409e152d33843cf4982d414c1dd0879277e', - '0x0000000000000000000000009ac05eb9defbd0cef08548fa33a9d25972684be5' - ], - data: '0x000000000000000000000000000000000000000000000002b5e3af16b1880000', - removed: false, - transactionIndex: '0x0', - logIndex: '0x0' - } - ], - status: '0x1', - to: '0x9ac05eb9defbd0cef08548fa33a9d25972684be5', - transactionHash: - '0x43b02a0dac2503d3e8d9540bf3174466267c558a3a50fa997a8f5a590711c10c', - transactionIndex: '0x0', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - type: '0x0' - } - ] - }, - { - blockNumber: HexInt.of(17529453).toString(), - expected: [ - { - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - contractAddress: null, - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gasUsed: '0x60d8', - logs: [], - status: '0x1', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - transactionHash: - '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded', - transactionIndex: '0x0', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - type: '0x0' - }, - { - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - contractAddress: null, - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gasUsed: '0x9da8', - logs: [], - status: '0x1', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - transactionHash: - '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - transactionIndex: '0x1', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - type: '0x0' - }, - { - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - contractAddress: null, - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gasUsed: '0xae68', - logs: [], - status: '0x1', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - transactionHash: - '0xb476d1a43b8632c25a581465c944a1cb5dd99e48d41d326a250847a0a279afa5', - transactionIndex: '0x2', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - type: '0x0' - } - ] - } -]; - -/** - * Negative test cases for the `eth_getBlockReceipts` RPC method. - * - * This fixtures are used to test the `eth_getBlockReceipts` RPC method to - * test negative cases. - */ -const blockReceiptsInvalidFixture = [ - // Invalid block number hex string - { - blockNumber: 'INVALID_BLOCK_NUMBER' - }, - - // Null block number given - { - blockNumber: null - }, - - // No block number given - {} -]; - -export { blockReceiptsFixture, blockReceiptsInvalidFixture }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByHash/eth_getBlockTransactionCountByHash.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByHash/eth_getBlockTransactionCountByHash.testnet.test.ts deleted file mode 100644 index 6f2acd261..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByHash/eth_getBlockTransactionCountByHash.testnet.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - ethGetBlockByHashTestCases, - invalidEthGetBlockByHashTestCases -} from '../eth_getBlockByHash/fixture'; - -/** - * RPC Mapper integration tests for 'eth_getBlockTransactionCountByHash' method - * - * @group integration/rpc-mapper/methods/eth_getBlockTransactionCountByHash - */ -describe('RPC Mapper - eth_getBlockTransactionCountByHash method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getBlockTransactionCountByHash RPC call tests - Positive cases - */ - describe('eth_getBlockTransactionCountByHash - Positive cases', () => { - /** - * eth_getBlockTransactionCountByHash RPC method positive test cases - */ - ethGetBlockByHashTestCases.forEach( - ({ description, params, expectedTransactionsLength }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockTransactionCountByHash - ]([params[0]]); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expectedTransactionsLength); - }); - } - ); - }); - - /** - * eth_getBlockTransactionCountByHash RPC call tests - Negative cases - */ - describe('eth_getBlockTransactionCountByHash - Negative cases', () => { - /** - * Invalid eth_getBlockByHash RPC method test cases - */ - invalidEthGetBlockByHashTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - // Call RPC function - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockTransactionCountByHash - ]([params[0]]) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByHash/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByHash/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/eth_getBlockTransactionCountByNumber.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/eth_getBlockTransactionCountByNumber.testnet.test.ts deleted file mode 100644 index 2bf899aed..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/eth_getBlockTransactionCountByNumber.testnet.test.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { ethGetBlockByHashTestCases } from '../eth_getBlockByHash/fixture'; -import { invalideEthGetBlockTransactionCountByHashTestCases } from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getBlockTransactionCountByNumber' method - * - * @group integration/rpc-mapper/methods/eth_getBlockTransactionCountByNumber - */ -describe('RPC Mapper - eth_getBlockTransactionCountByNumber method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getBlockTransactionCountByNumber RPC call tests - Positive cases - */ - describe('eth_getBlockTransactionCountByNumber - Positive cases', () => { - /** - * eth_getBlockTransactionCountByNumber RPC method positive test cases - */ - ethGetBlockByHashTestCases.forEach( - ({ description, params, expectedTransactionsLength }) => { - test(description, async () => { - // Call RPC function - const rpcCall = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockTransactionCountByNumber - ]([params[0]]); - - // Compare the result with the expected value - expect(rpcCall).toStrictEqual(expectedTransactionsLength); - }); - } - ); - }); - - /** - * eth_getBlockTransactionCountByNumber RPC call tests - Negative cases - */ - describe('eth_getBlockTransactionCountByNumber - Negative cases', () => { - /** - * Invalid eth_getBlockTransactionCountByNumber RPC method test cases - */ - invalideEthGetBlockTransactionCountByHashTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - // Call RPC function - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getBlockTransactionCountByNumber - ](params) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/fixture.ts deleted file mode 100644 index 94958aece..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getBlockTransactionCountByNumber/fixture.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * Invalid eth_getBlockByHash RPC method test cases - */ -const invalideEthGetBlockTransactionCountByHashTestCases = [ - { - description: 'Should throw error when invalid params are provided', - params: [], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when first param is not a string', - params: [0], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when first param is not a string', - params: [0, 1], - expectedError: JSONRPCInvalidParams - } -]; - -export { invalideEthGetBlockTransactionCountByHashTestCases }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getCode/eth_getCode.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getCode/eth_getCode.solo.test.ts deleted file mode 100644 index ef03dcaa9..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getCode/eth_getCode.solo.test.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; -import { ethGetCodeTestCases, invalidEthGetCodeTestCases } from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getCode' method - Solo Network - * - * @group integration/rpc-mapper/methods/eth_getCode - */ -describe('RPC Mapper - eth_getCode method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_getCode RPC call tests - Positive cases - */ - describe('eth_getCode - Positive cases', () => { - /** - * Test cases for eth_getCode RPC method that do not throw an error - */ - ethGetCodeTestCases.forEach(({ description, params, expected }) => { - test(`${description}`, async () => { - const rpcCall = - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_getCode]( - params - ); - - // Compare the result with the expected value - expect(rpcCall).toBe(expected); - }); - }); - }); - - /** - * eth_getCode RPC call tests - Negative cases - */ - describe('eth_getCode - Negative cases', () => { - /** - * Test cases for eth_getCode RPC method that throw an error - */ - invalidEthGetCodeTestCases.forEach( - ({ description, params, expectedError }) => { - test(`${description}`, async () => { - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_getCode]( - params - ) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getCode/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getCode/fixture.ts deleted file mode 100644 index b570c80b6..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getCode/fixture.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { VTHO_ADDRESS } from '@vechain/sdk-core'; -import { - TESTING_CONTRACT_ADDRESS, - TESTING_CONTRACT_BYTECODE -} from '../../../../fixture'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * VTHO Contract bytecode on Solo Network - */ -const VTHO_BYTECODE_SOLO = - '0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce5671461025957806370a082311461028a57806395d89b41146102e1578063a9059cbb14610371578063bb35783b146103d6578063d89135cd1461045b578063dd62ed3e14610486575b600080fd5b3480156100c057600080fd5b506100c96104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053a565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be61062b565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610865565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b506102f661094d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037d57600080fd5b506103bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098a565b604051808215151515815260200191505060405180910390f35b3480156103e257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b50610470610b67565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0d565b6040518082815260200191505060405180910390f35b60606040805190810160405280600681526020017f566554686f720000000000000000000000000000000000000000000000000000815250905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1663592b389c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b8101908080519060200190929190505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6275696c74696e3a20696e73756666696369656e7420616c6c6f77616e63650081525060200191505060405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061085a848484610c93565b600190509392505050565b60006012905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663ee660480836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b81019080805190602001909291905050509050919050565b60606040805190810160405280600481526020017f5654484f00000000000000000000000000000000000000000000000000000000815250905090565b6000610997338484610c93565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610add57503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663059950e9866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b1515610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6275696c74696e3a2073656c66206f72206d617374657220726571756972656481525060200191505060405180910390fd5b610b5c848484610c93565b600190509392505050565b60003073ffffffffffffffffffffffffffffffffffffffff1663138d4d0c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b8101908080519060200190929190505050905090565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000811115610eaa573073ffffffffffffffffffffffffffffffffffffffff166339ed08d584836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050506040513d6020811015610d6957600080fd5b81019080805190602001909291905050501515610dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6275696c74696e3a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631cedfac183836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820bd55cb9aff347dc60fe8280ae6b08a6f6deacc85a4e1c89ba0a8ef31fbcaecc60029'; - -/** - * Test cases for eth_getCode RPC method - */ -const ethGetCodeTestCases = [ - { - description: 'get bytecode of VTHO contract with block id revision', - params: [VTHO_ADDRESS, 'latest'], - expected: VTHO_BYTECODE_SOLO - }, - - { - description: 'get bytecode of contract after it was deployed', - params: [TESTING_CONTRACT_ADDRESS, 'latest'], - expected: TESTING_CONTRACT_BYTECODE - } -]; - -/** - * Test cases for eth_getCode RPC method that throw an error - */ -const invalidEthGetCodeTestCases = [ - { - description: 'Should throw error for too many params', - params: [VTHO_ADDRESS, 'latest', 'latest'], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw error for too many params', - params: [VTHO_ADDRESS], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw error for invalid address', - params: ['0xinvalid', 'latest'], - expectedError: JSONRPCInternalError - }, - { - description: 'Should throw error for invalid revision', - params: ['VTHO_ADDRESS', '0x123'], - expectedError: JSONRPCInternalError - } -]; - -export { ethGetCodeTestCases, invalidEthGetCodeTestCases }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterChanges/eth_getFilterChanges.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterChanges/eth_getFilterChanges.testnet.test.ts deleted file mode 100644 index c568b2ebb..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterChanges/eth_getFilterChanges.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_getFilterChanges' method - * - * @group integration/rpc-mapper/methods/eth_getFilterChanges - */ -describe('RPC Mapper - eth_getFilterChanges method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getFilterChanges RPC call tests - Positive cases - */ - describe('eth_getFilterChanges - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_getFilterChanges - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_getFilterChanges]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterChanges/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterChanges/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterLogs/eth_getFilterLogs.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterLogs/eth_getFilterLogs.testnet.test.ts deleted file mode 100644 index 043b0fcb7..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterLogs/eth_getFilterLogs.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_getFilterLogs' method - * - * @group integration/rpc-mapper/methods/eth_getFilterLogs - */ -describe('RPC Mapper - eth_getFilterLogs method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getFilterLogs RPC call tests - Positive cases - */ - describe('eth_getFilterLogs - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_getFilterLogs - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_getFilterLogs]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterLogs/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getFilterLogs/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/eth_getLogs.mock.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/eth_getLogs.mock.solo.test.ts deleted file mode 100644 index c8e1c9e90..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/eth_getLogs.mock.solo.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - type LogsRPC, - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { logsFixture, mockLogsFixture } from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getLogs' method - * - * @group integration/rpc-mapper/methods/eth_getLogs-mock - */ -describe('RPC Mapper - eth_getLogs method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_getLogs RPC call tests - Positive cases - */ - describe('eth_getLogs - Positive cases', () => { - /** - * Positive cases. Should be able to get logs - */ - mockLogsFixture.forEach((fixture, index) => { - test(`eth_getLogs - Should be able to get logs test - ${index + 1}`, async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.logs, - 'filterRawEventLogs' - ).mockResolvedValue([]); - - // Call RPC method - const logs = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getLogs - ]([fixture.input])) as LogsRPC[]; - - expect(logs.slice(0, 4)).toStrictEqual(fixture.expected); - }, 6000); - }); - }); - - /** - * eth_getLogs RPC call tests - Negative cases - */ - describe('eth_getLogs - Negative cases', () => { - /** - * Negative case 2 - Should throw an error for invalid input if request is invalid - */ - test('eth_getLogs - Should throw error if request is invalid', async () => { - // Mock the filterGroupedEventLogs method to throw error - jest.spyOn(thorClient.logs, 'filterRawEventLogs').mockRejectedValue( - new Error() - ); - - await expect( - async () => - // Call RPC method - (await RPCMethodsMap(thorClient)[RPC_METHODS.eth_getLogs]([ - logsFixture[0].input - ])) as LogsRPC[] - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/eth_getLogs.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/eth_getLogs.testnet.test.ts deleted file mode 100644 index bebcc47f4..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/eth_getLogs.testnet.test.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { Hex } from '@vechain/sdk-core'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { logsFixture } from './fixture'; -import { - type EventLogs, - type LogsRPC, - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient, - VeChainProvider -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_getLogs' method - * - * @group integration/rpc-mapper/methods/eth_getLogs - */ -describe('RPC Mapper - eth_getLogs method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getLogs RPC call tests - Positive cases - */ - describe('eth_getLogs - Positive cases', () => { - /** - * Positive cases. Should be able to get logs - */ - logsFixture.forEach((fixture, index) => { - test(`eth_getLogs - Should be able to get logs test - ${index + 1}`, async () => { - // Call RPC method - const logs = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getLogs - ]([fixture.input])) as LogsRPC[]; - - expect(logs.slice(0, 4)).toStrictEqual(fixture.expected); - }, 6000); - }); - }); - - /** - * eth_getLogs RPC call tests - Negative cases - */ - describe('eth_getLogs - Negative cases', () => { - /** - * Negative case 1 - Should throw an error for invalid input - */ - test('eth_getLogs - Invalid input', async () => { - await expect( - async () => - // Call RPC method - (await RPCMethodsMap(thorClient)[RPC_METHODS.eth_getLogs]([ - 'INVALID_INPUT' - ])) as LogsRPC[] - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); - - test('eth_getLogs - array of an array of topics as input', async () => { - const provider = new VeChainProvider(thorClient); - - const multiTopicsResponse: EventLogs[] = (await provider.request({ - method: 'eth_getLogs', - params: [ - { - address: [ - '0x90c1a329e11ce6429eef0ab9b8f7daab68694e7d', - '0x3d7616213191a10460e49cfdb7edbf88d6a10942' - ], - fromBlock: Hex.of(0).toString(), - toBlock: Hex.of(19000000n), // Same integer has different hex representations for bigint and number IEEE 754. - topics: [ - '0xd6dd0ade89eeb414b7e63b3b71fde3db88b04f032c3d5bce15271008598f64f9', - [ - '0xd6dd0ade89eeb414b7e63b3b71fde3db88b04f032c3d5bce15271008598f64f9', - '0x808dd6e6b8eac0877deeb0f618c8e6776fa59d4ce0ede71e3c4a41bf91e9e462' - ] - ] - } - ] - })) as EventLogs[]; - - expect(multiTopicsResponse).toBeDefined(); - expect(multiTopicsResponse.length).toBeGreaterThan(0); - }, 15000); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/fixture.ts deleted file mode 100644 index ce023edfe..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getLogs/fixture.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { Hex } from '@vechain/sdk-core'; - -/** - * Fixtures for eth_getLogs positive cases - */ -const logsFixture = [ - // Well defined input - { - input: { - address: ['0x0000000000000000000000000000456e65726779'], - fromBlock: Hex.of(0).toString(), - toBlock: Hex.of(100000n).toString(), // Same integer has different hex representations for bigint and number IEEE 754. - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ] - }, - expected: [ - { - transactionHash: - '0x0ee8df3a9de6787ec0848ea8951ed8899bb053b6b4af167228dd7c0c012f5346', - blockHash: - '0x000060716a6decc7127d221e8a53cd7b33992db6236490f79d47585f9ae7ca14', - blockNumber: '0x6071', - address: '0x0000000000000000000000000000456e65726779', - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e55fff280', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - removed: false, - logIndex: '0x0', - transactionIndex: '0x0' - }, - { - transactionHash: - '0x86b3364c0faf2df6365b975cf1bd8046264b1eeaa2f266fe15b2df27d7954f65', - blockHash: - '0x00006135c993e6cd1ed99aac34679caac80759764ecb01431c9bea0199f3bf4c', - blockNumber: '0x6135', - address: '0x0000000000000000000000000000456e65726779', - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - removed: false, - logIndex: '0x0', - transactionIndex: '0x0' - }, - { - transactionHash: - '0x9fada14187c54ca93741c7b20483f52dc83b3f5a934082ea1d7a7d75216c1b80', - blockHash: - '0x00006a2e2b18a4e7697c54045d2d615fe1a2eaad9a698e803c15b847ad4a7f95', - blockNumber: '0x6a2e', - address: '0x0000000000000000000000000000456e65726779', - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - removed: false, - logIndex: '0x0', - transactionIndex: '0x0' - }, - { - transactionHash: - '0xed2c6e452326f2ea126632830ebb8abca5bbfbed9da0780bf65efbbf555c8452', - blockHash: - '0x00006a423cfbab794f79328cbd0f29f08f0ed1466c076153445d10c3e0ac21b2', - blockNumber: '0x6a42', - address: '0x0000000000000000000000000000456e65726779', - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - removed: false, - logIndex: '0x0', - transactionIndex: '0x0' - } - ] - }, - { - input: { - address: null, - fromBlock: Hex.of(0).toString(), - toBlock: Hex.of(100000n).toString(), // Same integer has different hex representations for bigint and number IEEE 754. - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ] - }, - expected: [ - { - transactionHash: - '0x0ee8df3a9de6787ec0848ea8951ed8899bb053b6b4af167228dd7c0c012f5346', - blockHash: - '0x000060716a6decc7127d221e8a53cd7b33992db6236490f79d47585f9ae7ca14', - blockNumber: '0x6071', - address: '0x0000000000000000000000000000456e65726779', - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e55fff280', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - removed: false, - logIndex: '0x0', - transactionIndex: '0x0' - }, - { - transactionHash: - '0x86b3364c0faf2df6365b975cf1bd8046264b1eeaa2f266fe15b2df27d7954f65', - blockHash: - '0x00006135c993e6cd1ed99aac34679caac80759764ecb01431c9bea0199f3bf4c', - blockNumber: '0x6135', - address: '0x0000000000000000000000000000456e65726779', - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - removed: false, - logIndex: '0x0', - transactionIndex: '0x0' - }, - { - transactionHash: - '0x9fada14187c54ca93741c7b20483f52dc83b3f5a934082ea1d7a7d75216c1b80', - blockHash: - '0x00006a2e2b18a4e7697c54045d2d615fe1a2eaad9a698e803c15b847ad4a7f95', - blockNumber: '0x6a2e', - address: '0x0000000000000000000000000000456e65726779', - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - removed: false, - logIndex: '0x0', - transactionIndex: '0x0' - }, - { - transactionHash: - '0xed2c6e452326f2ea126632830ebb8abca5bbfbed9da0780bf65efbbf555c8452', - blockHash: - '0x00006a423cfbab794f79328cbd0f29f08f0ed1466c076153445d10c3e0ac21b2', - blockNumber: '0x6a42', - address: '0x0000000000000000000000000000456e65726779', - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - removed: false, - logIndex: '0x0', - transactionIndex: '0x0' - } - ] - } -]; - -/** - * Fixtures for eth_getLogs mocked positive cases - */ -const mockLogsFixture = [ - // To block not defined (latest block as default) - { - input: { - address: [ - '0x0000000000000000000000000000456e65726779', - '0x0000000000000000000000000000456e65726779' - ], - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - fromBlock: Hex.of(0).toString(), - toBlock: Hex.of(1n).toString() // Same integer has different hex representations for bigint and number IEEE 754. - }, - expected: [] - }, - - // From block and to not defined (latest block as default) - { - input: { - address: [ - '0x0000000000000000000000000000456e65726779', - '0x0000000000000000000000000000456e65726779' - ], - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - fromBlock: Hex.of(0).toString(), - toBlock: Hex.of(1n).toString() // Same integer has different hex representations for bigint and number IEEE 754. - }, - expected: [] - }, - - // No topics defined, only addresses - { - input: { - address: [ - '0x0000000000000000000000000000456e65726779', - '0x0000000000000000000000000000456e65726779' - ], - fromBlock: Hex.of(0).toString(), - toBlock: Hex.of(1n).toString() // Same integer has different hex representations for bigint and number IEEE 754. - }, - expected: [] - }, - - // No addresses defined, only topics - { - input: { - topics: [ - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - fromBlock: Hex.of(0).toString(), - toBlock: Hex.of(1n).toString() // Same integer has different hex representations for bigint and number IEEE 754. - }, - expected: [] - }, - - // fromBlock and toBlock not defined (latest block as default) - { - input: { - address: '0x0000000000000000000000000000456e65726779' - }, - expected: [] - } -]; - -export { logsFixture, mockLogsFixture }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getProof/eth_getProof.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getProof/eth_getProof.testnet.test.ts deleted file mode 100644 index c480b0def..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getProof/eth_getProof.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_getProof' method - * - * @group integration/rpc-mapper/methods/eth_getProof - */ -describe('RPC Mapper - eth_getProof method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getProof RPC call tests - Positive cases - */ - describe('eth_getProof - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_getProof - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_getProof]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getProof/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getProof/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getStorageAt/eth_getStorageAt.mainnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getStorageAt/eth_getStorageAt.mainnet.test.ts deleted file mode 100644 index 3ee284b60..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getStorageAt/eth_getStorageAt.mainnet.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { RPC_METHODS, RPCMethodsMap, ThorClient } from '../../../../../src'; -import { mainNetwork } from '../../../../fixture'; -import { - ethGetStorageAtTestCases, - invalidEthGetStorageAtTestCases -} from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getStorageAt' method - * - * @group integration/rpc-mapper/methods/eth_getStorageAt - */ -describe('RPC Mapper - eth_getStorageAt method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = new ThorClient(mainNetwork); - }); - - /** - * eth_getStorageAt RPC call tests - Positive cases - */ - describe('eth_getStorageAt - Positive cases', () => { - /** - * Test cases for eth_getStorageAt RPC method that do not throw an error - */ - ethGetStorageAtTestCases.forEach( - ({ description, params, expected }) => { - test(description, async () => { - const rpcCall = - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getStorageAt - ](params); - - // Compare the result with the expected value - expect(rpcCall).toBe(expected); - }); - } - ); - }); - - /** - * eth_getStorageAt RPC call tests - Negative cases - */ - describe('eth_getStorageAt - Negative cases', () => { - /** - * Test cases for eth_getStorageAt RPC method that throw an error - */ - invalidEthGetStorageAtTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - // Call RPC method - const rpcCall = - RPCMethodsMap(thorClient)[RPC_METHODS.eth_getStorageAt]( - params - ); - - // Compare the result with the expected value - await expect(rpcCall).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getStorageAt/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getStorageAt/fixture.ts deleted file mode 100644 index 7d2a3cd78..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getStorageAt/fixture.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Hex, ZERO_BYTES } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * Test cases for eth_getStorageAt RPC method - */ -const ethGetStorageAtTestCases: Array<{ - expected: string; - description: string; - params: string[]; -}> = [ - { - description: - 'Should return storage slot value for a given smart contract that has a storage slot value different than NULL', - params: [ - '0x93Ae8aab337E58A6978E166f8132F59652cA6C56', - '0x1', - '0x10afdf1' // Block n. 17497585 - ], - expected: - '0x0000000000000000000000000000000000000000000000000000000061474260' - }, - { - description: - 'Should return storage slot value for a given smart contract that has a storage slot value different than NULL', - params: [ - '0x93Ae8aab337E58A6978E166f8132F59652cA6C56', - '0x0000000000000000000000000000000000000000000000000000000000000001', - '0x10afdf1' // Block n. 17497585 - ], - expected: - '0x0000000000000000000000000000000000000000000000000000000061474260' - }, - { - description: - 'Should return null slot value for an address that does not have a storage slot value at the given position', - params: [ - Hex.of(ZERO_BYTES(20)).toString(), - '0x1', - 'latest' // Block n. 17497585 - ], - expected: - '0x0000000000000000000000000000000000000000000000000000000000000000' - } -]; - -/** - * Test cases for eth_getStorageAt RPC method that throw an error - */ -const invalidEthGetStorageAtTestCases = [ - { - description: 'Should throw error for too many params', - params: [ - '0x93Ae8aab337E58A6978E166f8132F59652cA6C56', // Contract with non-null storage slot at position 1 - '0x1', - '0x10afdf1', - '0x10afdf1' - ], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw error for too few params', - params: ['0x93Ae8aab337E58A6978E166f8132F59652cA6C56', '0x1'], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw error for invalid address', - params: ['0x-123', '0x1', '0x10afdf1'], - expectedError: JSONRPCInternalError - }, - { - description: 'Should throw error for invalid slot', - params: ['0x-123', `0x${'0'.repeat(65)}1`, '0x10afdf1'], - expectedError: JSONRPCInternalError - } -]; - -export { ethGetStorageAtTestCases, invalidEthGetStorageAtTestCases }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockHashAndIndex.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockHashAndIndex.testnet.test.ts deleted file mode 100644 index 78af15118..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/eth_getTransactionByBlockHashAndIndex.testnet.test.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - ethGetTransactionByBlockHashAndIndexTestCases, - invalidEthGetTransactionByBlockHashAndIndexTestCases -} from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getTransactionByBlockHashAndIndex' method - * - * @group integration/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex - */ -describe('RPC Mapper - eth_getTransactionByBlockHashAndIndex method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getTransactionByBlockHashAndIndex RPC call tests - Positive cases - */ - describe('eth_getTransactionByBlockHashAndIndex - Positive cases', () => { - /** - * Test cases where the rpc method call does not throw an error - */ - ethGetTransactionByBlockHashAndIndexTestCases.forEach( - ({ description, params, expected }) => { - test(description, async () => { - const rpcCall = - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionByBlockHashAndIndex - ](params); - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - }); - - /** - * eth_getTransactionByBlockHashAndIndex RPC call tests - Negative cases - */ - describe('eth_getTransactionByBlockHashAndIndex - Negative cases', () => { - /** - * Test cases where the rpc method call throws an error - */ - invalidEthGetTransactionByBlockHashAndIndexTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - await expect( - RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionByBlockHashAndIndex - ](params) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/fixture.ts deleted file mode 100644 index a9f3d178b..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockHashAndIndex/fixture.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * Positive test cases for eth_getTransactionByBlockHashAndIndex - */ -const ethGetTransactionByBlockHashAndIndexTestCases = [ - { - description: 'eth_getTransactionByBlockHashAndIndex with valid params', - params: [ - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - '0x1' - ], - expected: { - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0xbd30', - chainId: '0x186aa', - hash: '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - nonce: '0x176bbcbf79a3a672', - transactionIndex: '0x1', - input: '0x799161d500000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - } - }, - { - description: - "eth_getTransactionByBlockHashAndIndex with a hash that doesn't exist", - params: [ - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - '0x0' - ], - expected: { - accessList: [], - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - chainId: '0x186aa', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x7436', - gasPrice: '0x0', - hash: '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded', - input: '0xd547741f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - nonce: '0xb8314776ce0bf5df', - r: '0x0', - s: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - transactionIndex: '0x0', - type: '0x0', - v: '0x0', - value: '0x0', - yParity: '0x0' - } - }, - { - description: - "eth_getTransactionByBlockHashAndIndex with a hash that doesn't exist", - params: [ - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - '0x0' - ], - expected: null - } -]; - -/** - * Negative test cases for eth_getTransactionByBlockHashAndIndex - */ -const invalidEthGetTransactionByBlockHashAndIndexTestCases = [ - { - description: - 'eth_getTransactionByBlockHashAndIndex with an invalid hash', - params: ['0x123', '0x0'], - expectedError: JSONRPCInternalError - }, - { - description: - 'eth_getTransactionByBlockHashAndIndex with an invalid index', - params: [ - '0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35', - '0xf' - ], - expectedError: JSONRPCInternalError - }, - { - description: - 'eth_getTransactionByBlockHashAndIndex with too many params', - params: ['0x123', '0x123', '0x123'], - expectedError: JSONRPCInvalidParams - }, - { - description: - 'eth_getTransactionByBlockHashAndIndex with too few params', - params: ['0x123'], - expectedError: JSONRPCInvalidParams - }, - { - description: - 'eth_getTransactionByBlockHashAndIndex with invalid param type', - params: ['0x123', 123], - expectedError: JSONRPCInvalidParams - } -]; - -export { - ethGetTransactionByBlockHashAndIndexTestCases, - invalidEthGetTransactionByBlockHashAndIndexTestCases -}; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.testnet.test.ts deleted file mode 100644 index 62958f7ae..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/eth_getTransactionByBlockNumberAndIndex.testnet.test.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - ethGetTransactionByBlockNumberAndIndexTestCases, - invalidEthGetTransactionByBlockNumberAndIndexTestCases -} from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getTransactionByBlockNumberAndIndex' method - * - * @group integration/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex - */ -describe('RPC Mapper - eth_getTransactionByBlockNumberAndIndex method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getTransactionByBlockNumberAndIndex RPC call tests - Positive cases - */ - describe('eth_getTransactionByBlockNumberAndIndex - Positive cases', () => { - /** - * Test cases where the rpc method call does not throw an error - */ - ethGetTransactionByBlockNumberAndIndexTestCases.forEach( - ({ description, params, expected }) => { - test(description, async () => { - const rpcCall = - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionByBlockNumberAndIndex - ](params); - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - }); - - /** - * eth_getTransactionByBlockNumberAndIndex RPC call tests - Negative cases - */ - describe('eth_getTransactionByBlockNumberAndIndex - Negative cases', () => { - /** - * Test cases where the rpc method call throws an error - */ - invalidEthGetTransactionByBlockNumberAndIndexTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - await expect( - RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionByBlockNumberAndIndex - ](params) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/fixture.ts deleted file mode 100644 index 666d32464..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByBlockNumberAndIndex/fixture.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { HexInt } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * Positive test cases for eth_getTransactionByBlockNumberAndIndex - */ -const ethGetTransactionByBlockNumberAndIndexTestCases = [ - { - description: 'eth_getTransactionByBlockHashAndIndex with valid params', - params: [HexInt.of(17529453).toString(), '0x1'], - expected: { - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0xbd30', - chainId: '0x186aa', - hash: '0x6994801b6f92f9a0a151ab4ac1c27d2dcf2ab61245b10ddf05504ae5384e759d', - nonce: '0x176bbcbf79a3a672', - transactionIndex: '0x1', - input: '0x799161d500000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - value: '0x0', - gasPrice: '0x0', - type: '0x0', - v: '0x0', - r: '0x0', - s: '0x0', - accessList: [], - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - yParity: '0x0' - } - }, - { - description: - "eth_getTransactionByBlockHashAndIndex with a hash that doesn't exist", - params: [HexInt.of(17529453).toString(), '0x0'], - expected: { - accessList: [], - blockHash: - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - blockNumber: '0x10b7a6d', - chainId: '0x186aa', - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x7436', - gasPrice: '0x0', - hash: '0xd331443a31ef1f32e2c4510710e62561012de11ef404c35086629436e4d5dded', - input: '0xd547741f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84800000000000000000000000042f51a1de771c41157be6129ba7b1756da2f8290', - maxFeePerGas: '0x0', - maxPriorityFeePerGas: '0x0', - nonce: '0xb8314776ce0bf5df', - r: '0x0', - s: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - transactionIndex: '0x0', - type: '0x0', - v: '0x0', - value: '0x0', - yParity: '0x0' - } - }, - { - description: 'eth_getTransactionByBlockHashAndIndex should return null', - params: [HexInt.of(0).toString(), '0x0'], - expected: null - } -]; - -const invalidEthGetTransactionByBlockNumberAndIndexTestCases = [ - { - description: 'Should throw an error when there are too many params', - params: ['0x0', '0x0', 'Extra param'], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when first param is not a string', - params: [0, '0x0'], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when second param is not a strin', - params: ['0x0', 0], - expectedError: JSONRPCInvalidParams - }, - { - description: 'Should throw an error when first param is invalid', - params: [ - '0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35', - '0x0' - ], - expectedError: JSONRPCInternalError - } -]; - -export { - ethGetTransactionByBlockNumberAndIndexTestCases, - invalidEthGetTransactionByBlockNumberAndIndexTestCases -}; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByHash/eth_getTransactionByHash.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByHash/eth_getTransactionByHash.testnet.test.ts deleted file mode 100644 index f04514b60..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByHash/eth_getTransactionByHash.testnet.test.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - ethGetTransactionByHashTestCases, - invalidEthGetTransactionByHashTestCases -} from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getTransactionByHash' method - * - * @group integration/rpc-mapper/methods/eth_getTransactionByHash - */ -describe('RPC Mapper - eth_getTransactionByHash method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getTransactionByHash RPC call tests - Positive cases - */ - describe('eth_getTransactionByHash - Positive cases', () => { - /** - * Test cases where the rpc method call does not throw an error - */ - ethGetTransactionByHashTestCases.forEach( - ({ description, params, expected }) => { - test(description, async () => { - const rpcCall = - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionByHash - ](params); - expect(rpcCall).toStrictEqual(expected); - }); - } - ); - }); - - /** - * eth_getTransactionByHash RPC call tests - Negative cases - */ - describe('eth_getTransactionByHash - Negative cases', () => { - /** - * Test cases where the rpc method call throws an error - */ - invalidEthGetTransactionByHashTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - await expect( - RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionByHash - ](params) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByHash/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByHash/fixture.ts deleted file mode 100644 index 4464531c0..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionByHash/fixture.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Hex, ZERO_BYTES } from '@vechain/sdk-core'; -import { - validTransactionDetailTestnet, - validTransactionHashTestnet -} from '../../../fixture'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * Positive test cases for eth_getTransactionByHash - */ -const ethGetTransactionByHashTestCases = [ - { - description: 'eth_getTransactionByHash with a valid hash', - params: [validTransactionHashTestnet], - expected: validTransactionDetailTestnet - }, - { - description: "eth_getTransactionByHash with a hash that doesn't exist", - params: [Hex.of(ZERO_BYTES(32)).toString()], - expected: null - } -]; - -/** - * Negative test cases for eth_getTransactionByHash - */ -const invalidEthGetTransactionByHashTestCases = [ - { - description: 'eth_getTransactionByHash with an invalid hash', - params: ['0x123'], - expectedError: JSONRPCInternalError - }, - { - description: 'eth_getTransactionByHash with too many params', - params: ['0x123', '0x123'], - expectedError: JSONRPCInvalidParams - }, - { - description: 'eth_getTransactionByHash with too few params', - params: [], - expectedError: JSONRPCInvalidParams - }, - { - description: 'eth_getTransactionByHash with invalid param type', - params: [123], - expectedError: JSONRPCInvalidParams - } -]; - -export { - ethGetTransactionByHashTestCases, - invalidEthGetTransactionByHashTestCases -}; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionCount/eth_getTransactionCount.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionCount/eth_getTransactionCount.testnet.test.ts deleted file mode 100644 index 30543f239..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionCount/eth_getTransactionCount.testnet.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { invalidEthGetTransactionCountTestCases } from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getTransactionCount' method - * - * @group integration/rpc-mapper/methods/eth_getTransactionCount - */ -describe('RPC Mapper - eth_getTransactionCount method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getTransactionCount RPC call tests - Positive cases - */ - describe('eth_getTransactionCount - Positive cases', () => { - /** - * Positive case 1 - Get a random nonce (@note different from Ethereum) - */ - test('eth_getTransactionCount - get a random nonce', async () => { - // Random nonce - const transactionCount = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionCount - ](['0x0b41c56e19c5151122568873a039fEa090937Fe2', 'latest']); - expect(transactionCount).toBeDefined(); - }); - }); - - /** - * eth_getTransactionCount RPC call tests - Negative cases - */ - describe('eth_getTransactionCount - Negative cases', () => { - /** - * Invalid params case 1 - Missing params - */ - invalidEthGetTransactionCountTestCases.forEach( - ({ description, params, expectedError }) => { - test(description, async () => { - await expect( - RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionCount - ](params) - ).rejects.toThrowError(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionCount/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionCount/fixture.ts deleted file mode 100644 index f7fe66fe8..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionCount/fixture.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * Negative test cases for eth_getTransactionCount - */ -const invalidEthGetTransactionCountTestCases = [ - { - description: 'eth_getTransactionCount - Missing params', - params: [], - expectedError: JSONRPCInvalidParams - }, - { - description: - 'eth_getTransactionCount - Invalid address param AND params number', - params: ['0xINVALID_ADDRESS'], - expectedError: JSONRPCInvalidParams - }, - { - description: 'eth_getTransactionCount - Invalid address format', - params: ['0xINVALID_ADDDRESS', 'latest'], - expectedError: JSONRPCInvalidParams - } -]; - -export { invalidEthGetTransactionCountTestCases }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.mock.testnet.test.ts deleted file mode 100644 index a6b7c4c41..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.mock.testnet.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { getReceiptCorrectCasesTestNetwork } from './fixture'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_getTransactionReceipt' method - * - * @group integration/rpc-mapper/methods/eth_getTransactionReceipt - */ -describe('RPC Mapper - eth_getTransactionReceipt method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getTransactionReceipt RPC call tests - Negative cases - */ - describe('eth_getTransactionReceipt - Negative cases', () => { - /** - * Negative case 1 - An error occurs while retrieving the transaction receipt - */ - test('eth_getTransactionReceipt - negative case 1', async () => { - // Mock the getTransactionReceipt method to throw an error - jest.spyOn( - thorClient.transactions, - 'getTransactionReceipt' - ).mockRejectedValue(new Error()); - - // Call eth_getTransactionReceipt with a valid transaction hash BUT an error occurs while retrieving the transaction receipt - await expect( - RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionReceipt - ]([getReceiptCorrectCasesTestNetwork[0].hash]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Negative case 2 - Transaction details of existing transaction are not found (returns null) - */ - test('eth_getTransactionReceipt - negative case 2', async () => { - // Mock the getTransactionReceipt method to throw an error - jest.spyOn( - thorClient.transactions, - 'getTransaction' - ).mockResolvedValue(null); - - // Call eth_getTransactionReceipt with a valid transaction hash BUT an error occurs while retrieving the transaction receipt - const receipt = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionReceipt - ]([getReceiptCorrectCasesTestNetwork[0].hash]); - expect(receipt).toBe(null); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.solo.test.ts deleted file mode 100644 index 169993d6b..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.solo.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; -import { getReceiptCorrectCasesSoloNetwork } from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getTransactionReceipt' method - * - * @group integration/rpc-mapper/methods/eth_getTransactionReceipt - */ -describe('RPC Mapper - eth_getTransactionReceipt method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_getTransactionReceipt RPC call tests - Positive cases - */ - describe('eth_getTransactionReceipt - Positive cases', () => { - /** - * Positive cases - Solo network - */ - getReceiptCorrectCasesSoloNetwork.forEach((testCase) => { - test( - testCase.testCase, - async () => { - const receipt = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionReceipt - ]([testCase.hash]); - - expect(receipt).toEqual(testCase.expected); - }, - 7000 - ); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.testnet.test.ts deleted file mode 100644 index 8d42520f9..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/eth_getTransactionReceipt.testnet.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - getReceiptCorrectCasesTestNetwork, - getReceiptIncorrectCasesTestNetwork -} from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_getTransactionReceipt' method - * - * @group integration/rpc-mapper/methods/eth_getTransactionReceipt - */ -describe('RPC Mapper - eth_getTransactionReceipt method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getTransactionReceipt RPC call tests - Positive cases - */ - describe('eth_getTransactionReceipt - Positive cases', () => { - /** - * Positive cases - Test network - */ - getReceiptCorrectCasesTestNetwork.forEach((testCase) => { - test( - testCase.testCase, - async () => { - const receipt = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionReceipt - ]([testCase.hash]); - - expect(receipt).toEqual(testCase.expected); - }, - 7000 - ); - }); - }); - - /** - * eth_getTransactionReceipt RPC call tests - Negative cases - */ - describe('eth_getTransactionReceipt - Negative cases', () => { - /** - * Negative cases - Test network - */ - getReceiptIncorrectCasesTestNetwork.forEach((fixture) => { - test( - fixture.testCase, - async () => { - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getTransactionReceipt - ](fixture.params) - ).rejects.toThrowError(fixture.expectedError); - }, - 7000 - ); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/fixture.ts deleted file mode 100644 index 231cb4307..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getTransactionReceipt/fixture.ts +++ /dev/null @@ -1,241 +0,0 @@ -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * Fixture for eth_getTransactionReceipt correct cases for solo network - */ -const getReceiptCorrectCasesSoloNetwork = [ - { - testCase: - 'eth_getTransactionReceipt - Should return correct transaction receipt - test case 1, a block with 10 transactions', - hash: '0x4836db989f9072035586451ead35eb8a4ff5d2d4ce1996d7a550bdcb71a769f2', // Number 5 (index 4) into the block 2 - expected: { - blockHash: - '0x0000000235cb882736526a29a3456eea7bfc26117c8cb0d815828baf760c7eb5', - blockNumber: '0x2', - contractAddress: null, - from: '0xabef6032b9176c186f6bf984f548bda53349f70a', - gasUsed: '0x1087e', - logs: [ - { - blockHash: - '0x0000000235cb882736526a29a3456eea7bfc26117c8cb0d815828baf760c7eb5', - blockNumber: '0x2', - transactionHash: - '0x4836db989f9072035586451ead35eb8a4ff5d2d4ce1996d7a550bdcb71a769f2', - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x000000000000000000000000abef6032b9176c186f6bf984f548bda53349f70a', - '0x000000000000000000000000062f167a905c1484de7e75b88edc7439f82117de' - ], - data: '0x0000000000000000000000000000000000000000019d971e4fe8401e74000000', - removed: false, - transactionIndex: '0x4', - logIndex: '0x4' - } - ], - status: '0x1', - to: '0x0000000000000000000000000000456e65726779', - transactionHash: - '0x4836db989f9072035586451ead35eb8a4ff5d2d4ce1996d7a550bdcb71a769f2', - transactionIndex: '0x4', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - type: '0x0' - } - }, - { - testCase: - 'eth_getTransactionReceipt - Should return correct transaction receipt - test case 1, a block with 1 transaction', - hash: '0x0a12d014783c36df12c30a02e801a76f3268cf3bc31e9ce0f667fa650d7bd6a1', // Number 1 (index 0) into the block 3 - expected: { - blockHash: - '0x00000003bdba35183f812d586dccdcb37fd0b0e9b4f419581a6d519a7cc71d7e', - blockNumber: '0x3', - contractAddress: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - from: '0xf02f557c753edf5fcdcbfe4c1c3a448b3cc84d54', - gasUsed: '0x2a6487', - logs: [ - { - blockHash: - '0x00000003bdba35183f812d586dccdcb37fd0b0e9b4f419581a6d519a7cc71d7e', - blockNumber: '0x3', - transactionHash: - '0x0a12d014783c36df12c30a02e801a76f3268cf3bc31e9ce0f667fa650d7bd6a1', - address: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - topics: [ - '0xb35bf4274d4295009f1ec66ed3f579db287889444366c03d3a695539372e8951' - ], - data: '0x000000000000000000000000f02f557c753edf5fcdcbfe4c1c3a448b3cc84d54', - removed: false, - transactionIndex: '0x0', - logIndex: '0x0' - } - ], - status: '0x1', - to: null, - transactionHash: - '0x0a12d014783c36df12c30a02e801a76f3268cf3bc31e9ce0f667fa650d7bd6a1', - transactionIndex: '0x0', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - type: '0x0' - } - } -]; - -/** - * Fixture for eth_getTransactionReceipt correct cases for test network - */ -const getReceiptCorrectCasesTestNetwork = [ - { - testCase: - 'eth_getTransactionReceipt - Should return correct transaction receipt - test case 1, reverted transaction', - hash: '0xfcee8fa4c325e3b35cf7a726db2a455fa8a0e8c84809ba0123487428f70ef7d2', // Simple reverted transaction - expected: { - blockHash: - '0x010be0ce812bed2ef355b0163ec1d21ceb10f10573c45a7e5a24ef0c00b23181', - blockNumber: '0x10be0ce', - contractAddress: null, - from: '0x4383ce6813f49438b7d9a9716a4bb799d83cf116', - gasUsed: '0x698f', - logs: [], - status: '0x0', - to: '0x9395baa47082552592f9cef61c2a1f068bd2af8f', - transactionHash: - '0xfcee8fa4c325e3b35cf7a726db2a455fa8a0e8c84809ba0123487428f70ef7d2', - transactionIndex: '0x0', - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - type: '0x0' - } - }, - { - testCase: - 'eth_getTransactionReceipt - Should return correct transaction receipt - test case 2, multiple logs', - hash: '0x5144c9150768535d1b4263ffe7f1756b2e2e06020ccb9cf7c5b7dc996ce92276', - expected: { - blockHash: - '0x0114b4a1182a9103113a4052b2d08e7785ea74901c6974f16661d352202d7bf6', - blockNumber: '0x114b4a1', - contractAddress: null, - cumulativeGasUsed: '0x0', - effectiveGasPrice: '0x0', - from: '0x16e3f269c3fb5dcc5844e0e5e7f8bf16270e9755', - gasUsed: '0x202e4', - logs: [ - { - address: '0xac0ca2a5148e15ef913f9f5cf8eb3cf763f5a43f', - blockHash: - '0x0114b4a1182a9103113a4052b2d08e7785ea74901c6974f16661d352202d7bf6', - blockNumber: '0x114b4a1', - data: '0x0000000000000000000000000000000000000000000000024808a928fe542eed', - logIndex: '0x1', - removed: false, - topics: [ - '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', - '0x00000000000000000000000016e3f269c3fb5dcc5844e0e5e7f8bf16270e9755', - '0x0000000000000000000000009df69ad8ff89063869e04164a11579c0a8532e84' - ], - transactionHash: - '0x5144c9150768535d1b4263ffe7f1756b2e2e06020ccb9cf7c5b7dc996ce92276', - transactionIndex: '0x1' - }, - { - address: '0x9df69ad8ff89063869e04164a11579c0a8532e84', - blockHash: - '0x0114b4a1182a9103113a4052b2d08e7785ea74901c6974f16661d352202d7bf6', - blockNumber: '0x114b4a1', - data: '0x0000000000000000000000000000000000000000000000024808a928fe542eed', - logIndex: '0x2', - removed: false, - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000000000000000000000000000000000000000000000', - '0x00000000000000000000000016e3f269c3fb5dcc5844e0e5e7f8bf16270e9755' - ], - transactionHash: - '0x5144c9150768535d1b4263ffe7f1756b2e2e06020ccb9cf7c5b7dc996ce92276', - transactionIndex: '0x1' - }, - { - address: '0x9df69ad8ff89063869e04164a11579c0a8532e84', - blockHash: - '0x0114b4a1182a9103113a4052b2d08e7785ea74901c6974f16661d352202d7bf6', - blockNumber: '0x114b4a1', - data: '0x0000000000000000000000000000000000000000000000043c47d85f5fdafe3d000000000000000000000000000000000000000000000006845081885e2f2d2a', - logIndex: '0x3', - removed: false, - topics: [ - '0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724', - '0x00000000000000000000000016e3f269c3fb5dcc5844e0e5e7f8bf16270e9755' - ], - transactionHash: - '0x5144c9150768535d1b4263ffe7f1756b2e2e06020ccb9cf7c5b7dc996ce92276', - transactionIndex: '0x1' - }, - { - address: '0xac0ca2a5148e15ef913f9f5cf8eb3cf763f5a43f', - blockHash: - '0x0114b4a1182a9103113a4052b2d08e7785ea74901c6974f16661d352202d7bf6', - blockNumber: '0x114b4a1', - data: '0x0000000000000000000000000000000000000000000000024808a928fe542eed', - logIndex: '0x4', - removed: false, - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x00000000000000000000000016e3f269c3fb5dcc5844e0e5e7f8bf16270e9755', - '0x0000000000000000000000009df69ad8ff89063869e04164a11579c0a8532e84' - ], - transactionHash: - '0x5144c9150768535d1b4263ffe7f1756b2e2e06020ccb9cf7c5b7dc996ce92276', - transactionIndex: '0x1' - } - ], - logsBloom: - '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - status: '0x1', - to: '0xac0ca2a5148e15ef913f9f5cf8eb3cf763f5a43f', - transactionHash: - '0x5144c9150768535d1b4263ffe7f1756b2e2e06020ccb9cf7c5b7dc996ce92276', - transactionIndex: '0x1', - type: '0x0' - } - }, - { - testCase: - 'eth_getTransactionReceipt - Should return correct transaction receipt - test case 3, reverted transaction', - hash: '0x0000000000000000000000000b2a455fa8000000000000000000000000000000', // Simple null transaction - expected: null - } -]; - -/** - * Fixture for eth_getTransactionReceipt incorrect cases for test network - */ -const getReceiptIncorrectCasesTestNetwork = [ - { - testCase: - 'eth_getTransactionReceipt - Should throw error for invalid params length', - params: [], - expectedError: JSONRPCInvalidParams - }, - { - testCase: - 'eth_getTransactionReceipt - Should throw error for invalid transaction id', - params: ['0x_INVALID_TRANSACTION_ID'], - expectedError: JSONRPCInvalidParams - } -]; - -export { - getReceiptCorrectCasesSoloNetwork, - getReceiptCorrectCasesTestNetwork, - getReceiptIncorrectCasesTestNetwork -}; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.testnet.test.ts deleted file mode 100644 index 09cce02f2..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex/eth_getUncleByBlockHashAndIndex.testnet.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_getUncleByBlockHashAndIndex' method - * - * @group integration/rpc-mapper/methods/eth_getUncleByBlockHashAndIndex - */ -describe('RPC Mapper - eth_getUncleByBlockHashAndIndex method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getUncleByBlockHashAndIndex RPC call tests - Positive cases - */ - describe('eth_getUncleByBlockHashAndIndex - Positive cases', () => { - /** - * Should return uncle block at the given block hash and index - */ - test('Should return uncle block at the given block hash and index', async () => { - const uncleBlock = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleByBlockHashAndIndex - ]([ - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450', - '0x0' - ]); - - expect(uncleBlock).toStrictEqual(null); - }); - }); - - /** - * eth_getUncleByBlockHashAndIndex RPC call tests - Negative cases - */ - describe('eth_getUncleByBlockHashAndIndex - Negative cases', () => { - /** - * Should NOT be able to return uncle block at the given block hash and index with invalid params - */ - test('Should NOT be able to return uncle block at the given block hash and index with invalid params', async () => { - // No params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleByBlockHashAndIndex - ]([]) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Only 1 param - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleByBlockHashAndIndex - ](['latest']) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Invalid params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleByBlockHashAndIndex - ](['latest', 1]) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.testnet.test.ts deleted file mode 100644 index 4c33050b6..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex/eth_getUncleByBlockNumberAndIndex.testnet.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_getUncleByBlockNumberAndIndex' method - * - * @group integration/rpc-mapper/methods/eth_getUncleByBlockNumberAndIndex - */ -describe('RPC Mapper - eth_getUncleByBlockNumberAndIndex method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getUncleByBlockNumberAndIndex RPC call tests - Positive cases - */ - describe('eth_getUncleByBlockNumberAndIndex - Positive cases', () => { - /** - * Should return uncle block at the given block number and index - */ - test('Should return uncle block at the given block number and index', async () => { - const uncleBlock = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleByBlockNumberAndIndex - ](['latest', '0x0']); - - expect(uncleBlock).toStrictEqual(null); - }); - }); - - /** - * eth_getUncleByBlockNumberAndIndex RPC call tests - Negative cases - */ - describe('eth_getUncleByBlockNumberAndIndex - Negative cases', () => { - /** - * Should NOT be able to return uncle block at the given block number and index with invalid params - */ - test('Should NOT be able to return uncle block at the given block number and index with invalid params', async () => { - // No params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleByBlockNumberAndIndex - ]([]) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Only 1 param - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleByBlockNumberAndIndex - ](['latest']) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Invalid params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleByBlockNumberAndIndex - ](['latest', 1]) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockHash/eth_getUncleCountByBlockHash.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockHash/eth_getUncleCountByBlockHash.testnet.test.ts deleted file mode 100644 index c669e46c7..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockHash/eth_getUncleCountByBlockHash.testnet.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_getUncleCountByBlockHash' method - * - * @group integration/rpc-mapper/methods/eth_getUncleCountByBlockHash - */ -describe('RPC Mapper - eth_getUncleCountByBlockHash method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getUncleCountByBlockHash RPC call tests - Positive cases - */ - describe('eth_getUncleCountByBlockHash - Positive cases', () => { - /** - * Should return uncle block count at the given block hash - */ - test('Should return uncle block count at the given block hash', async () => { - const uncleBlock = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleCountByBlockHash - ]([ - '0x010b7a6d6f04407ac2f72e505ff83d49db8d01607f8af41f508b2ca7eca0d450' - ]); - - expect(uncleBlock).toStrictEqual(0); - }); - }); - - /** - * eth_getUncleCountByBlockHash RPC call tests - Negative cases - */ - describe('eth_getUncleCountByBlockHash - Negative cases', () => { - /** - * Should NOT be able to return uncle block count at the given block hash - */ - test('Should NOT be able to return uncle block count at the given block hash', async () => { - // No params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleCountByBlockHash - ]([]) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Invalid params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleCountByBlockHash - ](['latest', 1]) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockHash/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockHash/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockNumber/eth_getUncleCountByBlockNumber.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockNumber/eth_getUncleCountByBlockNumber.testnet.test.ts deleted file mode 100644 index bb3333214..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockNumber/eth_getUncleCountByBlockNumber.testnet.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_getUncleCountByBlockNumber' method - * - * @group integration/rpc-mapper/methods/eth_getUncleCountByBlockNumber - */ -describe('RPC Mapper - eth_getUncleCountByBlockNumber method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getUncleCountByBlockNumber RPC call tests - Positive cases - */ - describe('eth_getUncleCountByBlockNumber - Positive cases', () => { - /** - * Should return uncle block count at the given block number - */ - test('Should return uncle block count at the given block number', async () => { - const uncleBlock = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleCountByBlockNumber - ](['latest']); - - expect(uncleBlock).toStrictEqual(0); - }); - }); - - /** - * eth_getUncleCountByBlockNumber RPC call tests - Negative cases - */ - describe('eth_getUncleCountByBlockNumber - Negative cases', () => { - /** - * Should NOT be able to return uncle block count at the given block number - */ - test('Should NOT be able to return uncle block count at the given block number', async () => { - // No params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleCountByBlockNumber - ]([]) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Invalid params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_getUncleCountByBlockNumber - ](['latest', 1]) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockNumber/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getUncleCountByBlockNumber/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getWork/eth_getWork.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getWork/eth_getWork.testnet.test.ts deleted file mode 100644 index 51129b83d..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_getWork/eth_getWork.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_getWork' method - * - * @group integration/rpc-mapper/methods/eth_getWork - */ -describe('RPC Mapper - eth_getWork method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_getWork RPC call tests - Positive cases - */ - describe('eth_getWork - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_getWork - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_getWork]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_getWork/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_getWork/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_hashrate/eth_hashrate.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_hashrate/eth_hashrate.testnet.test.ts deleted file mode 100644 index 1614c3bb0..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_hashrate/eth_hashrate.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_hashrate' method - * - * @group integration/rpc-mapper/methods/eth_hashrate - */ -describe('RPC Mapper - eth_hashrate method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_hashrate RPC call tests - Positive cases - */ - describe('eth_hashrate - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_hashrate - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_hashrate]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_hashrate/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_hashrate/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_maxPriorityFeePerGas/eth_maxPriorityFeePerGas.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_maxPriorityFeePerGas/eth_maxPriorityFeePerGas.testnet.test.ts deleted file mode 100644 index bc44f2860..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_maxPriorityFeePerGas/eth_maxPriorityFeePerGas.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_maxPriorityFeePerGas' method - * - * @group integration/rpc-mapper/methods/eth_maxPriorityFeePerGas - */ -describe('RPC Mapper - eth_maxPriorityFeePerGas method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_maxPriorityFeePerGas RPC call tests - Positive cases - */ - describe('eth_maxPriorityFeePerGas - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_maxPriorityFeePerGas - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_maxPriorityFeePerGas - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_maxPriorityFeePerGas/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_maxPriorityFeePerGas/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_mining/eth_mining.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_mining/eth_mining.testnet.test.ts deleted file mode 100644 index 228ae2c98..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_mining/eth_mining.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_mining' method - * - * @group integration/rpc-mapper/methods/eth_mining - */ -describe('RPC Mapper - eth_mining method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_mining RPC call tests - Positive cases - */ - describe('eth_mining - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_mining - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_mining]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_mining/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_mining/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_newBlockFilter/eth_newBlockFilter.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_newBlockFilter/eth_newBlockFilter.testnet.test.ts deleted file mode 100644 index 5bbf77864..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_newBlockFilter/eth_newBlockFilter.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_newBlockFilter' method - * - * @group integration/rpc-mapper/methods/eth_newBlockFilter - */ -describe('RPC Mapper - eth_newBlockFilter method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_newBlockFilter RPC call tests - Positive cases - */ - describe('eth_newBlockFilter - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_newBlockFilter - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_newBlockFilter]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_newBlockFilter/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_newBlockFilter/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_newFilter/eth_newFilter.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_newFilter/eth_newFilter.testnet.test.ts deleted file mode 100644 index 2df38ce8d..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_newFilter/eth_newFilter.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_newFilter' method - * - * @group integration/rpc-mapper/methods/eth_newFilter - */ -describe('RPC Mapper - eth_newFilter method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_newFilter RPC call tests - Positive cases - */ - describe('eth_newFilter - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_newFilter - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_newFilter]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_newFilter/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_newFilter/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_newPendingTransactionFilter/eth_newPendingTransactionFilter.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_newPendingTransactionFilter/eth_newPendingTransactionFilter.testnet.test.ts deleted file mode 100644 index 48817fd5a..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_newPendingTransactionFilter/eth_newPendingTransactionFilter.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_newPendingTransactionFilter' method - * - * @group integration/rpc-mapper/methods/eth_newPendingTransactionFilter - */ -describe('RPC Mapper - eth_newPendingTransactionFilter method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_newPendingTransactionFilter RPC call tests - Positive cases - */ - describe('eth_newPendingTransactionFilter - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_newPendingTransactionFilter - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_newPendingTransactionFilter - ]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_newPendingTransactionFilter/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_newPendingTransactionFilter/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_protocolVersion/eth_protocolVersion.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_protocolVersion/eth_protocolVersion.testnet.test.ts deleted file mode 100644 index 97eac8a65..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_protocolVersion/eth_protocolVersion.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_protocolVersion' method - * - * @group integration/rpc-mapper/methods/eth_protocolVersion - */ -describe('RPC Mapper - eth_protocolVersion method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_protocolVersion RPC call tests - Positive cases - */ - describe('eth_protocolVersion - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_protocolVersion - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_protocolVersion]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_protocolVersion/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_protocolVersion/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_requestAccounts/eth_requestAccounts.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_requestAccounts/eth_requestAccounts.solo.test.ts deleted file mode 100644 index 5d9ad5b78..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_requestAccounts/eth_requestAccounts.solo.test.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - type ProviderInternalWallet, - type ProviderInternalWalletAccount, - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient, - VeChainProvider -} from '../../../../../src'; -import { THOR_SOLO_ACCOUNTS_BASE_WALLET } from '../../../../fixture'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_requestAccounts' method - * - * @group integration/rpc-mapper/methods/eth_requestAccounts - */ -describe('RPC Mapper - eth_requestAccounts method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Provider instance - */ - let provider: VeChainProvider; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - - // Init provider - provider = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET as ProviderInternalWallet - ); - }); - - /** - * eth_requestAccounts RPC call tests - Positive cases - */ - describe('eth_requestAccounts - Positive cases', () => { - /** - * Positive case 1 - Should be able to get addresses from a NON-empty wallet - */ - test('eth_requestAccounts - Should be able to get addresses from a NON-empty wallet', async () => { - // Get accounts - Instead of using RPCMethodsMap, we can use provider directly - const accounts = (await provider.request({ - method: RPC_METHODS.eth_requestAccounts, - params: [] - })) as string[]; - - // Check if the accounts are the same - expect(accounts.length).toBeGreaterThan(0); - expect(accounts).toEqual( - THOR_SOLO_ACCOUNTS_BASE_WALLET.accounts.map( - (account: ProviderInternalWalletAccount) => account.address - ) - ); - }); - }); - - /** - * eth_requestAccounts RPC call tests - Negative cases - */ - describe('eth_requestAccounts - Negative cases', () => { - /** - * Negative case 1 - Should throw error if wallet is not given - */ - test('eth_requestAccounts - Should throw error if wallet is not given', async () => { - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_requestAccounts]([]) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Negative case 2 - Should throw error if wallet is given, but empty - */ - test('eth_requestAccounts - Should throw error if wallet is given, but empty', async () => { - // Error with empty wallet - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_requestAccounts]([]) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_requestAccounts/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_requestAccounts/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.mock.testnet.test.ts deleted file mode 100644 index 8b5bedde4..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.mock.testnet.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_sendRawTransaction' method - * - * @group integration/rpc-mapper/methods/eth_sendRawTransaction - */ -describe('RPC Mapper - eth_sendRawTransaction method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_sendRawTransaction RPC call tests - Negative cases - */ - describe('eth_sendRawTransaction - Negative cases', () => { - /** - * Test case where request fails - */ - test('Should throw `JSONRPCInternalError` when request fails', async () => { - // Mock the getBlock method to throw error - jest.spyOn( - thorClient.transactions, - 'sendRawTransaction' - ).mockRejectedValue(new Error()); - - await expect(async () => { - (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_sendRawTransaction - ](['0x123456789'])) as string; - }).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.solo.test.ts deleted file mode 100644 index ab3bd5cf7..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.solo.test.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - HexUInt, - Transaction, - type TransactionClause -} from '@vechain/sdk-core'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_ACCOUNTS, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_sendRawTransaction' method - * - * @group integration/rpc-mapper/methods/eth_sendRawTransaction - */ -describe('RPC Mapper - eth_sendRawTransaction method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_sendRawTransaction RPC call tests - Positive cases - */ - describe('eth_sendRawTransaction - Positive cases', () => { - /** - * Positive case 1 - Send a simple raw transaction - */ - test('eth_sendRawTransaction - Send a simple raw transaction', async () => { - // 1 - Init sender and receiver - - const actors = { - sender: THOR_SOLO_ACCOUNTS[1], - receiver: THOR_SOLO_ACCOUNTS[2] - }; - - // 2- Init transaction - - // Init clauses - const clauses: TransactionClause[] = [ - { - to: actors.receiver.address, - value: 1000000, - data: '0x' - } - ]; - - // Get latest block - const latestBlock = - await thorClient.blocks.getBestBlockCompressed(); - - // Estimate the gas required for the transfer transaction - const gasResult = await thorClient.gas.estimateGas( - clauses, - actors.sender.address - ); - - // Create transactions - const transactionBody = { - chainTag: 0xf6, - blockRef: - latestBlock !== null ? latestBlock.id.slice(0, 18) : '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 23456789 - }; - - // 2- Sign transaction - - const signedTransaction = Transaction.of(transactionBody).sign( - HexUInt.of(actors.sender.privateKey).bytes - ); - - const raw = HexUInt.of(signedTransaction.encoded).toString(); - - // 3 - Send raw transaction - - const result = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_sendRawTransaction - ]([raw])) as string; - - expect(result).toBe(signedTransaction.id.toString()); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.testnet.test.ts deleted file mode 100644 index 7284f0e35..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_sendRawTransaction/eth_sendRawTransaction.testnet.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_sendRawTransaction' method - * - * @group integration/rpc-mapper/methods/eth_sendRawTransaction-testnet - */ -describe('RPC Mapper - eth_sendRawTransaction method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_sendRawTransaction RPC call tests - Negative cases - */ - describe('eth_sendRawTransaction - Negative cases', () => { - /** - * Invalid params - Invalid params - params number - */ - test('eth_sendRawTransaction - Invalid params - params number', async () => { - await expect(async () => { - (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_sendRawTransaction - ]([])) as string; - }).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Invalid params - Invalid transaction decoded hex format - */ - test('eth_sendRawTransaction - Invalid transaction decoded hex format', async () => { - await expect(async () => { - (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_sendRawTransaction - ](['0xINVALID'])) as string; - }).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Invalid params - Invalid transaction decoded hex format - */ - test('eth_sendRawTransaction - Invalid transaction decoded', async () => { - await expect(async () => { - (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_sendRawTransaction - ](['0xcaffe'])) as string; - }).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_sendTransaction/eth_sendTransaction.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_sendTransaction/eth_sendTransaction.solo.test.ts deleted file mode 100644 index 86ed1be4b..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_sendTransaction/eth_sendTransaction.solo.test.ts +++ /dev/null @@ -1,306 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - THOR_SOLO_ACCOUNTS_BASE_WALLET, - THOR_SOLO_ACCOUNTS_BASE_WALLET_WITH_DELEGATOR -} from '../../../../fixture'; -import { - ProviderInternalBaseWallet, - RPC_METHODS, - THOR_SOLO_ACCOUNTS, - THOR_SOLO_URL, - ThorClient, - VeChainProvider -} from '../../../../../src'; -import { - delegatorPrivateKeyFixture, - THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE -} from './fixture'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; -import { HexUInt, Secp256k1 } from '@vechain/sdk-core'; - -/** - * RPC Mapper integration tests for 'eth_sendTransaction' method - * - * @group integration/rpc-mapper/methods/eth_sendTransaction - */ -describe('RPC Mapper - eth_sendTransaction method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Provider instance - */ - let provider: VeChainProvider; - let providerWithDelegator: VeChainProvider; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - - // Init provider - provider = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET - ); - - // Init provider with delegator - // @NOTE due to the fact we are testing on thor-solo, we can delegate ONLY with a private key! - providerWithDelegator = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET_WITH_DELEGATOR({ - delegatorPrivateKey: delegatorPrivateKeyFixture - }), - true - ); - }); - - /** - * eth_sendTransaction RPC call tests - Positive cases - */ - describe('eth_sendTransaction - Positive cases', () => { - /** - * Positive case 1 - Should be able to send a transaction (delegated or not) - */ - [true, false].forEach((delegated) => { - ['0x111', '0x222', '0x333'].forEach((value) => { - test(`eth_sendTransaction - Should be able to send a transaction with value ${value} - ${delegated ? 'delegated case' : 'not delegated case'}`, async () => { - // Get the provider to use depending on delegated or not - const providerToUse = delegated - ? providerWithDelegator - : provider; - - // Get the balance of the sender and the receiver before sending the transaction - const balanceSenderBefore = (await providerToUse.request({ - method: RPC_METHODS.eth_getBalance, - params: [ - THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .sender.address, - 'latest' - ] - })) as string; - const balanceReceiverBefore = (await providerToUse.request({ - method: RPC_METHODS.eth_getBalance, - params: [ - THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .receiver.address, - 'latest' - ] - })) as string; - - // Send a transaction - const transaction = (await providerToUse.request({ - method: RPC_METHODS.eth_sendTransaction, - params: [ - { - from: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .sender.address, - to: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .receiver.address, - value - } - ] - })) as string; - - // Wait for the transaction to be mined - const receipt = - await thorClient.transactions.waitForTransaction( - transaction - ); - expect(receipt).toBeDefined(); - - // Get the balance of the sender and the receiver after sending the transaction - const balanceSenderAfter = (await providerToUse.request({ - method: RPC_METHODS.eth_getBalance, - params: [ - THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .sender.address, - 'latest' - ] - })) as string; - const balanceReceiverAfter = (await providerToUse.request({ - method: RPC_METHODS.eth_getBalance, - params: [ - THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .receiver.address, - 'latest' - ] - })) as string; - - // Compare the balances - expect(balanceSenderAfter).not.toEqual(balanceSenderBefore); - expect(balanceReceiverAfter).not.toEqual( - balanceReceiverBefore - ); - }); - }); - }); - - /** - * Positive case 2 - Should be able to send a transaction with undefined value - */ - test('eth_sendTransaction - Should be able to send a transaction with value undefined', async () => { - const from = THOR_SOLO_ACCOUNTS[18].address; - const to = THOR_SOLO_ACCOUNTS[19].address; - // Get the balance of the sender and the receiver before sending the transaction - const balanceSenderBefore = (await provider.request({ - method: RPC_METHODS.eth_getBalance, - params: [from, 'latest'] - })) as string; - const balanceReceiverBefore = (await provider.request({ - method: RPC_METHODS.eth_getBalance, - params: [to, 'latest'] - })) as string; - - // Send a transaction - const transaction = (await provider.request({ - method: RPC_METHODS.eth_sendTransaction, - params: [ - { - from, - to - } - ] - })) as string; - - // Wait for the transaction to be mined - const receipt = - await thorClient.transactions.waitForTransaction(transaction); - expect(receipt).toBeDefined(); - - // Get the balance of the sender and the receiver after sending the transaction - const balanceSenderAfter = (await provider.request({ - method: RPC_METHODS.eth_getBalance, - params: [from, 'latest'] - })) as string; - const balanceReceiverAfter = (await provider.request({ - method: RPC_METHODS.eth_getBalance, - params: [to, 'latest'] - })) as string; - - // Compare the balances (they will remain the same) - expect(balanceSenderAfter).toEqual(balanceSenderBefore); - expect(balanceReceiverAfter).toEqual(balanceReceiverBefore); - }); - - /** - * Positive case 2 - Should be able to send deploy a smart contract (undefined to field) - */ - test('eth_sendTransaction - Should be able to send deploy a smart contract', async () => { - // Send a transaction with to field as undefined - const transaction = (await provider.request({ - method: RPC_METHODS.eth_sendTransaction, - params: [ - { - from: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .sender.address - } - ] - })) as string; - - // Wait for the transaction to be mined - const receipt = - await thorClient.transactions.waitForTransaction(transaction); - expect(receipt).toBeDefined(); - }); - }); - - /** - * eth_sendTransaction RPC call tests - Negative cases - */ - describe('eth_sendTransaction - Negative cases', () => { - /** - * Negative case 1 - No from field in the transaction object - */ - test('eth_sendTransaction - Should throw error if to field is not defined', async () => { - // Send a transaction with to field as undefined - await expect( - async () => - await provider.request({ - method: RPC_METHODS.eth_sendTransaction, - params: [ - // One object with no 'from' field - {} - ] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Negative case 2 - A provider without a wallet - */ - test('eth_sendTransaction - Should throw error if the provider has not a wallet', async () => { - // Empty wallet provider - const providerWithoutWallet = new VeChainProvider(thorClient); - - // Send a transaction with invalid provider - await expect( - async () => - await providerWithoutWallet.request({ - method: RPC_METHODS.eth_sendTransaction, - params: [ - { - from: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .receiver.address - } - ] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Negative case 3 - Signer private key not found - */ - test('eth_sendTransaction - Should throw error if the provider has not a the signer private key into wallet', async () => { - // Empty wallet provider - const providerWithoutFromPrivateKey = new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([ - { - privateKey: HexUInt.of(THOR_SOLO_ACCOUNTS[0].privateKey) - .bytes, - publicKey: Secp256k1.derivePublicKey( - HexUInt.of(THOR_SOLO_ACCOUNTS[0].privateKey).bytes - ), - address: THOR_SOLO_ACCOUNTS[0].address - } - ]) - ); - - // Send a transaction with invalid provider - await expect( - async () => - await providerWithoutFromPrivateKey.request({ - method: RPC_METHODS.eth_sendTransaction, - params: [ - { - from: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .sender.address - } - ] - }) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Negative case 4 - Invalid input - */ - test('eth_sendTransaction - Should throw error if invalid input is given', async () => { - // Send a transaction with to field as undefined - await expect( - async () => - await provider.request({ - method: RPC_METHODS.eth_sendTransaction, - params: ['INVALID'] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_sendTransaction/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_sendTransaction/fixture.ts deleted file mode 100644 index 8acb706d1..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_sendTransaction/fixture.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { THOR_SOLO_ACCOUNTS } from '../../../../../src'; - -/** - * Thor solo accounts to use in the tests - */ -const THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE = { - sender: THOR_SOLO_ACCOUNTS[5], - receiver: THOR_SOLO_ACCOUNTS[6] -}; - -/** - * Fixture for a delegator private key - */ -const delegatorPrivateKeyFixture = THOR_SOLO_ACCOUNTS[4].privateKey; - -export { - THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE, - delegatorPrivateKeyFixture -}; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_sign/eth_sign.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_sign/eth_sign.testnet.test.ts deleted file mode 100644 index a890b04b1..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_sign/eth_sign.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_sign' method - * - * @group integration/rpc-mapper/methods/eth_sign - */ -describe('RPC Mapper - eth_sign method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_sign RPC call tests - Positive cases - */ - describe('eth_sign - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_sign - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_sign]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_sign/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_sign/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_signTransaction/eth_signTransaction.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_signTransaction/eth_signTransaction.testnet.test.ts deleted file mode 100644 index 8f24c4df2..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_signTransaction/eth_signTransaction.testnet.test.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - TESTNET_URL, - ThorClient, - VeChainProvider -} from '../../../../../src'; -import { - THOR_SOLO_ACCOUNTS_BASE_WALLET, - THOR_SOLO_ACCOUNTS_BASE_WALLET_WITH_DELEGATOR -} from '../../../../fixture'; -import { - delegatorPrivateKeyFixture, - THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE -} from '../eth_sendTransaction/fixture'; -import { Hex } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_signTransaction' method - * - * @group integration/rpc-mapper/methods/eth_signTransaction - */ -describe('RPC Mapper - eth_signTransaction method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Provider instance - */ - let provider: VeChainProvider; - let providerWithDelegator: VeChainProvider; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - - // Init provider - // @NOTE: Since we are testing the signature, we can use SOLO accounts with testnet! - provider = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET - ); - - // Init provider with delegator - // @NOTE due to the fact we are testing on thor-solo, we can delegate ONLY with a private key! - // @NOTE: Since we are testing the signature, we can use SOLO accounts with testnet! - providerWithDelegator = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET_WITH_DELEGATOR({ - delegatorPrivateKey: delegatorPrivateKeyFixture - }), - true - ); - }); - - /** - * eth_signTransaction RPC call tests - Positive cases - */ - describe('eth_signTransaction - Positive cases', () => { - const timeout = 15000; // 15 seconds - /** - * Should be able to sign transactions - */ - test( - 'Should be able to sign transactions', - async () => { - // Sign with the delegator OR not - for (const delegated of [true, false]) { - // Value field of the transaction objects to sign - for (const value of ['0x111', '0x222', '0x333']) { - // Get the provider to use depending on delegated or not - const providerToUse = delegated - ? providerWithDelegator - : provider; - - // Send a transaction - const signedTransaction = (await providerToUse.request({ - method: RPC_METHODS.eth_signTransaction, - params: [ - { - from: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .sender.address, - to: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .receiver.address, - value - } - ] - })) as string; - - // Signed transaction should be a hex string - expect(Hex.isValid0x(signedTransaction)).toBe(true); - } - } - }, - timeout - ); - }); - - /** - * eth_signTransaction RPC call tests - Negative cases - */ - describe('eth_signTransaction - Negative cases', () => { - /** - * Should be NOT able to sign transactions without a wallet/provider - */ - test('Should be NOT able to sign transactions without a wallet/provider', async () => { - // Provider without a wallet - const providerWithoutWallet = new VeChainProvider(thorClient); - - // Sign without a wallet - await expect( - providerWithoutWallet.request({ - method: RPC_METHODS.eth_signTransaction, - params: [ - { - from: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .sender.address, - to: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .receiver.address, - value: '0x111' - } - ] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Should be NOT able to sign transactions without the 'from' field - */ - test('Should be NOT able to sign transactions without the "from" field', async () => { - // Sign without the 'from' field - await expect( - provider.request({ - method: RPC_METHODS.eth_signTransaction, - params: [ - { - to: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .receiver.address, - value: '0x111' - } - ] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Should be NOT able to sign transactions with an invalid 'from' field - */ - test('Should be NOT able to sign transactions with an invalid "from" field', async () => { - // Sign with an invalid 'from' field - await expect( - provider.request({ - method: RPC_METHODS.eth_signTransaction, - params: [ - { - from: 'INVALID_ADDRESS', - to: THOR_SOLO_ACCOUNTS_ETH_SEND_TRANSACTION_FIXTURE - .receiver.address, - value: '0x111' - } - ] - }) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Should be NOT able to sign transactions with invalid input params - */ - test('Should be NOT able to sign transactions with invalid input params', async () => { - // Sign with invalid input params - await expect( - provider.request({ - method: RPC_METHODS.eth_signTransaction, - params: ['INVALID_PARAMS'] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_signTransaction/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_signTransaction/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.testnet.test.ts deleted file mode 100644 index b6d5251c4..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_signTypedData_v4/eth_signTypedData_v4.testnet.test.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - TESTNET_URL, - THOR_SOLO_ACCOUNTS, - ThorClient, - VeChainProvider -} from '../../../../../src'; -import { THOR_SOLO_ACCOUNTS_BASE_WALLET } from '../../../../fixture'; -import { Hex } from '@vechain/sdk-core'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; -import { eip712TestCases } from '../../../../signer/signers/vechain-private-key-signer/fixture'; - -/** - * RPC Mapper integration tests for 'eth_signTypedData_v4' method - * - * @group integration/rpc-mapper/methods/eth_signTypedData_v4 - */ -describe('RPC Mapper - eth_signTypedData_v4 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Provider instance - */ - let provider: VeChainProvider; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - - // Init provider - // @NOTE: Since we are testing the signature, we can use SOLO accounts with testnet! - provider = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET - ); - }); - - /** - * eth_signTypedData_v4 RPC call tests - Positive cases - */ - describe('eth_signTypedData_v4 - Positive cases', () => { - /** - * Should be able to sign a typed message - */ - test('Should be able to sign a typed message', async () => { - const signedTransaction = (await provider.request({ - method: RPC_METHODS.eth_signTypedData_v4, - params: [ - THOR_SOLO_ACCOUNTS[0].address, - { - domain: eip712TestCases.valid.domain, - types: eip712TestCases.valid.types, - message: eip712TestCases.valid.data, - primaryType: eip712TestCases.valid.primaryType - } - ] - })) as string; - - // Signed transaction should be a hex string - expect(Hex.isValid0x(signedTransaction)).toBe(true); - }); - }); - - /** - * eth_signTypedData_v4 RPC call tests - Negative cases - */ - describe('eth_signTypedData_v4 - Negative cases', () => { - /** - * Should be NOT able to sign an invalid typed message - */ - test('Should be NOT able to sign an invalid typed message', async () => { - await expect( - provider.request({ - method: RPC_METHODS.eth_signTypedData_v4, - params: [ - THOR_SOLO_ACCOUNTS[0].address, - { - domain: 'INVALID', - types: eip712TestCases.valid.types, - message: eip712TestCases.valid.data, - primaryType: eip712TestCases.valid.primaryType - } - ] - }) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Should be NOT able to sign a valid message without a wallet/provider - */ - test('Should be NOT able to sign a valid message without a wallet/provider', async () => { - // Provider without a wallet - const providerWithoutWallet = new VeChainProvider(thorClient); - - // Sign without a wallet - await expect( - providerWithoutWallet.request({ - method: RPC_METHODS.eth_signTypedData_v4, - params: [ - THOR_SOLO_ACCOUNTS[0].address, - { - domain: eip712TestCases.valid.domain, - types: eip712TestCases.valid.types, - message: eip712TestCases.valid.data, - primaryType: eip712TestCases.valid.primaryType - } - ] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Should be NOT able to sign an invalid structured message - */ - test('Should be NOT able to sign an invalid structured message', async () => { - // Sign without the 'from' field - await expect( - provider.request({ - method: RPC_METHODS.eth_signTypedData_v4, - params: [THOR_SOLO_ACCOUNTS[0].address] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Should be NOT able to sign the message without the address - */ - test('Should be NOT able to sign the message without the address', async () => { - await expect( - provider.request({ - method: RPC_METHODS.eth_signTypedData_v4, - params: [ - { - domain: eip712TestCases.valid.domain, - types: eip712TestCases.valid.types, - message: eip712TestCases.valid.data, - primaryType: eip712TestCases.valid.primaryType - } - ] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Should be NOT able to sign the message with invalid input params - */ - test('Should be NOT able to sign the message with invalid input params', async () => { - // Sign with invalid input params - await expect( - provider.request({ - method: RPC_METHODS.eth_signTypedData_v4, - params: ['INVALID_PARAMS'] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_submitWork/eth_submitWork.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_submitWork/eth_submitWork.testnet.test.ts deleted file mode 100644 index 435b34855..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_submitWork/eth_submitWork.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_submitWork' method - * - * @group integration/rpc-mapper/methods/eth_submitWork - */ -describe('RPC Mapper - eth_submitWork method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_submitWork RPC call tests - Positive cases - */ - describe('eth_submitWork - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_submitWork - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_submitWork]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_submitWork/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_submitWork/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_subscribe/eth_subscribe.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_subscribe/eth_subscribe.testnet.test.ts deleted file mode 100644 index f0309876f..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_subscribe/eth_subscribe.testnet.test.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { - afterEach, - beforeEach, - describe, - expect, - jest, - test -} from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient, - VeChainProvider -} from '../../../../../src'; -import { - JSONRPCInternalError, - JSONRPCInvalidParams, - JSONRPCServerError -} from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_subscribe' method - * - * @group integration/rpc-mapper/methods/eth_subscribe - */ -describe('RPC Mapper - eth_subscribe method tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - provider = new VeChainProvider(thorClient); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Describes the test suite for positive test cases of the `eth_subscribe` RPC method. - * This suite includes various scenarios where `eth_subscribe` is expected to succeed, - * verifying the correct behavior of subscription functionalities for different types - * of events in Ethereum, such as `newHeads`. - */ - describe('eth_subscribe - Positive cases', () => { - /** - * Tests successful subscription to the 'newHeads' event. - * It verifies that the RPC call to `eth_subscribe` with 'newHeads' as a parameter - * successfully returns a subscription ID, and that the ID has the expected length - * of 32 characters, indicating a valid response format. - */ - test('eth_subscribe - new latest blocks subscription', async () => { - expect(provider.getPollInstance()).toBeUndefined(); - // Call RPC function - const rpcCall = (await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - })) as string; - - expect(provider.getPollInstance()).toBeDefined(); - - // Verify the length of the subscription ID - expect(rpcCall.length).toEqual(32); - }); - }); - - /** - * Describes the test suite for negative test cases of the `eth_subscribe` RPC method. - * This suite focuses on scenarios where `eth_subscribe` is expected to fail, such as - * when invalid parameters are provided. The aim is to ensure the method handles errors - * gracefully and in accordance with the JSON-RPC specifications. - */ - describe('eth_subscribe - Negative cases', () => { - /** - * Tests the behavior of `eth_subscribe` when an invalid subscription type is provided. - * The test expects the RPC call to throw an error, demonstrating that the method - * properly validates input parameters and handles invalid requests as per the - * JSON-RPC error handling conventions. - */ - test('eth_subscribe - invalid subscription', async () => { - await expect( - async () => - await provider.request({ - method: 'eth_subscribe', - params: ['invalidSubscriptionType'] - }) - ).rejects.toThrowError(JSONRPCInvalidParams); // Ideally, specify the expected error for more precise testing. - }); - - /** - * Tests the behavior of `eth_subscribe` when no provider is available. - */ - test('eth_subscribe - no provider', async () => { - // Attempts to unsubscribe with no provider and expects an error. - await expect( - async () => - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_subscribe]( - [] - ) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - test('eth_subscribe - no best block', async () => { - jest.spyOn( - thorClient.blocks, - 'getBestBlockCompressed' - ).mockReturnValue(Promise.resolve(null)); - - // Attempts to unsubscribe with no provider and expects an error. - await expect( - async () => - await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - }) - ).rejects.toThrowError(JSONRPCServerError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_subscribe/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_subscribe/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_syncing/eth_syncing.mock.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_syncing/eth_syncing.mock.solo.test.ts deleted file mode 100644 index 6dadd5f6f..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_syncing/eth_syncing.mock.solo.test.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; -import { - mockedNotOutOfSyncBestBlockFixture, - mockedOutOfSyncBestBlockFixture -} from './fixture'; - -/** - * RPC Mapper integration tests for 'eth_syncing' method with Solo Network and mocked functionality - * - * @group integration/rpc-mapper/methods/eth_syncing - */ -describe('RPC Mapper - eth_syncing method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * eth_syncing RPC call tests - Positive cases - */ - describe('eth_syncing - Positive cases', () => { - /** - * Positive case 1 - NOT out of sync - */ - test('eth_syncing - Should return false with NOT out of sync best block', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getBestBlockCompressed' - ).mockResolvedValue(mockedNotOutOfSyncBestBlockFixture); - - const status = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_syncing - ]([]); - expect(status).toBe(false); - }); - - /** - * Positive case 2 - OUT of sync - */ - test('eth_syncing - Should return sync status with out of sync best block', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getBestBlockCompressed' - ).mockResolvedValue(mockedOutOfSyncBestBlockFixture); - - const status = await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_syncing - ]([]); - expect(status).not.toBe(false); - expect(status).toHaveProperty('currentBlock'); - expect(status).toHaveProperty('highestBlock'); - expect(status).toHaveProperty('startingBlock'); - }); - }); - - /** - * eth_syncing RPC call tests - Negative cases - */ - describe('eth_syncing - Negative cases', () => { - /** - * Cases when error is thrown - */ - describe('eth_syncing - Error throws', () => { - /** - * Test case that mocks an error thrown by the getBestBlock method - */ - test('Should throw `JSONRPCInternalError` if an error occurs while retrieving the best block', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getBestBlockCompressed' - ).mockRejectedValue(new Error()); - - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_syncing]([]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Test case that mocks an error thrown by the getGenesisBlock method - */ - test('Should throw `JSONRPCInternalError` if an error occurs while retrieving the genesis block', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getGenesisBlock' - ).mockRejectedValue(new Error()); - - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.eth_syncing]([]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Cases when error is thrown - */ - describe('eth_syncing - Null values fetched for best and genesis block', () => { - /** - * Test case where the best block and genesis block are not defined - */ - test('Should return an object with the sync status of the node if the node is out-of-sync and with null best and genesis block', async () => { - // Mock the getBestBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getBestBlockCompressed' - ).mockResolvedValue(null); - - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getGenesisBlock' - ).mockResolvedValue(null); - - const status = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_syncing - ]([])) as string; - - expect(status).not.toBe(false); - }); - }); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_syncing/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_syncing/fixture.ts deleted file mode 100644 index a05b85faf..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_syncing/fixture.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { type CompressedBlockDetail } from '../../../../../src'; - -/** - * Mocked latest block fixture. - * This to be sure that the block is not out of sync in time at 100% - */ -const mockedNotOutOfSyncBestBlockFixture: CompressedBlockDetail = { - number: 99999999, - id: '0x0000000000000ffe671fae58993e0b3f465a7900000000000000000000000000', - size: 361, - parentID: - '0x0000000000000ffe671fae58993e0b3f465a7900000000000000000000000000', - timestamp: Math.floor(Date.now() / 1000), - gasLimit: 30000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 142611716, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 1, - stateRoot: - '0x57443f25e3c4ade0ba9351bb19774563367e843e28c057b509fcf5edca45dd39', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: true, - signer: '0xd848c998a36c05a0afe48f0e6bfa40232a94fd9b', - isTrunk: true, - isFinalized: false, - transactions: [] -}; - -/** - * Mocked latest block fixture. - * This to be sure that the block is out of sync in time at 100% - */ -const mockedOutOfSyncBestBlockFixture: CompressedBlockDetail = { - number: 99999999, - id: '0x0000000000000ffe671fae58993e0b3f465a7900000000000000000000000000', - size: 361, - parentID: - '0x0000000000000ffe671fae58993e0b3f465a7900000000000000000000000000', - timestamp: Math.floor(Date.now() / 1000) - 20000, - gasLimit: 30000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 142611716, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 1, - stateRoot: - '0x57443f25e3c4ade0ba9351bb19774563367e843e28c057b509fcf5edca45dd39', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: true, - signer: '0xd848c998a36c05a0afe48f0e6bfa40232a94fd9b', - isTrunk: true, - isFinalized: false, - transactions: [] -}; - -export { mockedNotOutOfSyncBestBlockFixture, mockedOutOfSyncBestBlockFixture }; diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_uninstallFilter/eth_uninstallFilter.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_uninstallFilter/eth_uninstallFilter.testnet.test.ts deleted file mode 100644 index 29bcb9c30..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_uninstallFilter/eth_uninstallFilter.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'eth_uninstallFilter' method - * - * @group integration/rpc-mapper/methods/eth_uninstallFilter - */ -describe('RPC Mapper - eth_uninstallFilter method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * eth_uninstallFilter RPC call tests - Positive cases - */ - describe('eth_uninstallFilter - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('eth_uninstallFilter - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.eth_uninstallFilter]([ - -1 - ]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_uninstallFilter/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_uninstallFilter/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_unsubscribe/eth_unsubscribe.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_unsubscribe/eth_unsubscribe.testnet.test.ts deleted file mode 100644 index 630447be2..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/eth_unsubscribe/eth_unsubscribe.testnet.test.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient, - VeChainProvider -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'eth_unsubscribe' method - * - * @group integration/rpc-mapper/methods/eth_unsubscribe - */ -describe('RPC Mapper - eth_unsubscribe method tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - provider = new VeChainProvider(thorClient); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - // Describes the test suite for positive cases of the `eth_unsubscribe` RPC method. - describe('eth_unsubscribe - Positive cases', () => { - /** - * Tests the successful unsubscription from 'newHeads' events. - * It first subscribes to 'newHeads' events using 'eth_subscribe', and then - * attempts to unsubscribe using 'eth_unsubscribe'. The test verifies that - * the unsubscription is successful and the result is as expected. - */ - test('eth_unsubscribe - positive case 1', async () => { - // Subscribes to 'newHeads' events. - const ethSubscribeResult = (await provider.request({ - method: 'eth_subscribe', - params: ['newHeads'] - })) as string; - - // Checks if the subscription result is defined. - expect(ethSubscribeResult).toBeDefined(); - - // Verifies the 'newHeads' subscription is present in the subscription manager. - expect( - provider.subscriptionManager.newHeadsSubscription - ).toBeDefined(); - - // Unsubscribes from 'newHeads' events. - const ethUnsubscribeResult = (await provider.request({ - method: 'eth_unsubscribe', - params: [ethSubscribeResult] // Should unsubscribe using the subscription ID returned by 'eth_subscribe', not 'newHeads'. - })) as boolean; - - // Asserts the unsubscription result is true, indicating success. - expect(ethUnsubscribeResult).toEqual(true); - }); - }); - - // Describes the test suite for negative cases of the `eth_unsubscribe` RPC method. - describe('eth_unsubscribe - Negative cases', () => { - /** - * Tests the behavior of 'eth_unsubscribe' with invalid parameters. - * The test attempts to unsubscribe using an invalid subscription ID and expects - * an error to be thrown, specifically a JSONRPCInternalError, indicating the - * failure of the operation due to invalid parameters. - */ - test('eth_unsubscribe - invalid subscription id', async () => { - // Attempts to unsubscribe with an invalid subscription ID and expects an error. - expect( - await provider.request({ - method: 'eth_unsubscribe', - params: ['invalid_subscription_id'] - }) - ).toBe(false); - - expect(provider.getPollInstance()).toBeUndefined(); - }); - - test('eth_unsubscribe - no provider', async () => { - // Attempts to unsubscribe with no provider and expects an error. - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_unsubscribe - ]([]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/eth_unsubscribe/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/eth_unsubscribe/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/evm_mine/evm_mine.mock.solo.test.ts b/packages/network/tests/provider/rpc-mapper/methods/evm_mine/evm_mine.mock.solo.test.ts deleted file mode 100644 index 87739cb2a..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/evm_mine/evm_mine.mock.solo.test.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; -import { - RPC_METHODS, - RPCMethodsMap, - THOR_SOLO_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'evm_mine' method with Solo Network and mocked functionality - * - * @group integration/rpc-mapper/methods/evm_mine - */ -describe('RPC Mapper - evm_mine method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * evm_mine RPC call tests - Negative cases - */ - describe('evm_mine - Negative cases', () => { - /** - * Test case that mocks an error thrown by the getBestBlock method - */ - test('Should throw `JSONRPCInternalError` if an error occurs while retrieving the block number', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getBestBlockExpanded' - ).mockRejectedValue(new Error()); - - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.evm_mine]([]) - ).rejects.toThrowError(JSONRPCInternalError); - }); - - /** - * Test case that mocks an error thrown by the waitForBlockCompressed method - */ - test('Should throw `ProviderRpcError` if an error occurs while waiting for the new block', async () => { - // Mock the waitForBlockCompressed method to return null - jest.spyOn( - thorClient.blocks, - 'waitForBlockCompressed' - ).mockResolvedValue(null); - - const newBlock = await RPCMethodsMap(thorClient)[ - RPC_METHODS.evm_mine - ]([]); - expect(newBlock).toBeNull(); - }); - - /** - * Should return null if the best block is null - */ - test('Should return null if the best block is null', async () => { - // Mock the getBestBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getBestBlockExpanded' - ).mockResolvedValue(null); - - const newBlock = await RPCMethodsMap(thorClient)[ - RPC_METHODS.evm_mine - ]([]); - expect(newBlock).toBeNull(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/evm_mine/evm_mine.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/evm_mine/evm_mine.testnet.test.ts deleted file mode 100644 index b6760b4b5..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/evm_mine/evm_mine.testnet.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - type BlocksRPC, - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'evm_mine' method - * - * @group integration/rpc-mapper/methods/evm_mine - */ -describe('RPC Mapper - evm_mine method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * evm_mine RPC call tests - Positive cases - */ - describe('evm_mine - Positive cases', () => { - /** - * Positive case 1 - get new block - */ - test('evm_mine - positive case 1', async () => { - const bestBlock = await thorClient.blocks.getBestBlockCompressed(); - - const rpcCallEvmMine = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.evm_mine - ]([])) as BlocksRPC | null; - - if (bestBlock != null && rpcCallEvmMine != null) { - expect(Number(rpcCallEvmMine.number)).toBeGreaterThanOrEqual( - bestBlock.number + 1 - ); - } - }, 18000); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/evm_mine/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/evm_mine/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/net_listening/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/net_listening/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/net_listening/net_listening.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/net_listening/net_listening.mock.testnet.test.ts deleted file mode 100644 index e7782efc0..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/net_listening/net_listening.mock.testnet.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'net_listening' method - * - * @group integration/rpc-mapper/methods/net_listening - */ -describe('RPC Mapper - net_listening method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * net_listening RPC call tests - Negative cases - */ - describe('Negative cases', () => { - /** - * Test case where request fails - */ - test('Should throw `JSONRPCInternalError` when request fails', async () => { - // Mock the getBlock method to throw error - jest.spyOn(thorClient.nodes, 'isHealthy').mockRejectedValue( - new Error() - ); - - await expect( - async () => - await RPCMethodsMap(thorClient)[RPC_METHODS.net_listening]( - [] - ) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/net_listening/net_listening.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/net_listening/net_listening.testnet.test.ts deleted file mode 100644 index 5371e6afa..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/net_listening/net_listening.testnet.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'net_listening' method - * - * @group integration/rpc-mapper/methods/net_listening - */ -describe('RPC Mapper - net_listening method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * net_listening RPC call tests - Positive cases - */ - describe('net_listening - Positive cases', () => { - /** - * Should be able to gety if the node is listening - */ - test('Should be able to get if the node is listening', async () => { - const peers = await RPCMethodsMap(thorClient)[ - RPC_METHODS.net_listening - ]([]); - expect(peers).toBeDefined(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/net_peerCount/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/net_peerCount/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/net_peerCount/net_peerCount.mock.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/net_peerCount/net_peerCount.mock.testnet.test.ts deleted file mode 100644 index 17e68e5d4..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/net_peerCount/net_peerCount.mock.testnet.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInternalError } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'net_peerCount' method - * - * @group integration/rpc-mapper/methods/net_peerCount - */ -describe('RPC Mapper - net_peerCount method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * net_peerCount RPC call tests - Negative cases - */ - describe('Negative cases', () => { - /** - * Test case where request fails - */ - test('Should throw `JSONRPCInternalError` when request fails', async () => { - // Mock the getNodes method to throw error - jest.spyOn(thorClient.nodes, 'getNodes').mockRejectedValue( - new Error() - ); - - await expect( - async () => - await RPCMethodsMap(thorClient)[RPC_METHODS.net_peerCount]( - [] - ) - ).rejects.toThrowError(JSONRPCInternalError); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/net_peerCount/net_peerCount.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/net_peerCount/net_peerCount.testnet.test.ts deleted file mode 100644 index cc8bcaf49..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/net_peerCount/net_peerCount.testnet.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'net_peerCount' method - * - * @group integration/rpc-mapper/methods/net_peerCount - */ -describe('RPC Mapper - net_peerCount method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * net_peerCount RPC call tests - Positive cases - */ - describe('net_peerCount - Positive cases', () => { - /** - * Should be able to get the peer count - */ - test('Should be able to get the peer count', async () => { - const peers = await RPCMethodsMap(thorClient)[ - RPC_METHODS.net_peerCount - ]([]); - expect(peers).toBeGreaterThanOrEqual(0); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/net_version/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/net_version/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/net_version/net_version.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/net_version/net_version.testnet.test.ts deleted file mode 100644 index a9c1882b9..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/net_version/net_version.testnet.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'eth_chainId' method - * - * @group integration/rpc-mapper/methods/net_version - */ -describe('RPC Mapper - net_version method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * net_version RPC call tests - Positive cases - */ - describe('net_version - Positive cases', () => { - /** - * Test case regarding obtaining the net_version - */ - test('Should return the net_version (the chain id in our case)', async () => { - // net_version and eth_chainId should return the same value - const rpcCallNetVersion = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.net_version - ]([])) as string; - - const rpcCallChainId = (await RPCMethodsMap(thorClient)[ - RPC_METHODS.eth_chainId - ]([])) as string; - - expect(rpcCallNetVersion).toBe(rpcCallChainId); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/parity_nextNonce/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/parity_nextNonce/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/parity_nextNonce/parity_nextNonce.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/parity_nextNonce/parity_nextNonce.testnet.test.ts deleted file mode 100644 index 5081a03a7..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/parity_nextNonce/parity_nextNonce.testnet.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { VeChainSDKLogger } from '@vechain/sdk-logging'; - -/** - * RPC Mapper integration tests for 'parity_nextNonce' method - * - * @group integration/rpc-mapper/methods/parity_nextNonce - */ -describe('RPC Mapper - parity_nextNonce method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * parity_nextNonce RPC call tests - Positive cases - */ - describe('parity_nextNonce - Positive cases', () => { - /** - * Positive case 1 - ... Description ... - */ - test('parity_nextNonce - positive case 1', async () => { - const logSpy = jest.spyOn(VeChainSDKLogger('warning'), 'log'); - - // NOT IMPLEMENTED YET! - await RPCMethodsMap(thorClient)[RPC_METHODS.parity_nextNonce]([-1]); - - expect(logSpy).toHaveBeenCalled(); - logSpy.mockRestore(); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/txpool_content/txpool_content.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/txpool_content/txpool_content.testnet.test.ts deleted file mode 100644 index 972f2d722..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/txpool_content/txpool_content.testnet.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'txpool_content' method - * - * @group integration/rpc-mapper/methods/txpool_content - */ -describe('RPC Mapper - txpool_content method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * txpool_content RPC call tests - Positive cases - */ - describe('txpool_content - Positive cases', () => { - /** - * Should return the transaction pool content - */ - test('Should return the transaction pool content', async () => { - const txPoolInspect = await RPCMethodsMap(thorClient)[ - RPC_METHODS.txpool_content - ]([]); - - expect(txPoolInspect).toStrictEqual({}); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/txpool_contentFrom/txpool_contentFrom.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/txpool_contentFrom/txpool_contentFrom.testnet.test.ts deleted file mode 100644 index 1c4aa6ff9..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/txpool_contentFrom/txpool_contentFrom.testnet.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'txpool_contentFrom' method - * - * @group integration/rpc-mapper/methods/txpool_contentFrom - */ -describe('RPC Mapper - txpool_contentFrom method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * txpool_contentFrom RPC call tests - Positive cases - */ - describe('txpool_contentFrom - Positive cases', () => { - /** - * Should return the transaction pool content from address - */ - test('Should return the transaction pool content from address', async () => { - const txPoolInspect = await RPCMethodsMap(thorClient)[ - RPC_METHODS.txpool_contentFrom - ](['0x9e7911de289c3c856ce7f421034f66b6cde49c39']); - - expect(txPoolInspect).toStrictEqual({}); - }); - }); - - /** - * txpool_contentFrom RPC call tests - Negative cases - */ - describe('txpool_contentFrom - Negative cases', () => { - /** - * Should not be able to return the transaction pool content from address - */ - test('Should not be able to return the transaction pool content from address', async () => { - // No params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.txpool_contentFrom - ]([]) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Extra params - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.txpool_contentFrom - ](['0x9e7911de289c3c856ce7f421034f66b6cde49c39', 'extra']) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Invalid address - await expect( - async () => - await RPCMethodsMap(thorClient)[ - RPC_METHODS.txpool_contentFrom - ](['INVALID_ADDRESS']) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/txpool_inspect/txpool_inspect.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/txpool_inspect/txpool_inspect.testnet.test.ts deleted file mode 100644 index 1e19e3c33..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/txpool_inspect/txpool_inspect.testnet.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'txpool_inspect' method - * - * @group integration/rpc-mapper/methods/txpool_inspect - */ -describe('RPC Mapper - txpool_inspect method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * txpool_inspect RPC call tests - Positive cases - */ - describe('txpool_inspect - Positive cases', () => { - /** - * Should return the transaction pool content - */ - test('Should return the transaction pool status', async () => { - const txPoolInspect = await RPCMethodsMap(thorClient)[ - RPC_METHODS.txpool_inspect - ]([]); - - expect(txPoolInspect).toStrictEqual({}); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/txpool_status/txpool_status.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/txpool_status/txpool_status.testnet.test.ts deleted file mode 100644 index eabcdc29b..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/txpool_status/txpool_status.testnet.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'txpool_status' method - * - * @group integration/rpc-mapper/methods/txpool_status - */ -describe('RPC Mapper - txpool_status method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * txpool_status RPC call tests - Positive cases - */ - describe('txpool_status - Positive cases', () => { - /** - * Should return the transaction pool status - */ - test('Should return the transaction pool status', async () => { - const txPoolInspect = await RPCMethodsMap(thorClient)[ - RPC_METHODS.txpool_status - ]([]); - - expect(txPoolInspect).toStrictEqual({}); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/web3_clientVersion/fixture.ts b/packages/network/tests/provider/rpc-mapper/methods/web3_clientVersion/fixture.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/network/tests/provider/rpc-mapper/methods/web3_clientVersion/web3_clientVersion.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/web3_clientVersion/web3_clientVersion.testnet.test.ts deleted file mode 100644 index d08263db6..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/web3_clientVersion/web3_clientVersion.testnet.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; - -/** - * RPC Mapper integration tests for 'web3_clientVersion' method - * - * @group integration/rpc-mapper/methods/web3_clientVersion - */ -describe('RPC Mapper - web3_clientVersion method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * web3_clientVersion RPC call tests - Positive cases - */ - describe('web3_clientVersion - Positive cases', () => { - /** - * Get client version - */ - test('web3_clientVersion - positive case 1', async () => { - const web3ClientVersion = await RPCMethodsMap(thorClient)[ - RPC_METHODS.web3_clientVersion - ]([]); - expect(web3ClientVersion).toBe('thor'); - }); - }); -}); diff --git a/packages/network/tests/provider/rpc-mapper/methods/web3_sha3/web3_sha3.testnet.test.ts b/packages/network/tests/provider/rpc-mapper/methods/web3_sha3/web3_sha3.testnet.test.ts deleted file mode 100644 index a5f09bd9c..000000000 --- a/packages/network/tests/provider/rpc-mapper/methods/web3_sha3/web3_sha3.testnet.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - RPC_METHODS, - RPCMethodsMap, - TESTNET_URL, - ThorClient -} from '../../../../../src'; -import { JSONRPCInvalidParams } from '@vechain/sdk-errors'; - -/** - * RPC Mapper integration tests for 'web3_sha3' method - * - * @group integration/rpc-mapper/methods/web3_sha3 - */ -describe('RPC Mapper - web3_sha3 method tests', () => { - /** - * Thor client instance - */ - let thorClient: ThorClient; - - /** - * Init thor client before each test - */ - beforeEach(() => { - // Init thor client - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * web3_clientVersion RPC call tests - Positive cases - */ - describe('web3_sha3 - Positive cases', () => { - /** - * Should be able to calculate web3_sha3 - */ - test('Should be able to calculate web3_sha3', async () => { - const web3Sha3 = await RPCMethodsMap(thorClient)[ - RPC_METHODS.web3_sha3 - ](['0x68656c6c6f20776f726c64']); - expect(web3Sha3).toBe( - '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad' - ); - }); - }); - - /** - * web3_clientVersion RPC call tests - Negative cases - */ - describe('web3_sha3 - Negative cases', () => { - /** - * Should NOT be able to calculate web3_sha3 of invalid hex - */ - test('Should NOT be able to calculate web3_sha3 of invalid hex', async () => { - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.web3_sha3]([ - 'INVALID_HEX' - ]) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - - /** - * Should NOT be able to calculate web3_sha3 of invalid params - */ - test('Should NOT be able to calculate web3_sha3 of invalid params', async () => { - await expect( - RPCMethodsMap(thorClient)[RPC_METHODS.web3_sha3]([]) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); diff --git a/packages/network/tests/signer/signers/vechain-private-key-signer/fixture.ts b/packages/network/tests/signer/signers/vechain-private-key-signer/fixture.ts deleted file mode 100644 index 0c237f306..000000000 --- a/packages/network/tests/signer/signers/vechain-private-key-signer/fixture.ts +++ /dev/null @@ -1,439 +0,0 @@ -import { Address, HexUInt, type TransactionClause } from '@vechain/sdk-core'; -import { InvalidDataType, NotDelegatedTransaction } from '@vechain/sdk-errors'; -import { - type SignTransactionOptions, - THOR_SOLO_ACCOUNTS, - type TransactionRequestInput -} from '../../../../src'; -import { TEST_ACCOUNTS, TESTNET_DELEGATE_URL } from '../../../fixture'; - -/** - * This interface clones the `TestCaseTypedDataDomain` interface in - * [test-wallet.ts](https://github.com/ethers-io/ethers.js/blob/main/src.ts/_tests/test-wallet.ts) - * to implement [ethers](https://github.com/ethers-io/ethers.js) compatibility tests. - */ -interface TestCaseTypedDataDomain { - name?: string; - version?: string; - chainId?: number; - verifyingContract?: string; - salt?: string; -} - -/** - * This interface clones the `TestCaseTypedDataType` interface in - * [test-wallet.ts](https://github.com/ethers-io/ethers.js/blob/main/src.ts/_tests/test-wallet.ts) - * to implement [ethers](https://github.com/ethers-io/ethers.js) compatibility tests. - */ -interface TestCaseTypedDataType { - name: string; - type: string; -} - -/** - * This interface clones the `TestCaseTypedData` interface in - * [test-wallet.ts](https://github.com/ethers-io/ethers.js/blob/main/src.ts/_tests/test-wallet.ts) - * to implement [ethers](https://github.com/ethers-io/ethers.js) compatibility tests. - */ -interface TestCaseTypedData { - name: string; - - domain: TestCaseTypedDataDomain; - primaryType: string; - types: Record; - data: Record; - - encoded: string; - digest: string; - - privateKey: string; - signature: string; -} - -/** - * SignTransaction test cases - * Has both correct and incorrect for solo and an example of using delegatorUrl on testnet - */ -const signTransactionTestCases = { - solo: { - /** - * Correct test cases - */ - correct: [ - { - description: 'Should sign a transaction without delegation', - origin: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER, - isDelegated: false, - expected: { - body: { - chainTag: 246, - clauses: [ - { - data: '0xb6b55f25000000000000000000000000000000000000000000000000000000000000007b', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: 0 - } - ], - dependsOn: null, - expiration: 32, - gas: 57491, - gasPriceCoef: 0 - } - } - }, - { - description: - 'Should sign a transaction with private key delegation', - origin: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER, - options: { - delegatorPrivateKey: - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.privateKey - } satisfies SignTransactionOptions, - isDelegated: true, - expected: { - body: { - chainTag: 246, - clauses: [ - { - data: '0xb6b55f25000000000000000000000000000000000000000000000000000000000000007b', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: 0 - } - ], - dependsOn: null, - expiration: 32, - gas: 57491, - gasPriceCoef: 0, - reserved: { - features: 1 - } - } - } - } - ], - /** - * Incorrect test cases - */ - incorrect: [ - { - description: - "Should throw error when delegator's private key is invalid", - origin: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER, - options: { - delegatorPrivateKey: 'INVALID_PRIVATE_KEY' - } satisfies SignTransactionOptions, - isDelegated: true, - expectedError: InvalidDataType - }, - { - description: - "Should throw error when using delegator url on solo network due to no server providing the delegator's signature through an endpoint", - origin: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER, - options: { - delegatorUrl: 'https://example.com' - } satisfies SignTransactionOptions, - isDelegated: true, - expectedError: NotDelegatedTransaction - } - ] - }, - testnet: { - correct: [ - { - description: 'Should sign a transaction with delegation url', - origin: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER, - options: { - delegatorUrl: TESTNET_DELEGATE_URL - } satisfies SignTransactionOptions, - isDelegated: true, - expected: { - body: { - chainTag: 39, - clauses: [ - { - data: '0x01cb08c5000000000000000000000000000000000000000000000000000000000000007b', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: 0 - } - ], - dependsOn: null, - expiration: 32, - gas: 21464, - gasPriceCoef: 0, - reserved: { - features: 1 - } - } - } - } - ], - incorrect: [ - { - description: - 'Should NOT sign a transaction with delegation when no delegator is provided', - origin: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER, - options: undefined, - isDelegated: true, - expected: { - body: { - chainTag: 39, - clauses: [ - { - data: '0x01cb08c5000000000000000000000000000000000000000000000000000000000000007b', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: 0 - } - ], - dependsOn: null, - expiration: 32, - gas: 21464, - gasPriceCoef: 0, - reserved: { - features: 1 - } - } - }, - expectedError: NotDelegatedTransaction - } - ] - } -}; - -/** - * Account to populate call test cases - */ -const populateCallTestCasesAccount = THOR_SOLO_ACCOUNTS[0]; - -/** - * Test cases for populateCall function - */ -const populateCallTestCases = { - /** - * Positive test cases - */ - positive: [ - // Already defined clauses - { - description: - 'Should populate call with clauses already defined BUT empty', - transactionToPopulate: { - clauses: [] - } satisfies TransactionRequestInput, - expected: { - clauses: [], - from: Address.checksum( - HexUInt.of(populateCallTestCasesAccount.address) - ), - to: null - } - }, - { - description: 'Should populate call with clauses already defined', - transactionToPopulate: { - clauses: [ - { - to: '0x', - value: 0, - data: '0x' - } - ] as TransactionClause[] - } satisfies TransactionRequestInput, - expected: { - clauses: [ - { - to: '0x', - value: 0, - data: '0x' - } - ] as TransactionClause[], - data: '0x', - from: Address.checksum( - HexUInt.of(populateCallTestCasesAccount.address) - ), - to: '0x', - value: 0 - } - }, - - // No clauses defined - - // tx.from and tx.to undefined - { - description: - 'Should use signer address as from address if not defined AND to address as null if to is not defined', - transactionToPopulate: {} satisfies TransactionRequestInput, - expected: { - from: Address.checksum( - HexUInt.of(populateCallTestCasesAccount.address) - ), - to: null - } satisfies TransactionRequestInput - }, - - // tx.from defined AND tx.to undefined - { - description: 'Should set from address from tx.from', - transactionToPopulate: { - from: Address.checksum( - HexUInt.of(populateCallTestCasesAccount.address) - ) - } satisfies TransactionRequestInput, - expected: { - from: Address.checksum( - HexUInt.of(populateCallTestCasesAccount.address) - ), - to: null - } satisfies TransactionRequestInput - }, - - // tx.from undefined AND tx.to defined - { - description: - 'Should set from address from signer and have tx.to defined', - transactionToPopulate: { - to: Address.checksum(HexUInt.of(THOR_SOLO_ACCOUNTS[1].address)) - } satisfies TransactionRequestInput, - expected: { - from: Address.checksum( - HexUInt.of(populateCallTestCasesAccount.address) - ), - to: Address.checksum(HexUInt.of(THOR_SOLO_ACCOUNTS[1].address)) - } satisfies TransactionRequestInput - } - ], - - /** - * Negative test cases - */ - negative: [ - // No clauses defined - - // tx.from defined BUT invalid - { - description: - 'Should NOT set from address from tx.from because different form signer address', - transactionToPopulate: { - from: '0x0000000000000000000000000000000000000000' - } satisfies TransactionRequestInput, - expectedError: InvalidDataType - } - ] -}; - -// This is private for EIP-191 unit test cases only. Dummy key`' -const EIP191_PRIVATE_KEY = - '0xc85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf3'; - -// Used to challenge consistent test encoding. -const EIP191_MESSAGE = 'Hello world! - こんにちは世界 - 👋🗺️!'; - -// This is private for EIP-712 unit test cases only. Dummy key`' -const EIP712_PRIVATE_KEY = - '0xc85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4'; - -// This is private for EIP-712 unit test case only. Dummy address. -const EIP712_CONTRACT = '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'; - -// This is private for EIP-712 unit test case only. Dummy address. -const EIP712_FROM = '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826'; - -// This is private for EIP-712 unit test case only. Dummy address. -const EIP712_TO = '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB'; - -const eip712TestCases = { - invalid: { - name: 'EIP712 example', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 1, - verifyingContract: EIP712_CONTRACT - }, - primaryType: 'Mail', - types: { - Mail: [ - { - name: 'from', - type: 'invalid' - } - ] - }, - data: { - from: { - name: 'Cow', - wallet: EIP712_FROM - }, - to: { - name: 'Bob', - wallet: EIP712_TO - }, - contents: 'Hello, Bob!' - }, - encoded: 'ignored', - digest: 'ignored', - privateKey: EIP712_PRIVATE_KEY, - signature: 'ignored' - } satisfies TestCaseTypedData, - valid: { - name: 'EIP712 example', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 1, - verifyingContract: EIP712_CONTRACT - }, - primaryType: 'Mail', - types: { - Person: [ - { - name: 'name', - type: 'string' - }, - { - name: 'wallet', - type: 'address' - } - ], - Mail: [ - { - name: 'from', - type: 'Person' - }, - { - name: 'to', - type: 'Person' - }, - { - name: 'contents', - type: 'string' - } - ] - }, - data: { - from: { - name: 'Cow', - wallet: EIP712_FROM - }, - to: { - name: 'Bob', - wallet: EIP712_TO - }, - contents: 'Hello, Bob!' - }, - encoded: - '0xa0cedeb2dc280ba39b857546d74f5549c3a1d7bdc2dd96bf881f76108e23dac2fc71e5fa27ff56c350aa531bc129ebdf613b772b6604664f5d8dbe21b85eb0c8cd54f074a4af31b4411ff6a60c9719dbd559c221c8ac3492d9d872b041d703d1b5aadf3154a261abdd9086fc627b61efca26ae5702701d05cd2305f7c52a2fc8', - digest: '0xbe609aee343fb3c4b28e1df9e632fca64fcfaede20f02e86244efddf30957bd2', - privateKey: EIP712_PRIVATE_KEY, - signature: - '0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c' - } satisfies TestCaseTypedData -}; - -export { - EIP191_MESSAGE, - EIP191_PRIVATE_KEY, - eip712TestCases, - populateCallTestCases, - populateCallTestCasesAccount, - signTransactionTestCases -}; diff --git a/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.solo.test.ts b/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.solo.test.ts deleted file mode 100644 index 9d509be29..000000000 --- a/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.solo.test.ts +++ /dev/null @@ -1,303 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - ABIContract, - Address, - Clause, - HexUInt, - Transaction, - type TransactionClause -} from '@vechain/sdk-core'; -import { - ProviderInternalBaseWallet, - signerUtils, - THOR_SOLO_ACCOUNTS, - THOR_SOLO_URL, - ThorClient, - VeChainPrivateKeySigner, - VeChainProvider -} from '../../../../src'; -import { - TEST_ACCOUNTS, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS -} from '../../../fixture'; -import { simulateTransaction } from '../../../thor-client/transactions/fixture-thorest'; -import { signTransactionTestCases } from './fixture'; - -/** - *VeChain base signer tests - solo - * - * @group integration/signers/vechain-base-signer-solo - */ -describe('VeChain base signer tests - solo', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * Test suite for signTransaction method - */ - describe('signTransactionTestCases', () => { - /** - * signTransaction test cases with different options - */ - signTransactionTestCases.solo.correct.forEach( - ({ description, origin, options, isDelegated, expected }) => { - test( - description, - async () => { - const sampleClause = Clause.callFunction( - Address.of(TESTING_CONTRACT_ADDRESS), - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - 'deposit' - ), - [123] - ) as TransactionClause; - - const gasResult = await thorClient.gas.estimateGas( - [sampleClause], - origin.address - ); - - const txBody = - await thorClient.transactions.buildTransactionBody( - [sampleClause], - gasResult.totalGas, - { - isDelegated - } - ); - - // Get the signer and sign the transaction - const signer = new VeChainPrivateKeySigner( - HexUInt.of(origin.privateKey).bytes, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([], { - delegator: options - }), - isDelegated - ) - ); - - const signedRawTx = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - origin.address - ) - ); - const signedTx = Transaction.decode( - HexUInt.of(signedRawTx.slice(2)).bytes, - true - ); - - expect(signedTx).toBeDefined(); - expect(signedTx.body).toMatchObject(expected.body); - expect(signedTx.origin.toString()).toBe( - Address.checksum(HexUInt.of(origin.address)) - ); - expect(signedTx.isDelegated).toBe(isDelegated); - expect(signedTx.isSigned).toBe(true); - expect(signedTx.signature).toBeDefined(); - }, - 8000 - ); - } - ); - - /** - * signTransaction test cases that should throw an error - */ - signTransactionTestCases.solo.incorrect.forEach( - ({ description, origin, options, expectedError }) => { - test( - description, - async () => { - const sampleClause = Clause.callFunction( - Address.of(TESTING_CONTRACT_ADDRESS), - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - 'setStateVariable' - ), - [123] - ) as TransactionClause; - - const txBody = - await thorClient.transactions.buildTransactionBody( - [sampleClause], - 0 - ); - - const signer = new VeChainPrivateKeySigner( - HexUInt.of(origin.privateKey).bytes, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([], { - delegator: options - }), - true - ) - ); - - await expect( - signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - origin.address - ) - ) - ).rejects.toThrowError(expectedError); - }, - 10000 - ); - } - ); - }); - - /** - * Test suite for call function. - * @note Take some test cases are the same as the signTransaction function - */ - describe('call', () => { - /** - * Test call function without clauses - */ - test('call with no clauses transaction', async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of(THOR_SOLO_ACCOUNTS[0].privateKey).bytes, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([]), - false - ) - ); - - const result = await signer.call({}); - expect(result).toBe('0x'); - }); - - /** - * Simulate transfer transactions - */ - simulateTransaction.correct.transfer.forEach( - ({ testName, transaction, expected }) => { - test(testName, async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - transaction.simulateTransactionOptions - .callerPrivateKey - ).bytes, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([]), - false - ) - ); - - const simulatedTx = await signer.call({ - clauses: transaction.clauses - }); - - expect(simulatedTx).toBeDefined(); - /** - * The result of the simulation tx is an array of simulation results. - * Each result represents the simulation of transaction clause. - */ - expect(simulatedTx).toHaveLength( - transaction.clauses.length - ); - - /** - * Compare each simulation result with the expected result. - */ - expect(simulatedTx).toStrictEqual( - expected.simulationResults[0].data - ); - }); - } - ); - - /** - * Simulate smart contract call transactions - */ - simulateTransaction.correct.smartContractCall.forEach( - ({ testName, transaction, expected }) => { - test(testName, async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of(THOR_SOLO_ACCOUNTS[0].privateKey).bytes, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([]), - false - ) - ); - - const simulatedTx = await signer.call( - { - clauses: transaction.clauses - }, - transaction.simulateTransactionOptions != null - ? transaction.simulateTransactionOptions.revision - : undefined - ); - - expect(simulatedTx).toBeDefined(); - expect(simulatedTx).toBe( - expected.simulationResults[0].data - ); - }); - } - ); - - test('perform a transaction with custom gas', async () => { - const sampleClause = Clause.callFunction( - Address.of(TESTING_CONTRACT_ADDRESS), - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction('deposit'), - [123] - ) as TransactionClause; - - const txBody = await thorClient.transactions.buildTransactionBody( - [sampleClause], - 6000000 - ); - - // Get the signer and sign the transaction - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.privateKey - ).bytes, - new VeChainProvider(thorClient) - ); - - const signedRawTx = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ) - ); - const signedTx = Transaction.decode( - HexUInt.of(signedRawTx.slice(2)).bytes, - true - ); - - expect(signedTx).toBeDefined(); - expect(signedTx.body.gas).toEqual(6000000); - expect(signedTx.origin.toString()).toBe( - Address.checksum( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ) - ) - ); - expect(signedTx.isSigned).toBe(true); - expect(signedTx.signature).toBeDefined(); - }, 8000); - }); -}); diff --git a/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.testnet.test.ts b/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.testnet.test.ts deleted file mode 100644 index fea5d7606..000000000 --- a/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.testnet.test.ts +++ /dev/null @@ -1,289 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - ABIContract, - Address, - Clause, - HexUInt, - Transaction, - type TransactionClause -} from '@vechain/sdk-core'; -import { - InvalidSecp256k1PrivateKey, - JSONRPCInvalidParams -} from '@vechain/sdk-errors'; -import { - ProviderInternalBaseWallet, - signerUtils, - TESTNET_URL, - ThorClient, - VeChainPrivateKeySigner, - VeChainProvider -} from '../../../../src'; -import { - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS, - THOR_SOLO_ACCOUNTS_BASE_WALLET, - THOR_SOLO_ACCOUNTS_BASE_WALLET_WITH_DELEGATOR -} from '../../../fixture'; -import { signTransactionTestCases } from './fixture'; - -/** - *VeChain base signer tests - testnet - * - * @group integration/network/signers/vechain-base-signer-testnet - */ -describe('VeChain base signer tests - testnet', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * Positive case tests - */ - describe('Positive case - Signature', () => { - /** - * Should be able to sign transaction NOT delegated - */ - test('Should be able to sign transaction - NOT DELEGATED CASES', async () => { - for (const fixture of signTransactionTestCases.testnet.correct) { - if (!fixture.isDelegated) { - // Init the signer - const signer = new VeChainPrivateKeySigner( - HexUInt.of(fixture.origin.privateKey).bytes, - new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET, - false - ) - ); - - // Sign the transaction - const signedTransaction = await signer.signTransaction({ - from: fixture.origin.address - }); - - expect(signedTransaction).toBeDefined(); - } - } - }); - - /** - * Should be able to sign transaction delegated - */ - test('Should be able to sign transaction - DELEGATED CASES', async () => { - for (const fixture of signTransactionTestCases.testnet.correct) { - if (fixture.isDelegated) { - // Init the signer - const signer = new VeChainPrivateKeySigner( - HexUInt.of(fixture.origin.privateKey).bytes, - new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET_WITH_DELEGATOR( - fixture.options - ), - true - ) - ); - - // Sign the transaction - const signedTransaction = await signer.signTransaction({ - from: fixture.origin.address - }); - - expect(signedTransaction).toBeDefined(); - } - } - }, 8000); - - /** - * Should be able to request delegation URLs per transaction - */ - test('Should be able to request delegation URLs per transaction', async () => { - for (const fixture of signTransactionTestCases.testnet.correct) { - if (fixture.isDelegated) { - const signer = new VeChainPrivateKeySigner( - HexUInt.of(fixture.origin.privateKey).bytes, - new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET, - false - ) - ); - - // Sign the transaction - const signedTransaction = await signer.signTransaction({ - from: fixture.origin.address, - delegationUrl: fixture.options.delegatorUrl - }); - - expect(signedTransaction).toBeDefined(); - } - } - }); - }); - - /** - * Test suite for signTransaction using build transaction flow. - * Test retro compatibility with thorClient signing flow. - */ - describe('signTransactionTestCases', () => { - /** - * Correct test cases - */ - signTransactionTestCases.testnet.correct.forEach( - ({ description, origin, options, isDelegated, expected }) => { - test( - description, - async () => { - const thorClient = ThorClient.at(TESTNET_URL); - - const sampleClause = Clause.callFunction( - Address.of(TESTING_CONTRACT_ADDRESS), - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - 'setStateVariable' - ), - [123] - ) as TransactionClause; - - const gasResult = await thorClient.gas.estimateGas( - [sampleClause], - origin.address - ); - - const txBody = - await thorClient.transactions.buildTransactionBody( - [sampleClause], - gasResult.totalGas, - { - isDelegated - } - ); - - // Get the signer and sign the transaction - const signer = new VeChainPrivateKeySigner( - HexUInt.of(origin.privateKey).bytes, - new VeChainProvider( - thorClient, - new ProviderInternalBaseWallet([], { - delegator: options - }), - isDelegated - ) - ); - - const signedRawTx = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - origin.address - ) - ); - const signedTx = Transaction.decode( - HexUInt.of(signedRawTx.slice(2)).bytes, - true - ); - - expect(signedTx).toBeDefined(); - expect(signedTx.body).toMatchObject(expected.body); - expect(signedTx.origin.toString()).toBe( - Address.checksum(HexUInt.of(origin.address)) - ); - expect(signedTx.isDelegated).toBe(isDelegated); - expect(signedTx.isSigned).toBe(true); - expect(signedTx.signature).toBeDefined(); - }, - 8000 - ); - } - ); - }); - - describe('resolveName(name)', () => { - test('Should be able to resolve an address by name', async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes, - new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET, - false - ) - ); - const address = await signer.resolveName('test-sdk.vet'); - expect(address).toBe('0x105199a26b10e55300CB71B46c5B5e867b7dF427'); - }); - - test('Should resolve to null for unknown names', async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes, - new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET, - false - ) - ); - const address = await signer.resolveName('unknown.test-sdk.vet'); - expect(address).toBe(null); - }); - }); - - /** - * Signer negative cases - */ - describe('Negative cases', () => { - /** - * Wrong private key - */ - test('Should throw an error when the private key is wrong', () => { - expect( - () => new VeChainPrivateKeySigner(HexUInt.of('10').bytes) - ).toThrowError(InvalidSecp256k1PrivateKey); - }); - - /** - * When thorClient / provider are not set, some function cannot be called - */ - test('Signer without a provider should throw errors when call some functions', async () => { - const noProviderSigner = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes - ); - - // Impossible to call "populateTransaction" without a provider - await expect( - noProviderSigner.populateTransaction({}) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Impossible to call "estimateGas" without a provider - await expect(noProviderSigner.estimateGas({})).rejects.toThrowError( - JSONRPCInvalidParams - ); - - // Impossible to call "call" without a provider - await expect(noProviderSigner.call({})).rejects.toThrowError( - JSONRPCInvalidParams - ); - - // Impossible to call "sendTransaction" without a provider - await expect( - noProviderSigner.sendTransaction({}) - ).rejects.toThrowError(JSONRPCInvalidParams); - - // Impossible to call "signTransaction" without a provider - await expect( - noProviderSigner.signTransaction({}) - ).rejects.toThrowError(JSONRPCInvalidParams); - }); - }); -}); 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 deleted file mode 100644 index ca07ba381..000000000 --- a/packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.unit.test.ts +++ /dev/null @@ -1,402 +0,0 @@ -import { - afterEach, - beforeEach, - describe, - expect, - jest, - 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, - ThorClient, - VeChainPrivateKeySigner, - VeChainProvider, - vnsUtils -} from '../../../../src/'; -import { - EIP191_MESSAGE, - EIP191_PRIVATE_KEY, - eip712TestCases, - populateCallTestCases, - populateCallTestCasesAccount -} from './fixture'; - -/** - * VeChain base signer tests - * - * @group unit/signers/vechain-base-signer - */ -describe('VeChain base signer tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - provider = new VeChainProvider(thorClient); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Positive case tests - */ - describe('Positive case', () => { - /** - * Should be able to connect with a provider - */ - test('Should be able to connect with a provider', () => { - // Provider is NOT attached - const signerWithoutProvider = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes - ); - expect(signerWithoutProvider.provider).toBeUndefined(); - - // Attach the provider - const signerWithProvider = signerWithoutProvider.connect(provider); - expect(signerWithProvider.provider).toBe(provider); - }); - - /** - * Should be able to get the address of the signer - */ - test('Should be able to get the address of the signer', async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes, - provider - ); - const address = await signer.getAddress(); - expect(address).toBe( - Address.checksum( - HexUInt.of('0x3db469a79593dcc67f07DE1869d6682fC1eaf535') - ) - ); - }); - - /** - * Should be able to get the nonce - */ - test('Should be able to get the nonce', async () => { - // Generate nonce (provider attached and detached) - for (const tempProvider of [provider, undefined]) { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes, - tempProvider - ); - const nonce = await signer.getNonce('latest'); - expect(nonce).toBeDefined(); - } - }); - - /** - * Should be able to populate call - */ - describe('populateCall method', () => { - /** - * Positive case tests - */ - populateCallTestCases.positive.forEach((fixture) => { - test(fixture.description, async () => { - // Test with provider attached and detached - - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - populateCallTestCasesAccount.privateKey - ).bytes - ); - const populatedCallTransaction = await signer.populateCall( - fixture.transactionToPopulate - ); - expect(populatedCallTransaction).toStrictEqual( - fixture.expected - ); - }); - }); - - /** - * Negative case tests - */ - populateCallTestCases.negative.forEach((fixture) => { - test(fixture.description, async () => { - // Test with provider attached and detached - - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - populateCallTestCasesAccount.privateKey - ).bytes - ); - - await expect( - signer.populateCall(fixture.transactionToPopulate) - ).rejects.toThrowError(fixture.expectedError); - }); - }); - }); - }); - - describe('resolveName(vnsName)', () => { - test('Should return null if provider is not set', async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes - ); - - const name = 'test-sdk.vet'; - const result = await signer.resolveName(name); - expect(result).toEqual(null); - }); - - test('Should use vnsUtils.resolveName() to resolve an address by name', async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes, - provider - ); - - jest.spyOn(vnsUtils, 'resolveName'); - const name = 'test-sdk.vet'; - await signer.resolveName(name); - expect(vnsUtils.resolveName).toHaveBeenCalledWith( - provider.thorClient, - name - ); - }); - - test('Should return null if there were invalid result', async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes, - provider - ); - const name = 'error.vet'; - jest.spyOn(vnsUtils, 'resolveNames').mockImplementation( - async () => { - return await Promise.resolve([]); - } - ); - const address = await signer.resolveName(name); - expect(address).toEqual(null); - }); - - test('Should pass address provided by resolveNames()', async () => { - const signer = new VeChainPrivateKeySigner( - HexUInt.of( - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - ).bytes, - provider - ); - const name = 'address1.vet'; - jest.spyOn(vnsUtils, 'resolveName').mockImplementation(async () => { - return await Promise.resolve( - '0x0000000000000000000000000000000000000001' - ); - }); - const address = await signer.resolveName(name); - expect(address).toEqual( - '0x0000000000000000000000000000000000000001' - ); - }); - }); - - describe('EIP-191', () => { - test('signMessage - invalid - simulate a signature error', async () => { - const signer = new VeChainPrivateKeySigner( - Hex.of(eip712TestCases.invalid.privateKey).bytes, - provider - ); - jest.spyOn(Secp256k1, 'sign').mockImplementationOnce(() => { - throw Error(); - }); - await expect( - signer.signMessage('Hello world!') - ).rejects.toThrowError(); - }); - - test('signMessage - exception when parsing to text', async () => { - const signer = new VeChainPrivateKeySigner( - Hex.of(eip712TestCases.invalid.privateKey).bytes, - provider - ); - const expectedErrorString = 'not an error instance'; - jest.spyOn(Txt, 'of') - .mockImplementationOnce(() => { - throw expectedErrorString; - }) - .mockImplementationOnce(() => { - // eslint-disable-next-line sonarjs/no-throw-literal - throw undefined; - }); - await expect( - signer.signMessage(EIP191_MESSAGE) - ).rejects.toThrowError(expectedErrorString); - - await expect( - signer.signMessage(EIP191_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 () => { - const expected = await new Wallet(EIP191_PRIVATE_KEY).signMessage( - EIP191_MESSAGE - ); - const actual = await new VeChainPrivateKeySigner( - Hex.of(EIP191_PRIVATE_KEY).bytes, - provider - ).signMessage(EIP191_MESSAGE); - expect(actual).toBe(expected); - }); - - test('signMessage - ethers compatible - uint8array', async () => { - const message = Txt.of(EIP191_MESSAGE).bytes; - const expected = await new Wallet(EIP191_PRIVATE_KEY).signMessage( - message - ); - const actual = await new VeChainPrivateKeySigner( - Hex.of(EIP191_PRIVATE_KEY).bytes, - provider - ).signMessage(message); - expect(actual).toBe(expected); - }); - }); - - describe('EIP-712', () => { - test('signTypedData - invalid', async () => { - const signer = new VeChainPrivateKeySigner( - Hex.of(eip712TestCases.invalid.privateKey).bytes, - provider - ); - await expect( - signer.signTypedData( - eip712TestCases.invalid.domain, - eip712TestCases.invalid.types, - eip712TestCases.invalid.data, - eip712TestCases.invalid.primaryType - ) - ).rejects.toThrowError(SignerMethodError); - }); - - test('signTypedData - exception when parsing to hex', async () => { - const signer = new VeChainPrivateKeySigner( - Hex.of(eip712TestCases.invalid.privateKey).bytes, - provider - ); - const expectedErrorString = 'not an error instance'; - jest.spyOn(Hex, 'of') - .mockImplementationOnce(() => { - throw expectedErrorString; - }) - .mockImplementationOnce(() => { - // eslint-disable-next-line sonarjs/no-throw-literal - throw undefined; - }); - await expect( - signer.signTypedData( - eip712TestCases.valid.domain, - eip712TestCases.valid.types, - eip712TestCases.valid.data, - eip712TestCases.valid.primaryType - ) - ).rejects.toThrowError(expectedErrorString); - - await expect( - signer.signTypedData( - eip712TestCases.valid.domain, - eip712TestCases.valid.types, - eip712TestCases.valid.data, - eip712TestCases.valid.primaryType - ) - ).rejects.toThrowError(SignerMethodError); - }); - - test('signTypedData - ethers compatible', async () => { - const expected = await new Wallet( - eip712TestCases.valid.privateKey - ).signTypedData( - eip712TestCases.valid.domain, - eip712TestCases.valid.types, - eip712TestCases.valid.data - ); - expect(expected).toBe(eip712TestCases.valid.signature); - const privateKeySigner = new VeChainPrivateKeySigner( - Hex.of(eip712TestCases.valid.privateKey).bytes, - provider - ); - const actual = await privateKeySigner.signTypedData( - eip712TestCases.valid.domain, - eip712TestCases.valid.types, - 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); - - // Using VeChain chainId as string and bigint - const vechainChainId = - '1176455790972829965191905223412607679856028701100105089447013101863'; - const expectedVeChain = await new Wallet( - eip712TestCases.valid.privateKey - ).signTypedData( - { - ...eip712TestCases.valid.domain, - chainId: vechainChainId - }, - eip712TestCases.valid.types, - eip712TestCases.valid.data - ); - const actualWithStringChainId = - await privateKeySigner.signTypedData( - { - ...eip712TestCases.valid.domain, - chainId: vechainChainId - }, - eip712TestCases.valid.types, - eip712TestCases.valid.data, - eip712TestCases.valid.primaryType - ); - expect(actualWithStringChainId).toBe(expectedVeChain); - const actualWithBigintChainId = - await privateKeySigner.signTypedData( - { - ...eip712TestCases.valid.domain, - chainId: BigInt(vechainChainId) - }, - eip712TestCases.valid.types, - eip712TestCases.valid.data, - eip712TestCases.valid.primaryType - ); - expect(actualWithBigintChainId).toBe(expectedVeChain); - }); - }); -}); diff --git a/packages/network/tests/test-utils.ts b/packages/network/tests/test-utils.ts deleted file mode 100644 index 49c2b0cfe..000000000 --- a/packages/network/tests/test-utils.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { jest } from '@jest/globals'; - -/** - * Advance timers by the specified time and tick - * - * This utility function groups two coupled operations: - * - Advance timers by the specified time in milliseconds - * - Wait for the next tick (needed for promises to resolve) - * - * @param time - The time to advance in milliseconds - */ -const advanceTimersByTimeAndTick = async (time: number): Promise => { - jest.advanceTimersByTime(time); - await new Promise((resolve) => { - process.nextTick(resolve); - }); -}; - -export { advanceTimersByTimeAndTick }; diff --git a/packages/network/tests/thor-client/ThorClient.unit.test.ts b/packages/network/tests/thor-client/ThorClient.unit.test.ts deleted file mode 100644 index 8aa1a5cba..000000000 --- a/packages/network/tests/thor-client/ThorClient.unit.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { TESTNET_URL, ThorClient } from '../../src'; - -/** - * ThorClient module tests. - * - * @group unit/clients/thor-client - */ -describe('ThorClient deprecated methods', () => { - test('ok <- fromUrl', () => { - const expected = ThorClient.at(TESTNET_URL); - // eslint-disable-next-line sonarjs/deprecation - const actual = ThorClient.fromUrl(TESTNET_URL); - expect(actual.httpClient.baseURL).toEqual(expected.httpClient.baseURL); - }); -}); diff --git a/packages/network/tests/thor-client/accounts/AccountsModule.solo.test.ts b/packages/network/tests/thor-client/accounts/AccountsModule.solo.test.ts deleted file mode 100644 index f2eb9eb3b..000000000 --- a/packages/network/tests/thor-client/accounts/AccountsModule.solo.test.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { THOR_SOLO_ACCOUNTS, THOR_SOLO_URL, ThorClient } from '../../../src'; -import { Address, HexUInt, Revision, VET, VTHO } from '@vechain/sdk-core'; - -const ACCOUNT_ADDRESS = Address.of(THOR_SOLO_ACCOUNTS[0].address); - -const CONTRACT_ADDRESS = Address.of( - '0xb2c20a6de401003a671659b10629eb82ff254fb8' -); - -/** - * `TestingContract.sol` contract bytecode on Solo Network - */ -const CONTRACT_BYTECODE = HexUInt.of( - '0x608060405234801561001057600080fd5b50600436106102065760003560e01c80636188a79b1161011a578063bd255307116100ad578063da46084a1161007c578063da46084a146106a1578063e1967eae146106d1578063eb03555c146106ef578063f8b2cb4f1461071f578063fb3a4b941461074f57610206565b8063bd25530714610607578063c4e41b2214610637578063c7bce69d14610655578063cf98821c1461067157610206565b80637634787f116100e95780637634787f1461056f578063b2d144001461059f578063b6b55f25146105bb578063bd220e65146105d757610206565b80636188a79b146104d75780636765f626146105075780636a98ff2b1461052357806375f7286c1461055357610206565b80632e1a7d4d1161019d578063448dc9661161016c578063448dc96614610406578063459346c7146104245780634888df8d146104545780634d56c873146104725780635fb5fe3b146104a757610206565b80632e1a7d4d1461036c57806333956403146103885780633793077c146103b85780633f92958f146103d657610206565b806311c4ea65116101d957806311c4ea65146102b757806315a23066146102ee5780631d4a06de1461030c57806327e235e31461033c57610206565b806301cb08c51461020b57806301ec27bd146102275780630a9f3f05146102575780631083ac9214610287575b600080fd5b6102256004803603810190610220919061126e565b610759565b005b610241600480360381019061023c9190611457565b6107bb565b60405161024e919061156b565b60405180910390f35b610271600480360381019061026c919061126e565b6107cb565b60405161027e919061159c565b60405180910390f35b6102a1600480360381019061029c919061126e565b61086f565b6040516102ae919061159c565b60405180910390f35b6102d160048036038101906102cc91906117e9565b610879565b6040516102e5989796959493929190611b07565b60405180910390f35b6102f66108bf565b604051610303919061159c565b60405180910390f35b61032660048036038101906103219190611b9c565b610956565b6040516103339190611be5565b60405180910390f35b61035660048036038101906103519190611c07565b610960565b604051610363919061159c565b60405180910390f35b6103866004803603810190610381919061126e565b610978565b005b6103a2600480360381019061039d9190611c6c565b610a9a565b6040516103af9190611ca8565b60405180910390f35b6103c0610aa4565b6040516103cd919061159c565b60405180910390f35b6103f060048036038101906103eb919061126e565b610b3b565b6040516103fd9190611cc3565b60405180910390f35b61040e610bdf565b60405161041b9190611d19565b60405180910390f35b61043e60048036038101906104399190611d6a565b610c76565b60405161044b9190611da6565b60405180910390f35b61045c610c80565b6040516104699190611cc3565b60405180910390f35b61048c60048036038101906104879190611edc565b610d17565b60405161049e96959493929190611fb4565b60405180910390f35b6104c160048036038101906104bc9190611c07565b610d41565b6040516104ce9190612015565b60405180910390f35b6104f160048036038101906104ec9190612030565b610d4b565b6040516104fe919061205d565b60405180910390f35b610521600480360381019061051c919061126e565b610d55565b005b61053d60048036038101906105389190612119565b610d9b565b60405161054a9190611cc3565b60405180910390f35b61056d6004803603810190610568919061126e565b610e3f565b005b6105896004803603810190610584919061126e565b610e85565b6040516105969190612015565b60405180910390f35b6105b960048036038101906105b4919061126e565b610f29565b005b6105d560048036038101906105d0919061126e565b610f70565b005b6105f160048036038101906105ec919061126e565b61100e565b6040516105fe9190612162565b60405180910390f35b610621600480360381019061061c919061217d565b6110b2565b60405161062e91906121aa565b60405180910390f35b61063f6110c2565b60405161064c919061159c565b60405180910390f35b61066f600480360381019061066a919061126e565b611159565b005b61068b600480360381019061068691906121c5565b61116d565b604051610698919061220e565b60405180910390f35b6106bb60048036038101906106b69190612230565b611177565b6040516106c8919061225d565b60405180910390f35b6106d961118d565b6040516106e6919061159c565b60405180910390f35b61070960048036038101906107049190612278565b611193565b6040516107169190611cc3565b60405180910390f35b61073960048036038101906107349190611c07565b61119d565b604051610746919061159c565b60405180910390f35b6107576111e6565b005b60006001549050816001819055503373ffffffffffffffffffffffffffffffffffffffff1681837f300d5da673e2547b3469e683ff2c8c7efd661c408f45cd0be5a951392a00cfa3426040516107af919061159c565b60405180910390a45050565b6107c36111e8565b819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633b80eea2836040518263ffffffff1660e01b8152600401610827919061159c565b602060405180830381865afa158015610844573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086891906122ba565b9050919050565b6000819050919050565b60008060006060610888611202565b60606108926111e8565b60008f8f8f8f8f8f8f8f975097509750975097509750975097509850985098509850985098509850989050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663605df59c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561092d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095191906122ba565b905090565b6060819050919050565b60026020528060005260406000206000915090505481565b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f190612333565b60405180910390fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a499190612382565b925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a96573d6000803e3d6000fd5b5050565b6000819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6ddce6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3691906122ba565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d527e344836040518263ffffffff1660e01b8152600401610b97919061159c565b602060405180830381865afa158015610bb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd891906123cb565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e80558316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c719190612424565b905090565b6000819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639ac53dbb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1291906123cb565b905090565b6000806000806000808b8b8b8b8b8b95509550955095509550955096509650965096509650969050565b6000819050919050565b6000819050919050565b600a8111610d98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8f9061249d565b60405180910390fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166337245814836040518263ffffffff1660e01b8152600401610df79190612512565b602060405180830381865afa158015610e14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3891906123cb565b9050919050565b602a8114610e82576040517f8d6ea8be000000000000000000000000000000000000000000000000000000008152600401610e7990612580565b60405180910390fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340f9fafe836040518263ffffffff1660e01b8152600401610ee1919061159c565b602060405180830381865afa158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2291906125b5565b9050919050565b6005811015610f6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f649061262e565b60405180910390fd5b50565b8060008111610fb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fab9061269a565b60405180910390fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461100391906126ba565b925050819055505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166341f90721836040518263ffffffff1660e01b815260040161106a919061159c565b602060405180830381865afa158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab9190612703565b9050919050565b6110ba611202565b819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611130573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115491906122ba565b905090565b6000811461116a57611169612730565b5b50565b6060819050919050565b6000600182611186919061275f565b9050919050565b60015481565b6000819050919050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565bfe5b604051806040016040528060008152602001606081525090565b6040518060600160405280600390602082028036833780820191505090505090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61124b81611238565b811461125657600080fd5b50565b60008135905061126881611242565b92915050565b6000602082840312156112845761128361122e565b5b600061129284828501611259565b91505092915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6112e9826112a0565b810181811067ffffffffffffffff82111715611308576113076112b1565b5b80604052505050565b600061131b611224565b905061132782826112e0565b919050565b600080fd5b600080fd5b600080fd5b600067ffffffffffffffff821115611356576113556112b1565b5b61135f826112a0565b9050602081019050919050565b82818337600083830152505050565b600061138e6113898461133b565b611311565b9050828152602081018484840111156113aa576113a9611336565b5b6113b584828561136c565b509392505050565b600082601f8301126113d2576113d1611331565b5b81356113e284826020860161137b565b91505092915050565b6000604082840312156114015761140061129b565b5b61140b6040611311565b9050600061141b84828501611259565b600083015250602082013567ffffffffffffffff81111561143f5761143e61132c565b5b61144b848285016113bd565b60208301525092915050565b60006020828403121561146d5761146c61122e565b5b600082013567ffffffffffffffff81111561148b5761148a611233565b5b611497848285016113eb565b91505092915050565b6114a981611238565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156114e95780820151818401526020810190506114ce565b60008484015250505050565b6000611500826114af565b61150a81856114ba565b935061151a8185602086016114cb565b611523816112a0565b840191505092915050565b600060408301600083015161154660008601826114a0565b506020830151848203602086015261155e82826114f5565b9150508091505092915050565b60006020820190508181036000830152611585818461152e565b905092915050565b61159681611238565b82525050565b60006020820190506115b1600083018461158d565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006115e2826115b7565b9050919050565b6115f2816115d7565b81146115fd57600080fd5b50565b60008135905061160f816115e9565b92915050565b6000819050919050565b61162881611615565b811461163357600080fd5b50565b6000813590506116458161161f565b92915050565b600067ffffffffffffffff821115611666576116656112b1565b5b602082029050919050565b600080fd5b60006116896116848461164b565b611311565b905080602084028301858111156116a3576116a2611671565b5b835b818110156116cc57806116b88882611259565b8452602084019350506020810190506116a5565b5050509392505050565b600082601f8301126116eb576116ea611331565b5b60036116f8848285611676565b91505092915050565b600067ffffffffffffffff82111561171c5761171b6112b1565b5b602082029050602081019050919050565b600061174061173b84611701565b611311565b9050808382526020820190506020840283018581111561176357611762611671565b5b835b8181101561178c57806117788882611259565b845260208401935050602081019050611765565b5050509392505050565b600082601f8301126117ab576117aa611331565b5b81356117bb84826020860161172d565b91505092915050565b600381106117d157600080fd5b50565b6000813590506117e3816117c4565b92915050565b600080600080600080600080610140898b03121561180a5761180961122e565b5b60006118188b828c01611259565b98505060206118298b828c01611600565b975050604061183a8b828c01611636565b965050606089013567ffffffffffffffff81111561185b5761185a611233565b5b6118678b828c016113bd565b95505060806118788b828c016116d6565b94505060e089013567ffffffffffffffff81111561189957611898611233565b5b6118a58b828c01611796565b93505061010089013567ffffffffffffffff8111156118c7576118c6611233565b5b6118d38b828c016113eb565b9250506101206118e58b828c016117d4565b9150509295985092959890939650565b6118fe816115d7565b82525050565b61190d81611615565b82525050565b600082825260208201905092915050565b600061192f826114af565b6119398185611913565b93506119498185602086016114cb565b611952816112a0565b840191505092915050565b600060039050919050565b600081905092915050565b6000819050919050565b600061198983836114a0565b60208301905092915050565b6000602082019050919050565b6119ab8161195d565b6119b58184611968565b92506119c082611973565b8060005b838110156119f15781516119d8878261197d565b96506119e383611995565b9250506001810190506119c4565b505050505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000602082019050919050565b6000611a3d826119f9565b611a478185611a04565b9350611a5283611a15565b8060005b83811015611a83578151611a6a888261197d565b9750611a7583611a25565b925050600181019050611a56565b5085935050505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110611ad057611acf611a90565b5b50565b6000819050611ae182611abf565b919050565b6000611af182611ad3565b9050919050565b611b0181611ae6565b82525050565b600061014082019050611b1d600083018b61158d565b611b2a602083018a6118f5565b611b376040830189611904565b8181036060830152611b498188611924565b9050611b5860808301876119a2565b81810360e0830152611b6a8186611a32565b9050818103610100830152611b7f818561152e565b9050611b8f610120830184611af8565b9998505050505050505050565b600060208284031215611bb257611bb161122e565b5b600082013567ffffffffffffffff811115611bd057611bcf611233565b5b611bdc848285016113bd565b91505092915050565b60006020820190508181036000830152611bff8184611924565b905092915050565b600060208284031215611c1d57611c1c61122e565b5b6000611c2b84828501611600565b91505092915050565b60008115159050919050565b611c4981611c34565b8114611c5457600080fd5b50565b600081359050611c6681611c40565b92915050565b600060208284031215611c8257611c8161122e565b5b6000611c9084828501611c57565b91505092915050565b611ca281611c34565b82525050565b6000602082019050611cbd6000830184611c99565b92915050565b6000602082019050611cd86000830184611904565b92915050565b60007fffffffffffffffff00000000000000000000000000000000000000000000000082169050919050565b611d1381611cde565b82525050565b6000602082019050611d2e6000830184611d0a565b92915050565b6000819050919050565b611d4781611d34565b8114611d5257600080fd5b50565b600081359050611d6481611d3e565b92915050565b600060208284031215611d8057611d7f61122e565b5b6000611d8e84828501611d55565b91505092915050565b611da081611d34565b82525050565b6000602082019050611dbb6000830184611d97565b92915050565b600060ff82169050919050565b611dd781611dc1565b8114611de257600080fd5b50565b600081359050611df481611dce565b92915050565b600061ffff82169050919050565b611e1181611dfa565b8114611e1c57600080fd5b50565b600081359050611e2e81611e08565b92915050565b600063ffffffff82169050919050565b611e4d81611e34565b8114611e5857600080fd5b50565b600081359050611e6a81611e44565b92915050565b600067ffffffffffffffff82169050919050565b611e8d81611e70565b8114611e9857600080fd5b50565b600081359050611eaa81611e84565b92915050565b611eb9816115b7565b8114611ec457600080fd5b50565b600081359050611ed681611eb0565b92915050565b60008060008060008060c08789031215611ef957611ef861122e565b5b6000611f0789828a01611de5565b9650506020611f1889828a01611e1f565b9550506040611f2989828a01611e5b565b9450506060611f3a89828a01611e9b565b9350506080611f4b89828a01611ec7565b92505060a0611f5c89828a01611259565b9150509295509295509295565b611f7281611dc1565b82525050565b611f8181611dfa565b82525050565b611f9081611e34565b82525050565b611f9f81611e70565b82525050565b611fae816115b7565b82525050565b600060c082019050611fc96000830189611f69565b611fd66020830188611f78565b611fe36040830187611f87565b611ff06060830186611f96565b611ffd6080830185611fa5565b61200a60a083018461158d565b979650505050505050565b600060208201905061202a60008301846118f5565b92915050565b6000602082840312156120465761204561122e565b5b6000612054848285016117d4565b91505092915050565b60006020820190506120726000830184611af8565b92915050565b600067ffffffffffffffff821115612093576120926112b1565b5b61209c826112a0565b9050602081019050919050565b60006120bc6120b784612078565b611311565b9050828152602081018484840111156120d8576120d7611336565b5b6120e384828561136c565b509392505050565b600082601f830112612100576120ff611331565b5b81356121108482602086016120a9565b91505092915050565b60006020828403121561212f5761212e61122e565b5b600082013567ffffffffffffffff81111561214d5761214c611233565b5b612159848285016120eb565b91505092915050565b60006020820190506121776000830184611f96565b92915050565b6000606082840312156121935761219261122e565b5b60006121a1848285016116d6565b91505092915050565b60006060820190506121bf60008301846119a2565b92915050565b6000602082840312156121db576121da61122e565b5b600082013567ffffffffffffffff8111156121f9576121f8611233565b5b61220584828501611796565b91505092915050565b600060208201905081810360008301526122288184611a32565b905092915050565b6000602082840312156122465761224561122e565b5b600061225484828501611de5565b91505092915050565b60006020820190506122726000830184611f69565b92915050565b60006020828403121561228e5761228d61122e565b5b600061229c84828501611636565b91505092915050565b6000815190506122b481611242565b92915050565b6000602082840312156122d0576122cf61122e565b5b60006122de848285016122a5565b91505092915050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061231d601483611913565b9150612328826122e7565b602082019050919050565b6000602082019050818103600083015261234c81612310565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061238d82611238565b915061239883611238565b92508282039050818111156123b0576123af612353565b5b92915050565b6000815190506123c58161161f565b92915050565b6000602082840312156123e1576123e061122e565b5b60006123ef848285016123b6565b91505092915050565b61240181611cde565b811461240c57600080fd5b50565b60008151905061241e816123f8565b92915050565b60006020828403121561243a5761243961122e565b5b60006124488482850161240f565b91505092915050565b7f56616c7565206d7573742062652067726561746572207468616e203130000000600082015250565b6000612487601d83611913565b915061249282612451565b602082019050919050565b600060208201905081810360008301526124b68161247a565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006124e4826124bd565b6124ee81856124c8565b93506124fe8185602086016114cb565b612507816112a0565b840191505092915050565b6000602082019050818103600083015261252c81846124d9565b905092915050565b7f56616c7565206973206e6f742034320000000000000000000000000000000000600082015250565b600061256a600f83611913565b915061257582612534565b602082019050919050565b600060208201905081810360008301526125998161255d565b9050919050565b6000815190506125af816115e9565b92915050565b6000602082840312156125cb576125ca61122e565b5b60006125d9848285016125a0565b91505092915050565b7f56616c7565206d757374206265206174206c6561737420350000000000000000600082015250565b6000612618601883611913565b9150612623826125e2565b602082019050919050565b600060208201905081810360008301526126478161260b565b9050919050565b7f56616c7565206d75737420626520706f73697469766500000000000000000000600082015250565b6000612684601683611913565b915061268f8261264e565b602082019050919050565b600060208201905081810360008301526126b381612677565b9050919050565b60006126c582611238565b91506126d083611238565b92508282019050808211156126e8576126e7612353565b5b92915050565b6000815190506126fd81611e84565b92915050565b6000602082840312156127195761271861122e565b5b6000612727848285016126ee565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061276a82611dc1565b915061277583611dc1565b9250828201905060ff81111561278e5761278d612353565b5b9291505056fea264697066735822122090e8d98dff56f009773585884be02c1824429b468490cc66cf321ad52458c8b864736f6c63430008130033' -); - -/** - * Prolong timeout due to block time which sometimes exceeds jest's default timeout of 5 seconds. - */ -const TIMEOUT = 20000; - -/** - * Test AccountsModule class. - * - * @group integration/network/thor-client - */ -describe('AccountsModule solo tests', () => { - const thorClient = ThorClient.at(THOR_SOLO_URL); - - describe('getAccount method tests', () => { - test( - 'ok <- fixed balance and increasing energy', - async () => { - const expected = { - vet: VET.of(500000000n), - vtho: VTHO.of(500000000n) - }; - const ahead = - await thorClient.accounts.getAccount(ACCOUNT_ADDRESS); - expect(ahead.vet).toEqual(expected.vet); - expect(ahead.vtho.value.gt(expected.vtho.value)).toBe(true); - const best = `${Revision.BEST}`; - const currentBlock = - await thorClient.blocks.getBlockCompressed(best); - if (currentBlock !== null) { - let latestBlock; - const period = 1000; // 1 second in ms. - // Wait for a block greater than currentBlock - do { - latestBlock = - await thorClient.blocks.getBlockCompressed(best); - await new Promise((resolve) => - setTimeout(resolve, period) - ); - } while ( - latestBlock !== null && - currentBlock.number === latestBlock.number - ); - } - - const later = - await thorClient.accounts.getAccount(ACCOUNT_ADDRESS); - - expect(later).toBeDefined(); - expect(later.balance).toEqual(ahead.balance); - expect(Number(later.energy)).toBeGreaterThan( - Number(ahead.energy) - ); - }, - TIMEOUT - ); - }); - - describe('getByteCode method tests', () => { - test( - 'ok <- contract address', - async () => { - const expected = CONTRACT_BYTECODE; - const actual = - await thorClient.accounts.getBytecode(CONTRACT_ADDRESS); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - }); -}); diff --git a/packages/network/tests/thor-client/accounts/AccountsModule.testnet.test.ts b/packages/network/tests/thor-client/accounts/AccountsModule.testnet.test.ts deleted file mode 100644 index c3481e9fa..000000000 --- a/packages/network/tests/thor-client/accounts/AccountsModule.testnet.test.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { TESTNET_URL, ThorClient } from '../../../src'; -import { Address, HexUInt, Revision, ThorId } from '@vechain/sdk-core'; - -const ACCOUNT_ADDRESS = Address.of( - '0xf077b491b355E64048cE21E3A6Fc4751eEeA77fa' -); - -const CONTRACT_ADDRESS = Address.of( - '0x1c65362e12ecafaf2f37494886bb288c6d2ede28' -); - -const CONTRACT_BYTECODE = HexUInt.of( - '0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80636352211e1161010f578063a22cb465116100a2578063d539139311610071578063d5391393146105a0578063d547741f146105be578063e63ab1e9146105da578063e985e9c5146105f8576101e5565b8063a22cb46514610508578063b88d4fde14610524578063c87b56dd14610540578063ca15c87314610570576101e5565b80639010d07c116100de5780639010d07c1461046c57806391d148541461049c57806395d89b41146104cc578063a217fddf146104ea576101e5565b80636352211e146103e65780636a6278421461041657806370a08231146104325780638456cb5914610462576101e5565b80632f2ff15d1161018757806342842e0e1161015657806342842e0e1461036057806342966c681461037c5780634f6ccce7146103985780635c975abb146103c8576101e5565b80632f2ff15d146102ee5780632f745c591461030a57806336568abe1461033a5780633f4ba83a14610356576101e5565b8063095ea7b3116101c3578063095ea7b31461026857806318160ddd1461028457806323b872dd146102a2578063248a9ca3146102be576101e5565b806301ffc9a7146101ea57806306fdde031461021a578063081812fc14610238575b600080fd5b61020460048036038101906101ff91906130eb565b610628565b6040516102119190613133565b60405180910390f35b61022261063a565b60405161022f91906131de565b60405180910390f35b610252600480360381019061024d9190613236565b6106cc565b60405161025f91906132a4565b60405180910390f35b610282600480360381019061027d91906132eb565b610712565b005b61028c610829565b604051610299919061333a565b60405180910390f35b6102bc60048036038101906102b79190613355565b610836565b005b6102d860048036038101906102d391906133de565b610896565b6040516102e5919061341a565b60405180910390f35b61030860048036038101906103039190613435565b6108b5565b005b610324600480360381019061031f91906132eb565b6108d6565b604051610331919061333a565b60405180910390f35b610354600480360381019061034f9190613435565b61097b565b005b61035e6109fe565b005b61037a60048036038101906103759190613355565b610a78565b005b61039660048036038101906103919190613236565b610a98565b005b6103b260048036038101906103ad9190613236565b610af4565b6040516103bf919061333a565b60405180910390f35b6103d0610b65565b6040516103dd9190613133565b60405180910390f35b61040060048036038101906103fb9190613236565b610b7c565b60405161040d91906132a4565b60405180910390f35b610430600480360381019061042b9190613475565b610c02565b005b61044c60048036038101906104479190613475565b610c92565b604051610459919061333a565b60405180910390f35b61046a610d49565b005b610486600480360381019061048191906134a2565b610dc3565b60405161049391906132a4565b60405180910390f35b6104b660048036038101906104b19190613435565b610df2565b6040516104c39190613133565b60405180910390f35b6104d4610e5c565b6040516104e191906131de565b60405180910390f35b6104f2610eee565b6040516104ff919061341a565b60405180910390f35b610522600480360381019061051d919061350e565b610ef5565b005b61053e60048036038101906105399190613683565b610f0b565b005b61055a60048036038101906105559190613236565b610f6d565b60405161056791906131de565b60405180910390f35b61058a600480360381019061058591906133de565b610f9e565b604051610597919061333a565b60405180910390f35b6105a8610fc2565b6040516105b5919061341a565b60405180910390f35b6105d860048036038101906105d39190613435565b610fe6565b005b6105e2611007565b6040516105ef919061341a565b60405180910390f35b610612600480360381019061060d9190613706565b61102b565b60405161061f9190613133565b60405180910390f35b6000610633826111cf565b9050919050565b60606002805461064990613775565b80601f016020809104026020016040519081016040528092919081815260200182805461067590613775565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d782611249565b6006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061071d82610b7c565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361078d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078490613818565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166107ac611294565b73ffffffffffffffffffffffffffffffffffffffff1614806107db57506107da816107d5611294565b61102b565b5b61081a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610811906138aa565b60405180910390fd5b610824838361129c565b505050565b6000600a80549050905090565b610847610841611294565b82611355565b610886576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087d9061393c565b60405180910390fd5b6108918383836113ea565b505050565b6000806000838152602001908152602001600020600101549050919050565b6108be82610896565b6108c7816116e3565b6108d183836116f7565b505050565b60006108e183610c92565b8210610922576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610919906139ce565b60405180910390fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610983611294565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146109f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e790613a60565b60405180910390fd5b6109fa828261172b565b5050565b610a2f7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610a2a611294565b610df2565b610a6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6590613af2565b60405180910390fd5b610a7661175f565b565b610a9383838360405180602001604052806000815250610f0b565b505050565b610aa9610aa3611294565b82611355565b610ae8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610adf9061393c565b60405180910390fd5b610af1816117c2565b50565b6000610afe610829565b8210610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3690613b84565b60405180910390fd5b600a8281548110610b5357610b52613ba4565b5b90600052602060002001549050919050565b6000600c60009054906101000a900460ff16905090565b600080610b8883611910565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610bf9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf090613c1f565b60405180910390fd5b80915050919050565b610c337f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610c2e611294565b610df2565b610c72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6990613cb1565b60405180910390fd5b610c8581610c80600d61194d565b61195b565b610c8f600d611b78565b50565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610d02576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf990613d43565b60405180910390fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610d7a7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610d75611294565b610df2565b610db9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db090613dd5565b60405180910390fd5b610dc1611b8e565b565b6000610dea8260016000868152602001908152602001600020611bf190919063ffffffff16565b905092915050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b606060038054610e6b90613775565b80601f0160208091040260200160405190810160405280929190818152602001828054610e9790613775565b8015610ee45780601f10610eb957610100808354040283529160200191610ee4565b820191906000526020600020905b815481529060010190602001808311610ec757829003601f168201915b5050505050905090565b6000801b81565b610f07610f00611294565b8383611c0b565b5050565b610f1c610f16611294565b83611355565b610f5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f529061393c565b60405180910390fd5b610f6784848484611d77565b50505050565b6060610f7882611dd3565b604051602001610f889190613e57565b6040516020818303038152906040529050919050565b6000610fbb60016000848152602001908152602001600020611e3b565b9050919050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b610fef82610896565b610ff8816116e3565b611002838361172b565b505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6110c98282610df2565b61119b57600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611140611294565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60006111c7836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e50565b905092915050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611242575061124182611ec0565b5b9050919050565b61125281611fa2565b611291576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128890613c1f565b60405180910390fd5b50565b600033905090565b816006600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661130f83610b7c565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061136183610b7c565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806113a357506113a2818561102b565b5b806113e157508373ffffffffffffffffffffffffffffffffffffffff166113c9846106cc565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661140a82610b7c565b73ffffffffffffffffffffffffffffffffffffffff1614611460576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145790613eef565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036114cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c690613f81565b60405180910390fd5b6114dc8383836001611fe3565b8273ffffffffffffffffffffffffffffffffffffffff166114fc82610b7c565b73ffffffffffffffffffffffffffffffffffffffff1614611552576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154990613eef565b60405180910390fd5b6006600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506001600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46116de8383836001611ff5565b505050565b6116f4816116ef611294565b611ffb565b50565b61170182826110bf565b611726816001600085815260200190815260200160002061119f90919063ffffffff16565b505050565b6117358282612080565b61175a816001600085815260200190815260200160002061216190919063ffffffff16565b505050565b611767612191565b6000600c60006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6117ab611294565b6040516117b891906132a4565b60405180910390a1565b60006117cd82610b7c565b90506117dd816000846001611fe3565b6117e682610b7c565b90506006600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506004600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461190c816000846001611ff5565b5050565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600081600001549050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036119ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c190613fed565b60405180910390fd5b6119d381611fa2565b15611a13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0a90614059565b60405180910390fd5b611a21600083836001611fe3565b611a2a81611fa2565b15611a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6190614059565b60405180910390fd5b6001600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611b74600083836001611ff5565b5050565b6001816000016000828254019250508190555050565b611b966121da565b6001600c60006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611bda611294565b604051611be791906132a4565b60405180910390a1565b6000611c008360000183612224565b60001c905092915050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611c79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c70906140c5565b60405180910390fd5b80600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d6a9190613133565b60405180910390a3505050565b611d828484846113ea565b611d8e8484848461224f565b611dcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc490614157565b60405180910390fd5b50505050565b6060611dde82611249565b6000611de86123d6565b90506000815111611e085760405180602001604052806000815250611e33565b80611e1284612468565b604051602001611e23929190614177565b6040516020818303038152906040525b915050919050565b6000611e4982600001612536565b9050919050565b6000611e5c8383612547565b611eb5578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611eba565b600090505b92915050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611f8b57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611f9b5750611f9a8261256a565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff16611fc483611910565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b611fef848484846125e4565b50505050565b50505050565b6120058282610df2565b61207c576120128161263e565b6120208360001c602061266b565b604051602001612031929190614233565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207391906131de565b60405180910390fd5b5050565b61208a8282610df2565b1561215d57600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612102611294565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000612189836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6128a7565b905092915050565b612199610b65565b6121d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121cf906142b9565b60405180910390fd5b565b6121e2610b65565b15612222576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221990614325565b60405180910390fd5b565b600082600001828154811061223c5761223b613ba4565b5b9060005260206000200154905092915050565b60006122708473ffffffffffffffffffffffffffffffffffffffff166129bb565b156123c9578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612299611294565b8786866040518563ffffffff1660e01b81526004016122bb949392919061439a565b6020604051808303816000875af19250505080156122f757506040513d601f19601f820116820180604052508101906122f491906143fb565b60015b612379573d8060008114612327576040519150601f19603f3d011682016040523d82523d6000602084013e61232c565b606091505b506000815103612371576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236890614157565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506123ce565b600190505b949350505050565b6060600e80546123e590613775565b80601f016020809104026020016040519081016040528092919081815260200182805461241190613775565b801561245e5780601f106124335761010080835404028352916020019161245e565b820191906000526020600020905b81548152906001019060200180831161244157829003601f168201915b5050505050905090565b606060006001612477846129de565b01905060008167ffffffffffffffff81111561249657612495613558565b5b6040519080825280601f01601f1916602001820160405280156124c85781602001600182028036833780820191505090505b509050600082602001820190505b60011561252b578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161251f5761251e614428565b5b049450600085036124d6575b819350505050919050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60007f5a05180f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806125dd57506125dc82612b31565b5b9050919050565b6125f084848484612bab565b6125f8610b65565b15612638576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161262f906144c9565b60405180910390fd5b50505050565b60606126648273ffffffffffffffffffffffffffffffffffffffff16601460ff1661266b565b9050919050565b60606000600283600261267e9190614518565b612688919061455a565b67ffffffffffffffff8111156126a1576126a0613558565b5b6040519080825280601f01601f1916602001820160405280156126d35781602001600182028036833780820191505090505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061270b5761270a613ba4565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061276f5761276e613ba4565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026127af9190614518565b6127b9919061455a565b90505b6001811115612859577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106127fb576127fa613ba4565b5b1a60f81b82828151811061281257612811613ba4565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806128529061458e565b90506127bc565b506000841461289d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161289490614603565b60405180910390fd5b8091505092915050565b600080836001016000848152602001908152602001600020549050600081146129af5760006001826128d99190614623565b90506000600186600001805490506128f19190614623565b905081811461296057600086600001828154811061291257612911613ba4565b5b906000526020600020015490508087600001848154811061293657612935613ba4565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b8560000180548061297457612973614657565b5b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506129b5565b60009150505b92915050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310612a3c577a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008381612a3257612a31614428565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310612a79576d04ee2d6d415b85acef81000000008381612a6f57612a6e614428565b5b0492506020810190505b662386f26fc100008310612aa857662386f26fc100008381612a9e57612a9d614428565b5b0492506010810190505b6305f5e1008310612ad1576305f5e1008381612ac757612ac6614428565b5b0492506008810190505b6127108310612af6576127108381612aec57612aeb614428565b5b0492506004810190505b60648310612b195760648381612b0f57612b0e614428565b5b0492506002810190505b600a8310612b28576001810190505b80915050919050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612ba45750612ba382612d09565b5b9050919050565b612bb784848484612d73565b6001811115612bfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bf2906146f8565b60405180910390fd5b6000829050600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603612c4257612c3d81612d79565b612c81565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614612c8057612c7f8582612dc2565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612cc357612cbe81612f2f565b612d02565b8473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614612d0157612d008482613000565b5b5b5050505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b50505050565b600a80549050600b600083815260200190815260200160002081905550600a81908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612dcf84610c92565b612dd99190614623565b9050600060096000848152602001908152602001600020549050818114612ebe576000600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816009600083815260200190815260200160002081905550505b6009600084815260200190815260200160002060009055600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600a80549050612f439190614623565b90506000600b60008481526020019081526020016000205490506000600a8381548110612f7357612f72613ba4565b5b9060005260206000200154905080600a8381548110612f9557612f94613ba4565b5b906000526020600020018190555081600b600083815260200190815260200160002081905550600b600085815260200190815260200160002060009055600a805480612fe457612fe3614657565b5b6001900381819060005260206000200160009055905550505050565b600061300b83610c92565b905081600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806009600084815260200190815260200160002081905550505050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6130c881613093565b81146130d357600080fd5b50565b6000813590506130e5816130bf565b92915050565b60006020828403121561310157613100613089565b5b600061310f848285016130d6565b91505092915050565b60008115159050919050565b61312d81613118565b82525050565b60006020820190506131486000830184613124565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561318857808201518184015260208101905061316d565b60008484015250505050565b6000601f19601f8301169050919050565b60006131b08261314e565b6131ba8185613159565b93506131ca81856020860161316a565b6131d381613194565b840191505092915050565b600060208201905081810360008301526131f881846131a5565b905092915050565b6000819050919050565b61321381613200565b811461321e57600080fd5b50565b6000813590506132308161320a565b92915050565b60006020828403121561324c5761324b613089565b5b600061325a84828501613221565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061328e82613263565b9050919050565b61329e81613283565b82525050565b60006020820190506132b96000830184613295565b92915050565b6132c881613283565b81146132d357600080fd5b50565b6000813590506132e5816132bf565b92915050565b6000806040838503121561330257613301613089565b5b6000613310858286016132d6565b925050602061332185828601613221565b9150509250929050565b61333481613200565b82525050565b600060208201905061334f600083018461332b565b92915050565b60008060006060848603121561336e5761336d613089565b5b600061337c868287016132d6565b935050602061338d868287016132d6565b925050604061339e86828701613221565b9150509250925092565b6000819050919050565b6133bb816133a8565b81146133c657600080fd5b50565b6000813590506133d8816133b2565b92915050565b6000602082840312156133f4576133f3613089565b5b6000613402848285016133c9565b91505092915050565b613414816133a8565b82525050565b600060208201905061342f600083018461340b565b92915050565b6000806040838503121561344c5761344b613089565b5b600061345a858286016133c9565b925050602061346b858286016132d6565b9150509250929050565b60006020828403121561348b5761348a613089565b5b6000613499848285016132d6565b91505092915050565b600080604083850312156134b9576134b8613089565b5b60006134c7858286016133c9565b92505060206134d885828601613221565b9150509250929050565b6134eb81613118565b81146134f657600080fd5b50565b600081359050613508816134e2565b92915050565b6000806040838503121561352557613524613089565b5b6000613533858286016132d6565b9250506020613544858286016134f9565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61359082613194565b810181811067ffffffffffffffff821117156135af576135ae613558565b5b80604052505050565b60006135c261307f565b90506135ce8282613587565b919050565b600067ffffffffffffffff8211156135ee576135ed613558565b5b6135f782613194565b9050602081019050919050565b82818337600083830152505050565b6000613626613621846135d3565b6135b8565b90508281526020810184848401111561364257613641613553565b5b61364d848285613604565b509392505050565b600082601f83011261366a5761366961354e565b5b813561367a848260208601613613565b91505092915050565b6000806000806080858703121561369d5761369c613089565b5b60006136ab878288016132d6565b94505060206136bc878288016132d6565b93505060406136cd87828801613221565b925050606085013567ffffffffffffffff8111156136ee576136ed61308e565b5b6136fa87828801613655565b91505092959194509250565b6000806040838503121561371d5761371c613089565b5b600061372b858286016132d6565b925050602061373c858286016132d6565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061378d57607f821691505b6020821081036137a05761379f613746565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000613802602183613159565b915061380d826137a6565b604082019050919050565b60006020820190508181036000830152613831816137f5565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b6000613894603d83613159565b915061389f82613838565b604082019050919050565b600060208201905081810360008301526138c381613887565b9050919050565b7f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560008201527f72206f7220617070726f76656400000000000000000000000000000000000000602082015250565b6000613926602d83613159565b9150613931826138ca565b604082019050919050565b6000602082019050818103600083015261395581613919565b9050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b60006139b8602b83613159565b91506139c38261395c565b604082019050919050565b600060208201905081810360008301526139e7816139ab565b9050919050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b6000613a4a602f83613159565b9150613a55826139ee565b604082019050919050565b60006020820190508181036000830152613a7981613a3d565b9050919050565b7f4552433732315072657365744d696e7465725061757365724175746f49643a2060008201527f6d75737420686176652070617573657220726f6c6520746f20756e7061757365602082015250565b6000613adc604083613159565b9150613ae782613a80565b604082019050919050565b60006020820190508181036000830152613b0b81613acf565b9050919050565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b6000613b6e602c83613159565b9150613b7982613b12565b604082019050919050565b60006020820190508181036000830152613b9d81613b61565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613c09601883613159565b9150613c1482613bd3565b602082019050919050565b60006020820190508181036000830152613c3881613bfc565b9050919050565b7f4552433732315072657365744d696e7465725061757365724175746f49643a2060008201527f6d7573742068617665206d696e74657220726f6c6520746f206d696e74000000602082015250565b6000613c9b603d83613159565b9150613ca682613c3f565b604082019050919050565b60006020820190508181036000830152613cca81613c8e565b9050919050565b7f4552433732313a2061646472657373207a65726f206973206e6f74206120766160008201527f6c6964206f776e65720000000000000000000000000000000000000000000000602082015250565b6000613d2d602983613159565b9150613d3882613cd1565b604082019050919050565b60006020820190508181036000830152613d5c81613d20565b9050919050565b7f4552433732315072657365744d696e7465725061757365724175746f49643a2060008201527f6d75737420686176652070617573657220726f6c6520746f2070617573650000602082015250565b6000613dbf603e83613159565b9150613dca82613d63565b604082019050919050565b60006020820190508181036000830152613dee81613db2565b9050919050565b600081905092915050565b6000613e0b8261314e565b613e158185613df5565b9350613e2581856020860161316a565b80840191505092915050565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000815250565b6000613e638284613e00565b9150613e6e82613e31565b60058201915081905092915050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b6000613ed9602583613159565b9150613ee482613e7d565b604082019050919050565b60006020820190508181036000830152613f0881613ecc565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613f6b602483613159565b9150613f7682613f0f565b604082019050919050565b60006020820190508181036000830152613f9a81613f5e565b9050919050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000613fd7602083613159565b9150613fe282613fa1565b602082019050919050565b6000602082019050818103600083015261400681613fca565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b6000614043601c83613159565b915061404e8261400d565b602082019050919050565b6000602082019050818103600083015261407281614036565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b60006140af601983613159565b91506140ba82614079565b602082019050919050565b600060208201905081810360008301526140de816140a2565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000614141603283613159565b915061414c826140e5565b604082019050919050565b6000602082019050818103600083015261417081614134565b9050919050565b60006141838285613e00565b915061418f8284613e00565b91508190509392505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b60006141d1601783613df5565b91506141dc8261419b565b601782019050919050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600061421d601183613df5565b9150614228826141e7565b601182019050919050565b600061423e826141c4565b915061424a8285613e00565b915061425582614210565b91506142618284613e00565b91508190509392505050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b60006142a3601483613159565b91506142ae8261426d565b602082019050919050565b600060208201905081810360008301526142d281614296565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b600061430f601083613159565b915061431a826142d9565b602082019050919050565b6000602082019050818103600083015261433e81614302565b9050919050565b600081519050919050565b600082825260208201905092915050565b600061436c82614345565b6143768185614350565b935061438681856020860161316a565b61438f81613194565b840191505092915050565b60006080820190506143af6000830187613295565b6143bc6020830186613295565b6143c9604083018561332b565b81810360608301526143db8184614361565b905095945050505050565b6000815190506143f5816130bf565b92915050565b60006020828403121561441157614410613089565b5b600061441f848285016143e6565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4552433732315061757361626c653a20746f6b656e207472616e73666572207760008201527f68696c6520706175736564000000000000000000000000000000000000000000602082015250565b60006144b3602b83613159565b91506144be82614457565b604082019050919050565b600060208201905081810360008301526144e2816144a6565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061452382613200565b915061452e83613200565b925082820261453c81613200565b91508282048414831517614553576145526144e9565b5b5092915050565b600061456582613200565b915061457083613200565b9250828201905080821115614588576145876144e9565b5b92915050565b600061459982613200565b9150600082036145ac576145ab6144e9565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006145ed602083613159565b91506145f8826145b7565b602082019050919050565b6000602082019050818103600083015261461c816145e0565b9050919050565b600061462e82613200565b915061463983613200565b9250828203905081811115614651576146506144e9565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f455243373231456e756d657261626c653a20636f6e736563757469766520747260008201527f616e7366657273206e6f7420737570706f727465640000000000000000000000602082015250565b60006146e2603583613159565b91506146ed82614686565b604082019050919050565b60006020820190508181036000830152614711816146d5565b905091905056fea2646970667358221220e972bbd276839058152a76991f80e14bc204d51ef1164ea5b20e88b88893b61164736f6c63430008110033' -); - -/** - * Address of the Energy built-in contract. - * - * @link see [energy.sol](https://docs.vechain.org/developer-resources/built-in-contracts#energy-sol) - */ -const ENERGY_CONTRACT_ADDRESS = Address.of( - '0x0000000000000000000000000000456e65726779' -); - -/** - * Bytecode of the Energy built-in contract. - */ -const ENERGY_CONTRACT_BYTECODE = HexUInt.of( - '0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce5671461025957806370a082311461028a57806395d89b41146102e1578063a9059cbb14610371578063bb35783b146103d6578063d89135cd1461045b578063dd62ed3e14610486575b600080fd5b3480156100c057600080fd5b506100c96104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053a565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be61062b565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610865565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b506102f661094d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037d57600080fd5b506103bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098a565b604051808215151515815260200191505060405180910390f35b3480156103e257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b50610470610b67565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0d565b6040518082815260200191505060405180910390f35b60606040805190810160405280600681526020017f566554686f720000000000000000000000000000000000000000000000000000815250905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1663592b389c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b8101908080519060200190929190505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6275696c74696e3a20696e73756666696369656e7420616c6c6f77616e63650081525060200191505060405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061085a848484610c93565b600190509392505050565b60006012905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663ee660480836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b81019080805190602001909291905050509050919050565b60606040805190810160405280600481526020017f5654484f00000000000000000000000000000000000000000000000000000000815250905090565b6000610997338484610c93565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610add57503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663059950e9866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b1515610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6275696c74696e3a2073656c66206f72206d617374657220726571756972656481525060200191505060405180910390fd5b610b5c848484610c93565b600190509392505050565b60003073ffffffffffffffffffffffffffffffffffffffff1663138d4d0c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b8101908080519060200190929190505050905090565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000811115610eaa573073ffffffffffffffffffffffffffffffffffffffff166339ed08d584836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050506040513d6020811015610d6957600080fd5b81019080805190602001909291905050501515610dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6275696c74696e3a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631cedfac183836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820bd55cb9aff347dc60fe8280ae6b08a6f6deacc85a4e1c89ba0a8ef31fbcaecc60029' -); - -const SMART_CONTRACT_ADDRESS = Address.of( - '0xa540a1924dff8db10bcb3aba3183c0385f2ad285' -); - -const SMART_CONTRACT_POSITION = ThorId.of( - '0x0000000000000000000000000000000000000000000000000000000000000001' -); - -const TIMEOUT = 5000; - -/** - * Test AccountsModule class. - * - * @group integration/network/thor-client - */ -describe('AccountsModule testnet tests', () => { - const thorClient = ThorClient.at(TESTNET_URL); - - describe('getAccount method tests', () => { - describe('with revision', () => { - test('ok <- block bi ', async () => { - const revision = Revision.of(14000000n); - const expected = { - balance: '0x26a9f176f96e764a3d6', - energy: '0x5497801ddd36c434be', - hasCode: false - }; - const actual = await thorClient.accounts.getAccount( - ACCOUNT_ADDRESS, - { - revision - } - ); - expect(actual).toEqual(expected); - }); - - test('ok <- block id', async () => { - const revision = Revision.of( - '0x00e4e1c0fbb78a30a5ae9549f8f5a0cf4ac4aab589803f2487b74261fffcbdf5' - ); - const expected = { - balance: '0x64fa270f17ef298000', - energy: '0x11bec42c96bc7bd45f', - hasCode: false - }; - const actual = await thorClient.accounts.getAccount( - ACCOUNT_ADDRESS, - { - revision - } - ); - expect(actual).toEqual(expected); - }); - - test('ok <- block n ', async () => { - const revision = Revision.of(15000000); - const expected = { - balance: '0x64fa270f17ef298000', - energy: '0x11bec42c96bc7bd45f', - hasCode: false - }; - const actual = await thorClient.accounts.getAccount( - ACCOUNT_ADDRESS, - { - revision - } - ); - expect(actual).toEqual(expected); - }); - }); - }); - - describe('getBytecode method tests', () => { - describe('with revision', () => { - test( - '0 <- block id for no content => before contract deployment ', - async () => { - const revision = Revision.of(1); - const expected = HexUInt.of(0); - const actual = await thorClient.accounts.getBytecode( - CONTRACT_ADDRESS, - { revision } - ); - expect(actual.isEqual(expected)).toBe(true); - }, - TIMEOUT - ); - - test( - 'ok <- block id', - async () => { - const revision = Revision.of( - '0x00e4e1c0fbb78a30a5ae9549f8f5a0cf4ac4aab589803f2487b74261fffcbdf5' - ); - const expected = ENERGY_CONTRACT_BYTECODE; - const actual = await thorClient.accounts.getBytecode( - ENERGY_CONTRACT_ADDRESS, - { revision } - ); - expect(actual.isEqual(expected)).toBe(true); - }, - TIMEOUT - ); - - test( - 'ok <- block n', - async () => { - const revision = Revision.of(16000000); - const expected = ENERGY_CONTRACT_BYTECODE; - const actual = await thorClient.accounts.getBytecode( - ENERGY_CONTRACT_ADDRESS, - { revision } - ); - expect(actual.isEqual(expected)).toBe(true); - }, - TIMEOUT - ); - }); - - describe('without revision', () => { - test( - 'ok <- best block @ contract', - async () => { - const revision = undefined; // Best block. - const expected = ENERGY_CONTRACT_BYTECODE; - const actual = await thorClient.accounts.getBytecode( - ENERGY_CONTRACT_ADDRESS, - { revision } - ); - expect(actual.isEqual(expected)).toBe(true); - }, - TIMEOUT - ); - - test( - 'ok <- block id for content => after contract deployment ', - async () => { - const revision = undefined; // Best block. - const expected = CONTRACT_BYTECODE; - const actual = await thorClient.accounts.getBytecode( - CONTRACT_ADDRESS, - { revision } - ); - expect(actual.isEqual(expected)).toBe(true); - }, - TIMEOUT - ); - }); - }); - - describe('getStorageAt method tests', () => { - test( - 'ok <- with revision', - async () => { - const revision = Revision.of(1); - const expected = HexUInt.of(0); - const actual = await thorClient.accounts.getStorageAt( - SMART_CONTRACT_ADDRESS, - SMART_CONTRACT_POSITION, - { revision } - ); - expect(actual.isEqual(expected)).toBe(true); - }, - TIMEOUT - ); - - test( - 'ok <- without revision', - async () => { - const unexpected = HexUInt.of(0); - const actual = await thorClient.accounts.getStorageAt( - SMART_CONTRACT_ADDRESS, - SMART_CONTRACT_POSITION - ); - expect(actual.isEqual(unexpected)).toBe(false); - }, - TIMEOUT - ); - }); -}); diff --git a/packages/network/tests/thor-client/blocks/blocks.mock.solo.test.ts b/packages/network/tests/thor-client/blocks/blocks.mock.solo.test.ts deleted file mode 100644 index e28e44b23..000000000 --- a/packages/network/tests/thor-client/blocks/blocks.mock.solo.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { describe, expect, jest, test } from '@jest/globals'; -import { THOR_SOLO_URL, ThorClient } from '../../../src'; -import { SimpleHttpClient } from '../../../src/http'; - -/** - * Blocks module tests with mocks. - * - * @group integration/clients/thor-client/blocks - */ -describe('ThorClient - Blocks Module mock tests', () => { - test('getBlockCompressed should return null if null is returned from the api', async () => { - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - - // Mock the getBlockCompressed method to return null - jest.spyOn(SimpleHttpClient.prototype, 'http').mockResolvedValueOnce( - null - ); - - await expect( - thorSoloClient.blocks.getBlockCompressed('best') - ).resolves.toBeNull(); - }); - - test('getBlockExpanded should return null if null is returned from the api', async () => { - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - - // Mock the getBlockExpanded method to return null - jest.spyOn(SimpleHttpClient.prototype, 'http').mockResolvedValueOnce( - null - ); - - await expect( - thorSoloClient.blocks.getBlockExpanded('best') - ).resolves.toBeNull(); - }); -}); diff --git a/packages/network/tests/thor-client/blocks/blocks.testnet.test.ts b/packages/network/tests/thor-client/blocks/blocks.testnet.test.ts deleted file mode 100644 index c4f910fe5..000000000 --- a/packages/network/tests/thor-client/blocks/blocks.testnet.test.ts +++ /dev/null @@ -1,355 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { - expandedBlockDetailFixture, - invalidBlockRevisions, - validCompressedBlockRevisions, - validExpandedBlockRevisions, - waitForBlockTestCases -} from './fixture'; -import { Poll, TESTNET_URL, ThorClient } from '../../../src'; -import { Address, BloomFilter, networkInfo } from '@vechain/sdk-core'; -import { SimpleHttpClient } from '../../../src/http'; - -/** - * Blocks Module integration tests - * - * @group integration/clients/thor-client/blocks - */ -describe('ThorClient - Blocks Module', () => { - // ThorClient instance - let thorClient: ThorClient; - - beforeEach(() => { - thorClient = new ThorClient(new SimpleHttpClient(TESTNET_URL), { - isPollingEnabled: true - }); - }); - - afterEach(() => { - thorClient.destroy(); - }); - - /** - * Test suite for waitForBlockCompressed method - * The waitForBlockCompressed method is tested in parallel with different options, coming from the waitForBlockTestCases array - */ - describe('waitForBlockCompressed', () => { - test( - 'parallel waitForBlockCompressed tests', - async () => { - // Map each test case to a promise - const tests = waitForBlockTestCases.map(async ({ options }) => { - const bestBlock = - await thorClient.blocks.getBestBlockCompressed(); - if (bestBlock != null) { - const expectedBlock = - await thorClient.blocks.waitForBlockCompressed( - bestBlock?.number + 1, - options - ); - - // Incorporate the description into the assertion message for clarity - expect(expectedBlock?.number).toBeGreaterThan( - bestBlock?.number - ); - } - }); - - // Wait for all tests to complete - await Promise.all(tests); - }, - 12000 * waitForBlockTestCases.length - ); - }); - - /** - * Test suite for waitForBlockExpanded method - * The waitForBlockExpanded method is tested in parallel with different options, coming from the waitForBlockTestCases array - */ - describe('waitForBlockExpanded', () => { - test( - 'parallel waitForBlockExpanded tests', - async () => { - // Map each test case to a promise - const tests = waitForBlockTestCases.map(async ({ options }) => { - const bestBlock = - await thorClient.blocks.getBestBlockExpanded(); - if (bestBlock != null) { - const expectedBlock = - await thorClient.blocks.waitForBlockExpanded( - bestBlock?.number + 1, - options - ); - - // Incorporate the description into the assertion message for clarity - expect(expectedBlock?.number).toBeGreaterThan( - bestBlock?.number - ); - } - }); - - // Wait for all tests to complete - await Promise.all(tests); - }, - 12000 * waitForBlockTestCases.length - ); - }); - - describe('getAllAddressesIntoABlock', () => { - /** - * Test for getAllAddressesIntoABlock function - */ - test('getAllAddressesIntoABlock', () => { - const expected = [ - '0x0000000000000000000000000000456e65726779', - '0x1a8abd6d5627eb26ad71c0c7ae5224cdc640faf3', - '0x1eef8963e1222417af4dac0d98553abddb4a76b5', - '0x23a46368e4acc7bb2fe0afeb054def51ec56aa74', - '0x45429a2255e7248e57fce99e7239aed3f84b7a53', - '0x576da7124c7bb65a692d95848276367e5a844d95', - '0x5db3c8a942333f6468176a870db36eef120a34dc', - '0x6298c7a54720febdefd741d0899d287c70954c68', - '0x95fe74d1ae072ee45bdb09879a157364e5341565', - '0x9a107a75cff525b033a3e53cadafe3d193b570ec', - '0xa416bdda32b00e218f08ace220bab512c863ff2f', - '0xb2c20a6de401003a671659b10629eb82ff254fb8', - '0xb7591602c0c9d525bc3a7cf3c729fd91b8bf5bf6', - '0xbeae4bef0121f11d269aedf6adb227259d4314ad' - ]; - thorClient.blocks - .getAllAddressesIntoABlock(expandedBlockDetailFixture) - .filter((address) => { - return Address.isValid(address); // Remove empty addresses. - }) - .forEach((actual) => { - expect(expected.includes(actual)).toBeTruthy(); - }); - }); - - test('getAllAddressesIntoABlock combined with boolUtils.filterOf - bit per key - default', () => { - const addresses = thorClient.blocks - .getAllAddressesIntoABlock(expandedBlockDetailFixture) - .filter((address) => { - return Address.isValid(address); - }); - const filter = BloomFilter.of( - ...addresses.map((address) => Address.of(address)) - ).build(); - addresses.forEach((address) => { - expect(filter.contains(Address.of(address))).toBeTruthy(); - }); - }); - - test('getAllAddressesIntoABlock combined with boolUtils.filterOf - bit per key - set', () => { - const k = 16; - const addresses = thorClient.blocks - .getAllAddressesIntoABlock(expandedBlockDetailFixture) - .filter((address) => { - return Address.isValid(address); - }); - - const filter = BloomFilter.of( - ...addresses.map((address) => Address.of(address)) - ).build(k); - addresses.forEach((address) => { - expect(filter.contains(Address.of(address))).toBeTruthy(); - }); - }); - }); - - test('waitForBlockCompressed - invalid blockNumber', async () => { - await expect( - async () => await thorClient.blocks.waitForBlockCompressed(-2) - ).rejects.toThrowError( - 'Invalid blockNumber. The blockNumber must be a number representing a block number.' - ); - }, 5000); - - test('waitForBlockExpanded - invalid blockNumber', async () => { - await expect( - async () => await thorClient.blocks.waitForBlockExpanded(-2) - ).rejects.toThrowError( - 'Invalid blockNumber. The blockNumber must be a number representing a block number.' - ); - }, 5000); - - test('waitForBlockCompressed - maximumWaitingTimeInMilliseconds', async () => { - // Get best block - const bestBlock = await thorClient.blocks.getBestBlockCompressed(); - if (bestBlock != null) { - const block = await thorClient.blocks.waitForBlockCompressed( - bestBlock?.number + 2, - { - timeoutMs: 1000 - } - ); - - expect(block).toBeDefined(); - expect(block?.number).not.toBeGreaterThan(bestBlock?.number + 1); // Not enough time to wait for the block (only 1 second was given) - } - }, 23000); - - /** - * getBlockCompressed tests - */ - describe('getBlockCompressed', () => { - /** - * getBlockCompressed tests with revision block number or block id - */ - validCompressedBlockRevisions.forEach(({ revision, expected }) => { - test( - revision, - async () => { - const blockDetails = - await thorClient.blocks.getBlockCompressed(revision); - expect(blockDetails).toEqual(expected); - }, - 5000 - ); - }); - - /** - * getBlockExpanded tests with revision block number or block id - */ - validExpandedBlockRevisions.forEach(({ revision, expected }) => { - test( - revision, - async () => { - const blockDetails = - await thorClient.blocks.getBlockExpanded(revision); - expect(blockDetails).toEqual(expected); - }, - 5000 - ); - }); - - /** - * getBlockCompressed tests with invalid revision block number or block id - */ - invalidBlockRevisions.forEach( - ({ description, revision, expectedError }) => { - test( - description, - async () => { - await expect( - thorClient.blocks.getBlockCompressed(revision) - ).rejects.toThrowError(expectedError); - }, - 5000 - ); - } - ); - - /** - * getBlockCompressed tests with invalid revision block number or block id - */ - invalidBlockRevisions.forEach( - ({ description, revision, expectedError }) => { - test( - description, - async () => { - await expect( - thorClient.blocks.getBlockExpanded(revision) - ).rejects.toThrowError(expectedError); - }, - 5000 - ); - } - ); - - /** - * getBestBlockCompressed test - */ - test('getBestBlockCompressed', async () => { - const blockDetails = - await thorClient.blocks.getBestBlockCompressed(); - if (blockDetails != null) { - const block = await thorClient.blocks.getBlockCompressed( - blockDetails.number - ); - expect(block?.number).toBe(blockDetails.number); - } - expect(blockDetails).not.toBeNull(); - expect(blockDetails).toBeDefined(); - }, 3000); - - /** - * getBestBlockExpanded test - */ - test('getBestBlockExpanded', async () => { - const blockDetails = await thorClient.blocks.getBestBlockExpanded(); - if (blockDetails != null) { - const block = await thorClient.blocks.getBlockExpanded( - blockDetails.number - ); - expect(block?.number).toBe(blockDetails.number); - } - expect(blockDetails).not.toBeNull(); - expect(blockDetails).toBeDefined(); - }, 3000); - - /** - * getBestBlockRef test - */ - test('getBestBlockRef', async () => { - const bestBlockRef = await thorClient.blocks.getBestBlockRef(); - expect(bestBlockRef).not.toBeNull(); - expect(bestBlockRef).toBeDefined(); - }, 3000); - - /** - * getFinalBlockCompressed test - */ - test('getFinalBlockCompressed', async () => { - const blockDetails = - await thorClient.blocks.getFinalBlockCompressed(); - expect(blockDetails).not.toBeNull(); - expect(blockDetails).toBeDefined(); - }, 3000); - - /** - * getFinalBlockExpanded test - */ - test('getFinalBlockExpanded', async () => { - const blockDetails = - await thorClient.blocks.getFinalBlockExpanded(); - expect(blockDetails).not.toBeNull(); - expect(blockDetails).toBeDefined(); - }, 3000); - - /** - * getHeadBlock test - */ - test('getHeadBlock', async () => { - const headBlockFirst = await Poll.SyncPoll(() => - thorClient.blocks.getHeadBlock() - ).waitUntil((result) => { - return result !== null; - }); - - expect(headBlockFirst).toBeDefined(); - - // Wait for the next block - const headBlockSecond = await Poll.SyncPoll(() => - thorClient.blocks.getHeadBlock() - ).waitUntil((result) => { - return result !== headBlockFirst; - }); - - expect(headBlockSecond).toBeDefined(); - expect(headBlockFirst).not.toBe(headBlockSecond); - }, 23000); - - /** - * getGenesisBlock test - */ - test('getGenesisBlock', async () => { - const blockDetails = await thorClient.blocks.getGenesisBlock(); - expect(blockDetails).toBeDefined(); - expect(blockDetails?.number).toBe(0); - expect(blockDetails?.id).toStrictEqual( - networkInfo.testnet.genesisBlock.id - ); - }); - }); -}); diff --git a/packages/network/tests/thor-client/blocks/fixture.ts b/packages/network/tests/thor-client/blocks/fixture.ts deleted file mode 100644 index 3be0a5f87..000000000 --- a/packages/network/tests/thor-client/blocks/fixture.ts +++ /dev/null @@ -1,482 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; -import type { ExpandedBlockDetail } from '../../../src'; - -/** - * waitForBlock test cases - */ -const waitForBlockTestCases = [ - { - options: { - timeoutMs: undefined, - intervalMs: undefined - } - }, - { - options: { - timeoutMs: 12000, - intervalMs: undefined - } - }, - { - options: { - timeoutMs: undefined, - intervalMs: 1000 - } - }, - { - options: { - timeoutMs: 11000, - intervalMs: 1000 - } - } -]; - -const validCompressedBlockRevisions = [ - { - revision: '1', - expected: { - number: 1, - id: '0x000000019015bbd98fc1c9088d793ba9add53896a29cd9aa3a4dcabd1f561c38', - size: 236, - parentID: - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - timestamp: 1530014410, - gasLimit: 10000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 1, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x25ae0ef84da4a76d5a1dfe80d3789c2c46fee30a', - isTrunk: true, - isFinalized: true, - transactions: [] - } - }, - { - revision: '1', - expected: { - number: 1, - id: '0x000000019015bbd98fc1c9088d793ba9add53896a29cd9aa3a4dcabd1f561c38', - size: 236, - parentID: - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - timestamp: 1530014410, - gasLimit: 10000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 1, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x25ae0ef84da4a76d5a1dfe80d3789c2c46fee30a', - isTrunk: true, - isFinalized: true, - transactions: [] - } - }, - { - revision: - '0x00000002e6922bf34b716c736cd95b6602d8255d0c57f975abbe0d4ec34c06c4', - expected: { - number: 2, - id: '0x00000002e6922bf34b716c736cd95b6602d8255d0c57f975abbe0d4ec34c06c4', - size: 236, - parentID: - '0x000000019015bbd98fc1c9088d793ba9add53896a29cd9aa3a4dcabd1f561c38', - timestamp: 1530014420, - gasLimit: 10000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 2, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x25ae0ef84da4a76d5a1dfe80d3789c2c46fee30a', - isTrunk: true, - isFinalized: true, - transactions: [] - } - }, - { - revision: 2, - expected: { - number: 2, - id: '0x00000002e6922bf34b716c736cd95b6602d8255d0c57f975abbe0d4ec34c06c4', - size: 236, - parentID: - '0x000000019015bbd98fc1c9088d793ba9add53896a29cd9aa3a4dcabd1f561c38', - timestamp: 1530014420, - gasLimit: 10000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 2, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x25ae0ef84da4a76d5a1dfe80d3789c2c46fee30a', - isTrunk: true, - isFinalized: true, - transactions: [] - } - } -]; - -const validExpandedBlockRevisions = [ - { - revision: '1', - expected: { - number: 1, - id: '0x000000019015bbd98fc1c9088d793ba9add53896a29cd9aa3a4dcabd1f561c38', - size: 236, - parentID: - '0x000000000b2bce3c70bc649a02749e8687721b09ed2e15997f466536b20bb127', - timestamp: 1530014410, - gasLimit: 10000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 1, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x4ec3af0acbad1ae467ad569337d2fe8576fe303928d35b8cdd91de47e9ac84bb', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: false, - signer: '0x25ae0ef84da4a76d5a1dfe80d3789c2c46fee30a', - isTrunk: true, - isFinalized: true, - transactions: [] - } - }, - { - revision: - '0x01038ee9f989843a7beb3897232f4fd9ac0bc4897545b9c3151f82ece45c9628', - expected: { - number: 17010409, - id: '0x01038ee9f989843a7beb3897232f4fd9ac0bc4897545b9c3151f82ece45c9628', - size: 494, - parentID: - '0x01038ee8daf9f3094b55fda706f17ba74845eaa57fb5247d2a9997c374906509', - timestamp: 1700135460, - gasLimit: 30000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 21000, - totalScore: 132697198, - txsRoot: - '0x21f1dc5a129d3ce558a1cbd6abd9b6baabd024e1deba7c6b285ade1b71762a9f', - txsFeatures: 1, - stateRoot: - '0xd5793ff22938f2d875ae4c33b6d95356450397225bfc69e97b5f1b8f26eedb0f', - receiptsRoot: - '0xc49772fc8a4013db440de4014b4492dec2516f8ae878d69c6e4a1fd8e8018c75', - com: true, - signer: '0xab7b27fc9e7d29f9f2e5bd361747a5515d0cc2d1', - isTrunk: true, - isFinalized: true, - transactions: [ - { - id: '0x42720d768659aabff05c456acdd4e1f5c5672740a3728fbc0681117e4868167f', - chainTag: 39, - blockRef: '0x01038ee704383133', - expiration: 2000, - clauses: [ - { - to: '0x9840acbcd7417ceee8117da585a3c3f6642c8a52', - value: '0xde0b6b3a7640000', - data: '0x' - } - ], - gasPriceCoef: 0, - gas: 21000, - origin: '0x6b8d66568cbc7944798268aca153f426596d250a', - delegator: null, - nonce: '0x4ec144ad97b4b079', - dependsOn: null, - size: 130, - gasUsed: 21000, - gasPayer: '0x6b8d66568cbc7944798268aca153f426596d250a', - paid: '0x2ea11e32ad50000', - reward: '0xdfd22a8cd98000', - reverted: false, - outputs: [ - { - contractAddress: null, - events: [], - transfers: [ - { - sender: '0x6b8d66568cbc7944798268aca153f426596d250a', - recipient: - '0x9840acbcd7417ceee8117da585a3c3f6642c8a52', - amount: '0xde0b6b3a7640000' - } - ] - } - ] - } - ] - } - } -]; - -const invalidBlockRevisions = [ - { - description: 'Should throw error for invalid revision', - revision: 'invalid-revision', - expectedError: InvalidDataType - } -]; - -const expandedBlockDetailFixture: ExpandedBlockDetail = { - number: 17229578, - id: '0x0106e70ac5e7a11f0d508a0f5dc5916e7e0bc837e4de4f79c9cfbef6a702ea32', - size: 1255, - parentID: - '0x0106e7096f12cedd83f4922791599ac90fadc054d796e4a47581e8726cb4c369', - timestamp: 1702821970, - gasLimit: 30000000, - beneficiary: '0x1eef8963e1222417af4dac0d98553abddb4a76b5', - gasUsed: 290302, - totalScore: 1680196497, - txsRoot: - '0xcbe8f25d8ef87a2d2664157d9df8872ec9840584423d2e327d7f31b697865164', - txsFeatures: 1, - stateRoot: - '0xbe07b1207976cadcdaff95bf4bca52c7f856e13711be9dcc1f4804001b0ff58b', - receiptsRoot: - '0x2a6f43d81cc422a6daf359b28c9e696c94b7246f9052c3ddbff523bc3ef4cbb7', - com: true, - signer: '0x6298c7a54720febdefd741d0899d287c70954c68', - isTrunk: true, - isFinalized: false, - transactions: [ - { - id: '0x9c2964962df2e2f9e6f378726d47df7c7a948dd98112043c838185f74c6a4e2f', - chainTag: '74', - blockRef: '0x0106e7096f12cedd', - expiration: 32, - clauses: [ - { - to: '0x576da7124c7bb65a692d95848276367e5a844d95', - value: '0x1043561a8829300000', - data: '0x7ff36ab50000000000000000000000000000000000000000000002394e270e08364000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000a416bdda32b00e218f08ace220bab512c863ff2f00000000000000000000000000000000000000000000000000000000657f0433000000000000000000000000000000000000000000000000000000000000000200000000000000000000000045429a2255e7248e57fce99e7239aed3f84b7a530000000000000000000000005db3c8a942333f6468176a870db36eef120a34dc' - } - ], - gasPriceCoef: 255, - gas: 253631, - origin: '0xa416bdda32b00e218f08ace220bab512c863ff2f', - delegator: '', - nonce: '0x2603c69707b46b55', - dependsOn: '', - size: 365, - gasUsed: 223631, - gasPayer: '0xa416bdda32b00e218f08ace220bab512c863ff2f', - paid: '0x3e11f0316b4ec000', - reward: '0x129efb420697a000', - reverted: false, - outputs: [ - { - contractAddress: null, - events: [ - { - address: - '0x45429a2255e7248e57fce99e7239aed3f84b7a53', - topics: [ - '0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', - '0x000000000000000000000000576da7124c7bb65a692d95848276367e5a844d95' - ], - data: '0x00000000000000000000000000000000000000000000001043561a8829300000' - }, - { - address: - '0x45429a2255e7248e57fce99e7239aed3f84b7a53', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x000000000000000000000000576da7124c7bb65a692d95848276367e5a844d95', - '0x0000000000000000000000001a8abd6d5627eb26ad71c0c7ae5224cdc640faf3' - ], - data: '0x00000000000000000000000000000000000000000000001043561a8829300000' - }, - { - address: - '0x5db3c8a942333f6468176a870db36eef120a34dc', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000001a8abd6d5627eb26ad71c0c7ae5224cdc640faf3', - '0x000000000000000000000000a416bdda32b00e218f08ace220bab512c863ff2f' - ], - data: '0x00000000000000000000000000000000000000000000023b04b1d40b515745aa' - }, - { - address: - '0x1a8abd6d5627eb26ad71c0c7ae5224cdc640faf3', - topics: [ - '0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1' - ], - data: '0x000000000000000000000000000000000000000000002f87e3cb2aaf503b96140000000000000000000000000000000000000000000687a8d57a3a1d0de7f46c' - }, - { - address: - '0x1a8abd6d5627eb26ad71c0c7ae5224cdc640faf3', - topics: [ - '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822', - '0x000000000000000000000000576da7124c7bb65a692d95848276367e5a844d95', - '0x000000000000000000000000a416bdda32b00e218f08ace220bab512c863ff2f' - ], - data: '0x00000000000000000000000000000000000000000000001043561a88293000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023b04b1d40b515745aa' - } - ], - transfers: [ - { - sender: '0xa416bdda32b00e218f08ace220bab512c863ff2f', - recipient: - '0x576da7124c7bb65a692d95848276367e5a844d95', - amount: '0x1043561a8829300000' - }, - { - sender: '0x576da7124c7bb65a692d95848276367e5a844d95', - recipient: - '0x45429a2255e7248e57fce99e7239aed3f84b7a53', - amount: '0x1043561a8829300000' - } - ] - } - ] - }, - { - id: '0x3e15b509f2109a60c3f1cfdb198b59b46d4792b777333119e819e11b69a190d8', - chainTag: '74', - blockRef: '0x0106e7096f12cedd', - expiration: 720, - clauses: [ - { - to: '0x23a46368e4acc7bb2fe0afeb054def51ec56aa74', - value: '0xac576e2a31c35a0000', - data: '0x000000606060' - } - ], - gasPriceCoef: 128, - gas: 29000, - origin: '0xbeae4bef0121f11d269aedf6adb227259d4314ad', - delegator: '0xbeae4bef0121f11d269aedf6adb227259d4314ad', - nonce: '0x33f2b93', - dependsOn: '', - size: 200, - gasUsed: 21216, - gasPayer: '0xbeae4bef0121f11d269aedf6adb227259d4314ad', - paid: '0x46c17f1958beae0', - reward: '0x153a0c879a9f9a9', - reverted: false, - outputs: [ - { - contractAddress: null, - events: [], - transfers: [ - { - sender: '0xbeae4bef0121f11d269aedf6adb227259d4314ad', - recipient: - '0x23a46368e4acc7bb2fe0afeb054def51ec56aa74', - amount: '0xac576e2a31c35a0000' - } - ] - } - ] - }, - { - id: '0x09804e17727ca0bee6521ae50e15653a8770edade8ac0e36bdda646e09af9c13', - chainTag: '74', - blockRef: '0x0106e7096f12cedd', - expiration: 720, - clauses: [ - { - to: '0x0000000000000000000000000000456e65726779', - value: '0x0', - data: '0xa9059cbb00000000000000000000000031437d38b38a5cb28dacb0379dbf0b5185e10643000000000000000000000000000000000000000000fbf26224799870e5280000' - } - ], - gasPriceCoef: 10, - gas: 31990, - origin: '0x95fe74d1ae072ee45bdb09879a157364e5341565', - delegator: '', - nonce: '0x4b129bf90751676e', - dependsOn: '', - size: 193, - gasUsed: 24455, - gasPayer: '0x95fe74d1ae072ee45bdb09879a157364e5341565', - paid: '0x386e3296e67232f', - reward: '0x10eddbfa11ef0f4', - reverted: true, - outputs: [] - }, - { - id: '0xab4c2867d90f6ea27e8eac6b180ca43c267be82593ac15aa801bf70de7301354', - chainTag: '74', - blockRef: '0x0106e7096f12cedd', - expiration: 720, - clauses: [ - { - to: '0xb7591602c0c9d525bc3a7cf3c729fd91b8bf5bf6', - value: '0xe18cc1b1e0e8c20000', - data: '0x' - } - ], - gasPriceCoef: 0, - gas: 21000, - origin: '0x9a107a75cff525b033a3e53cadafe3d193b570ec', - delegator: '', - nonce: '0x7bced3146d8fb8fc', - dependsOn: '', - size: 131, - gasUsed: 21000, - gasPayer: '0x9a107a75cff525b033a3e53cadafe3d193b570ec', - paid: '0x2ea11e32ad50000', - reward: '0xdfd22a8cd98000', - reverted: false, - outputs: [ - { - contractAddress: - '0xb2c20a6de401003a671659b10629eb82ff254fb8', - events: [], - transfers: [ - { - sender: '0x9a107a75cff525b033a3e53cadafe3d193b570ec', - recipient: - '0xb7591602c0c9d525bc3a7cf3c729fd91b8bf5bf6', - amount: '0xe18cc1b1e0e8c20000' - } - ] - } - ] - } - ] -}; - -export { - waitForBlockTestCases, - validCompressedBlockRevisions, - validExpandedBlockRevisions, - invalidBlockRevisions, - expandedBlockDetailFixture -}; diff --git a/packages/network/tests/thor-client/contracts/contract.erc20.solo.test.ts b/packages/network/tests/thor-client/contracts/contract.erc20.solo.test.ts deleted file mode 100644 index 716943b21..000000000 --- a/packages/network/tests/thor-client/contracts/contract.erc20.solo.test.ts +++ /dev/null @@ -1,465 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { Address, ERC20_ABI, HexUInt } from '@vechain/sdk-core'; -import { - ProviderInternalBaseWallet, - THOR_SOLO_URL, - ThorClient, - type TransactionReceipt, - VeChainPrivateKeySigner, - VeChainProvider, - type VeChainSigner -} from '../../../src'; -import { TEST_ACCOUNTS } from '../../fixture'; -import { erc20ContractBytecode } from './fixture'; - -/** - * Tests for the ThorClient class, specifically focusing on ERC20 contract-related functionality. - * - * @NOTE: This test suite runs on the solo network because it requires sending transactions. - * - * @group integration/client/thor-client/contracts/erc20 - */ -describe('ThorClient - ERC20 Contracts', () => { - // ThorClient instance - let thorSoloClient: ThorClient; - - // Signer instance - let signer: VeChainSigner; - - let providerWithDelegationPrivateKeyEnabled: VeChainProvider; - - beforeEach(() => { - thorSoloClient = ThorClient.at(THOR_SOLO_URL); - signer = new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey - ).bytes, - new VeChainProvider(thorSoloClient) - ); - - // Create the provider (used in this case to sign the transaction with getSigner() method) - providerWithDelegationPrivateKeyEnabled = new VeChainProvider( - // Thor client used by the provider - thorSoloClient, - - // Internal wallet used by the provider (needed to call the getSigner() method) - new ProviderInternalBaseWallet( - [ - { - privateKey: HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER - .privateKey - ).bytes, - address: - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address - } - ], - { - delegator: { - delegatorPrivateKey: - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.privateKey - } - } - ), - - // Enable fee delegation - true - ); - }); - - /** - * Test the deployment of an ERC20 contract using the thorSoloClient. - */ - test('deployErc20Contract with Contract Factory', async () => { - // Deploy the ERC20 contract and receive a response - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - expect(factory.getDeployTransaction()).not.toBe(undefined); - - const contract = await factory.waitForDeployment(); - - expect(contract.address).not.toBe(null); - expect(Address.isValid(contract.address)).toBe(true); - }, 10000); - - /** - * Tests the execution of ERC20 contract operations using a blockchain client. - * - * This test covers the deployment of an ERC20 token contract, executing a transfer transaction, - * and verifying the transaction's effects. It begins by deploying the contract and obtaining - * its address. A transfer operation is then executed to transfer tokens to a specified address. - * Finally, the test verifies that the transaction was successful and that the recipient's balance - * reflects the transferred amount. - * - */ - test('Execute ERC20 contract operations', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - const transferResult = await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ); - - // Wait for the transfer transaction to complete and obtain its receipt - const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - - // Verify that the transfer transaction did not revert - expect(transactionReceiptTransfer.reverted).toBe(false); - - // Execute a 'balanceOf' call on the contract to check the balance of the receiver - const balanceOfResult = await contract.read.balanceOf( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ); - - // Ensure that the transfer transaction was successful and the balance is as expected - expect(transactionReceiptTransfer.reverted).toBe(false); - expect(balanceOfResult).toEqual([1000n]); - }, 10000); // Set a timeout of 10000ms for this test - - test('Execute ERC20 contract operations with comments', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - const transferResult = await contract.transact.transfer( - { value: 0, comment: 'Transfer 1000 tokens' }, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ); - - // Wait for the transfer transaction to complete and obtain its receipt - const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - - // Verify that the transfer transaction did not revert - expect(transactionReceiptTransfer.reverted).toBe(false); - - // Execute a 'balanceOf' call on the contract to check the balance of the receiver - const balanceOfResult = await contract.read.balanceOf( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ); - - // Ensure that the transfer transaction was successful and the balance is as expected - expect(transactionReceiptTransfer.reverted).toBe(false); - expect(balanceOfResult).toEqual([1000n]); - }, 10000); // Set a timeout of 10000ms for this test - - test('Execute ERC20 contract operations with revision', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - const transferResult = await contract.transact.transfer( - { value: 0, revision: 'best' }, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ); - - // Wait for the transfer transaction to complete and obtain its receipt - const transactionReceiptTransfer = - (await transferResult.wait()) as TransactionReceipt; - - // Verify that the transfer transaction did not revert - expect(transactionReceiptTransfer.reverted).toBe(false); - - // Execute a 'balanceOf' call on the contract to check the balance of the receiver - const balanceOfResult = await contract.read.balanceOf( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ); - - // Ensure that the transfer transaction was successful and the balance is as expected - expect(transactionReceiptTransfer.reverted).toBe(false); - expect(balanceOfResult).toEqual([1000n]); - }, 10000); - - /** - * Test transaction execution with delegation. - */ - test('transaction execution with delegation', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - contract.setContractTransactOptions({ - signTransactionOptions: { - delegatorPrivateKey: - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.privateKey - }, - isDelegated: true - }); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 1000n - ) - ).wait(); - }, 10000); - - /** - * Test transaction execution with delegation set from contract. - */ - test('transaction execution with delegation set from contract', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - (await providerWithDelegationPrivateKeyEnabled.getSigner( - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address - )) as VeChainSigner - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - const txResult = await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 1000n - ) - ).wait(); - - expect(txResult?.reverted).toBe(false); - - expect( - await contract.read.balanceOf( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address - ) - ).toEqual([1000n]); - }, 10000); - - /** - * Tests the execution of multiple ERC20 contract read clauses using a blockchain client. - */ - test('Execute multiple ERC20 read contract clauses', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - const contractRead = - await thorSoloClient.contracts.executeMultipleClausesCall([ - contract.clause.name(), - contract.clause.symbol(), - contract.clause.decimals() - ]); - - expect(contractRead[0]).toEqual({ - success: true, - result: { - plain: 'SampleToken', - array: ['SampleToken'] - } - }); - expect(contractRead[1]).toEqual({ - success: true, - result: { - plain: 'ST', - array: ['ST'] - } - }); - expect(contractRead[2]).toEqual({ - success: true, - result: { - plain: 18, - array: [18] - } - }); - }, 10000); - - /** - * Tests the execution of multiple ERC20 reverted read clauses. - */ - test('Execute multiple ERC20 read contract clauses that reverts', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - const contractRead = - await thorSoloClient.contracts.executeMultipleClausesCall([ - contract.clause.name(), - contract.clause.symbol(), - contract.clause.decimals() - ]); - - expect(contractRead[0]).toEqual({ - success: true, - result: { - plain: 'SampleToken', - array: ['SampleToken'] - } - }); - expect(contractRead[1]).toEqual({ - success: true, - result: { - plain: 'ST', - array: ['ST'] - } - }); - expect(contractRead[2]).toEqual({ - success: true, - result: { - plain: 18, - array: [18] - } - }); - }, 10000); - - /** - * Tests the execution of multiple ERC20 contract clauses using a blockchain client. - */ - test('Execute multiple ERC20 contract clauses', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute multiple 'transfer' transactions on the deployed contract, - const txResult = - await thorSoloClient.contracts.executeMultipleClausesTransaction( - [ - contract.clause.transfer( - { comment: 'Transfer 1000 tokens' }, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ), - contract.clause.transfer( - { comment: 'Transfer 1000 tokens' }, - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 1000n - ), - contract.clause.transfer( - { comment: 'Transfer 3000 tokens' }, - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 3000n - ) - ], - signer - ); - - await txResult.wait(); - - const reads = await thorSoloClient.contracts.executeMultipleClausesCall( - [ - contract.clause.balanceOf( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ), - contract.clause.balanceOf( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address - ) - ] - ); - - expect(reads[0]).toEqual({ - success: true, - result: { - plain: 1000n, - array: [1000n] - } - }); - - expect(reads[1]).toEqual({ - success: true, - result: { - plain: 4000n, - array: [4000n] - } - }); - }, 10000); - - /** - * Test transaction execution with url delegation set from contract. - */ - test('transaction execution with private key delegation', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - (await providerWithDelegationPrivateKeyEnabled.getSigner( - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address - )) as VeChainSigner - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - const txResult = await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 1000n - ) - ).wait(); - - expect(txResult?.reverted).toBe(false); - - expect( - await contract.read.balanceOf( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address - ) - ).toEqual([1000n]); - }, 30000); -}); diff --git a/packages/network/tests/thor-client/contracts/contract.erc20.testnet.test.ts b/packages/network/tests/thor-client/contracts/contract.erc20.testnet.test.ts deleted file mode 100644 index d6ab90733..000000000 --- a/packages/network/tests/thor-client/contracts/contract.erc20.testnet.test.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - ProviderInternalBaseWallet, - TESTNET_URL, - ThorClient, - type TransactionReceipt, - VeChainProvider, - type VeChainSigner -} from '../../../src'; -import { TEST_ACCOUNTS } from '../../fixture'; -import { - ERC20_CONTRACT_ADDRESS_ON_TESTNET, - TESTNET_DELEGATE_URL -} from './fixture'; -import { ABIContract, ERC20_ABI, HexUInt } from '@vechain/sdk-core'; - -/** - * Tests for the ThorClient class, specifically focusing on ERC20 contract-related functionality. - * - * @group integration/client/thor-client/contracts/erc20 - */ -describe('ThorClient - ERC20 Contracts on testnet', () => { - // ThorClient instance - let thorTestnetClient: ThorClient; - let providerWithDelegationEnabled: VeChainProvider; - - beforeEach(() => { - thorTestnetClient = ThorClient.at(TESTNET_URL); - // Create the provider (used in this case to sign the transaction with getSigner() method) - providerWithDelegationEnabled = new VeChainProvider( - // Thor client used by the provider - thorTestnetClient, - - // Internal wallet used by the provider (needed to call the getSigner() method) - new ProviderInternalBaseWallet( - [ - { - privateKey: HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER - .privateKey - ).bytes, - address: - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - } - ], - { - delegator: { - delegatorUrl: TESTNET_DELEGATE_URL - } - } - ), - - // Enable fee delegation - true - ); - }); - - /** - * Test transaction execution with url delegation set from contract. - */ - test('transaction execution with url delegation set from contract', async () => { - const contract = thorTestnetClient.contracts.load( - ERC20_CONTRACT_ADDRESS_ON_TESTNET, - ERC20_ABI, - (await providerWithDelegationEnabled.getSigner( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - )) as VeChainSigner - ); - - const txResult = await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 1000n - ) - ).wait(); - - expect(txResult?.reverted).toBe(false); - }, 30000); - - /** - * Test transaction with url delegation per transaction. - */ - test('transaction with url delegation per transaction', async () => { - const txResult = await thorTestnetClient.contracts.executeTransaction( - (await providerWithDelegationEnabled.getSigner( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - )) as VeChainSigner, - ERC20_CONTRACT_ADDRESS_ON_TESTNET, - ABIContract.ofAbi(ERC20_ABI).getFunction('transfer'), - [TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, 1000n], - { - comment: 'test comment', - delegationUrl: TESTNET_DELEGATE_URL - } - ); - - const result = (await txResult.wait()) as TransactionReceipt; - - expect(result.reverted).toBeFalsy(); - expect(result.gasPayer).not.toBe(result.meta.txOrigin); - }, 30000); -}); diff --git a/packages/network/tests/thor-client/contracts/contract.erc721.solo.test.ts b/packages/network/tests/thor-client/contracts/contract.erc721.solo.test.ts deleted file mode 100644 index 705d8874f..000000000 --- a/packages/network/tests/thor-client/contracts/contract.erc721.solo.test.ts +++ /dev/null @@ -1,138 +0,0 @@ -// Global variable to hold contract address -import { beforeAll, describe, expect, test } from '@jest/globals'; -import { ABIContract, ERC721_ABI, Hex, HexUInt } from '@vechain/sdk-core'; -import { - THOR_SOLO_URL, - ThorClient, - type TransactionReceipt, - VeChainPrivateKeySigner, - VeChainProvider, - type VeChainSigner -} from '../../../src'; -import { TEST_ACCOUNTS } from '../../fixture'; -import { erc721ContractBytecode, erc721ContractTestCases } from './fixture'; - -/** - * Tests for the ERC721 Contract, specifically focusing on NFT contract-related functionality. - * - * @NOTE: This test suite runs on the solo network because it requires sending transactions. - * - * @group integration/client/thor-client/contracts/erc721 - */ -describe('ThorClient - ERC721 Contracts', () => { - // ThorClient instance - let thorSoloClient: ThorClient; - - // Signer instance - let signer: VeChainSigner; - - let contractAddress: string; - - /** - * Test the deployment of an ERC721 contract using the thorSoloClient. - * - * This test simulates the deployment of an ERC721 smart contract to a blockchain network - * using the thorSoloClient's deployContract method. It follows these steps: - * 1. Deploys the ERC721 contract with the given bytecode using the private key of - * the contract manager from TEST_ACCOUNTS. - * 2. Waits for the transaction to complete using the thorSoloClient's waitForTransaction - * method, and then retrieves the transaction receipt. - * 3. Extracts the contract address from the transaction receipt's outputs. - * - * The test asserts that the contract address is defined, ensuring that the contract - * deployment is successful and the address is correctly retrieved. - * - * @remarks - * The test has a timeout of 10000 milliseconds to account for the potential delay in - * blockchain transaction processing. - */ - beforeAll(async () => { - thorSoloClient = ThorClient.at(THOR_SOLO_URL); - signer = new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey - ).bytes, - new VeChainProvider(thorSoloClient) - ); - - // Create the ERC721 contract factory - - const factory = thorSoloClient.contracts.createContractFactory( - ERC721_ABI, - erc721ContractBytecode, - signer - ); - - await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - const transactionReceiptDeployContract = - contract.deployTransactionReceipt; - - expect(transactionReceiptDeployContract).toBeDefined(); - expect( - transactionReceiptDeployContract?.outputs[0].contractAddress - ).toBeDefined(); - - contractAddress = transactionReceiptDeployContract?.outputs[0] - .contractAddress as string; - - expect(contractAddress).toBeDefined(); - }, 10000); - - erc721ContractTestCases.forEach( - ({ description, functionName, params, expected, isReadOnly }) => { - test( - description, - async () => { - let response; - if (isReadOnly) { - response = await thorSoloClient.contracts.executeCall( - contractAddress, - ABIContract.ofAbi(ERC721_ABI).getFunction( - functionName - ), - params - ); - expect(response).toBeDefined(); - expect(response).toEqual(expected); - } else { - response = - await thorSoloClient.contracts.executeTransaction( - signer, - contractAddress, - ABIContract.ofAbi(ERC721_ABI).getFunction( - functionName - ), - params - ); - - const result = await response.wait(); - - expect(result).toBeDefined(); - expect(result?.outputs).toBeDefined(); - - const logDescriptions = decodeResultOutput( - result as TransactionReceipt - ); - - expect(logDescriptions[0][0]).toEqual(expected); - } - }, - 10000 - ); - } - ); - - function decodeResultOutput(result: TransactionReceipt): unknown[][] { - return result?.outputs.map((output) => { - return output.events.map((event) => { - return ABIContract.ofAbi(ERC721_ABI).parseLogAsArray( - Hex.of(event.data), - event.topics.map((topic) => Hex.of(topic)) - ); - }); - }); - } -}); diff --git a/packages/network/tests/thor-client/contracts/contract.event.mainnet.test.ts b/packages/network/tests/thor-client/contracts/contract.event.mainnet.test.ts deleted file mode 100644 index cfed2272c..000000000 --- a/packages/network/tests/thor-client/contracts/contract.event.mainnet.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { MAINNET_URL, ThorClient } from '../../../src'; - -import { B3TR, X2EarnRewardsPool } from '@vechain/vebetterdao-contracts'; -import { FixedPointNumber, Units } from '@vechain/sdk-core'; - -/** - * Mainnet - Tests for the ThorClient class, focused on event-related functionality. - * - * @group integration/client/thor-client/contracts/event - */ -describe('ThorClient - Mainnet allocation events', () => { - // ThorClient instance - let thorMainnetClient: ThorClient; - - const EVEARN_APP_ID = - '0x6c977a18d427360e27c3fc2129a6942acd4ece2c8aaeaf4690034931dc5ba7f9'; - - beforeEach(() => { - thorMainnetClient = ThorClient.at(MAINNET_URL); - }); - - test('Should filter EVearn distribute rewards events', async () => { - const x2EarnRewardsPoolContract = thorMainnetClient.contracts.load( - X2EarnRewardsPool.address.mainnet, - X2EarnRewardsPool.abi - ); - - const events = await x2EarnRewardsPoolContract.filters - .RewardDistributed({ - appId: EVEARN_APP_ID - }) - .get({ order: 'desc', options: { offset: 0, limit: 1000 } }); - - expect(events).toBeDefined(); - expect(events.length).toBeGreaterThan(0); - }, 30000); - - test('Should filter EVearn distribute rewards events', async () => { - const B3TRContract = thorMainnetClient.contracts.load( - B3TR.address.mainnet, - B3TR.abi - ); - - const events = await B3TRContract.filters - .Transfer({ - from: '0x190ab784b0b68deec7e831502dd65fdd1d2a8f99' - }) - .get({ order: 'desc', options: { offset: 0, limit: 1000 } }); - - let amount: bigint = 0n; - - for (const event of events) { - if (event?.decodedData !== undefined) { - amount += event.decodedData[2] as bigint; - } - } - - console.log( - 'Total B3TR transferred:', - Units.formatEther(FixedPointNumber.of(amount)) - ); - expect(events.length).toBeGreaterThan(0); - console.log(events[0]); - }, 30000); -}); diff --git a/packages/network/tests/thor-client/contracts/contract.event.solo.test.ts b/packages/network/tests/thor-client/contracts/contract.event.solo.test.ts deleted file mode 100644 index c40f25a66..000000000 --- a/packages/network/tests/thor-client/contracts/contract.event.solo.test.ts +++ /dev/null @@ -1,563 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { ERC20_ABI, HexUInt } from '@vechain/sdk-core'; -import { InvalidAbiItem } from '@vechain/sdk-errors'; -import { - THOR_SOLO_URL, - ThorClient, - VeChainPrivateKeySigner, - VeChainProvider, - type VeChainSigner -} from '../../../src'; -import { TEST_ACCOUNTS } from '../../fixture'; -import { - erc20ContractBytecode, - eventExampleAbi, - eventExampleBytecode -} from './fixture'; - -/** - * Tests for the ThorClient class, specifically focusing on ERC20 contract-related functionality. - * - * @NOTE: This test suite runs on the solo network because it requires sending transactions. - * - * @group integration/client/thor-client/contracts/erc20 - */ - -describe('ThorClient - ERC20 Contracts', () => { - // ThorClient instance - let thorSoloClient: ThorClient; - - // Signer instance - let signer: VeChainSigner; - - beforeEach(() => { - thorSoloClient = ThorClient.at(THOR_SOLO_URL); - signer = new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey - ).bytes, - new VeChainProvider(thorSoloClient) - ); - }); - - /** - * Tests the listening to ERC20 contract operations using a blockchain client. - */ - test('listen to ERC20 contract operations with the input as an args object and args array', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ) - ).wait(); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000n - ) - ).wait(); - - // listen with an array of args - const eventsWithArgsArray = await contract.filters - .Transfer([ - undefined, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ]) - .get(); - - const expectedEvents = [ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 1000n - ], - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 5000n - ] - ]; - - expect(eventsWithArgsArray.map((x) => x.decodedData)).toEqual( - expectedEvents - ); - - // listen with an args object - - const eventsWithAnArgsObject = await contract.filters - .Transfer({ - from: undefined, - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - }) - .get(); - - expect(eventsWithAnArgsObject.map((x) => x.decodedData)).toEqual( - expectedEvents - ); - }, 10000); // Set a timeout of 10000ms for this test - - /** - * Tests the listening to ERC20 contract operations using a blockchain client. - */ - test('listen to ERC20 contract operations building the criterias', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ) - ).wait(); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000n - ) - ).wait(); - - const transferCriteria = contract.criteria.Transfer([ - undefined, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ]); - - const events = await thorSoloClient.logs.filterEventLogs({ - criteriaSet: [transferCriteria] - }); - - expect( - events.map((event) => { - return event.data; - }) - ).toEqual([ - '0x00000000000000000000000000000000000000000000000000000000000003e8', - '0x0000000000000000000000000000000000000000000000000000000000001388' - ]); - - expect( - events.map((event) => { - return event.topics; - }) - ).toEqual([ - [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x000000000000000000000000f02f557c753edf5fcdcbfe4c1c3a448b3cc84d54', - '0x0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c39' - ], - [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x000000000000000000000000f02f557c753edf5fcdcbfe4c1c3a448b3cc84d54', - '0x0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c39' - ] - ]); - }, 10000); // Set a timeout of 10000ms for this test - - /** - * Tests the listening to ERC20 contract operations using a blockchain client. - */ - test('listen to ERC20 contract operations building the criterias and decoding the event logs', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ) - ).wait(); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000n - ) - ).wait(); - - const transferCriteria = contract.criteria.Transfer([ - undefined, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ]); - - const events = await thorSoloClient.logs.filterEventLogs({ - criteriaSet: [transferCriteria] - }); - - expect(events.map((x) => x.decodedData)).toEqual([ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 1000n - ], - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 5000n - ] - ]); - }, 10000); // Set a timeout of 10000ms for this test - - /** - * Tests the listening to ERC20 contract operations using a blockchain client. - */ - test('listen to ERC20 contract operations building the criterias and failing to decode the event logs due to wrong event ABI', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ) - ).wait(); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000n - ) - ).wait(); - - const transferCriteria = contract.criteria.Transfer([ - undefined, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ]); - - const approvalCriteria = contract.criteria.Approval(); - - await expect( - async () => - await thorSoloClient.logs.filterEventLogs({ - criteriaSet: [ - { - criteria: transferCriteria.criteria, - eventAbi: approvalCriteria.eventAbi - } - ] - }) - ).rejects.toThrowError(InvalidAbiItem); - }, 30000); - - /** - * Tests the listening to ERC20 contract operations using a blockchain client. - */ - test('listen to ERC20 raw contract operations with multiple criterias', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ) - ).wait(); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000n - ) - ).wait(); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 5000n - ) - ).wait(); - - const transferCriteria = contract.criteria.Transfer([ - undefined, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ]); - - const transferCriteriaDelegator = contract.criteria.Transfer([ - undefined, - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address - ]); - - const events = await thorSoloClient.logs.filterEventLogs({ - criteriaSet: [transferCriteria, transferCriteriaDelegator] - }); - - expect( - events.map((event) => { - return event.data; - }) - ).toEqual([ - '0x00000000000000000000000000000000000000000000000000000000000003e8', - '0x0000000000000000000000000000000000000000000000000000000000001388', - '0x0000000000000000000000000000000000000000000000000000000000001388' - ]); - - expect( - events.map((event) => { - return event.topics; - }) - ).toEqual([ - [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x000000000000000000000000f02f557c753edf5fcdcbfe4c1c3a448b3cc84d54', - '0x0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c39' - ], - [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x000000000000000000000000f02f557c753edf5fcdcbfe4c1c3a448b3cc84d54', - '0x0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c39' - ], - [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x000000000000000000000000f02f557c753edf5fcdcbfe4c1c3a448b3cc84d54', - '0x00000000000000000000000088b2551c3ed42ca663796c10ce68c88a65f73fe2' - ] - ]); - }, 20000); // Set a timeout of 10000ms for this test - - /** - * Tests the listening to ERC20 contract operations with multiple criteria decoding the result. - */ - test('listen to ERC20 decoded contract operations with multiple criterias', async () => { - // Deploy the ERC20 contract - let factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - factory = await factory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - // Execute a 'transfer' transaction on the deployed contract, - // transferring a specified amount of tokens - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000n - ) - ).wait(); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000n - ) - ).wait(); - - await ( - await contract.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 5000n - ) - ).wait(); - - const transferCriteria = contract.criteria.Transfer([ - undefined, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - ]); - - const transferCriteriaDelegator = contract.criteria.Transfer([ - undefined, - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address - ]); - - const events = await thorSoloClient.logs.filterEventLogs({ - criteriaSet: [transferCriteria, transferCriteriaDelegator] - }); - - expect(events.map((x) => x.decodedData)).toEqual([ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 1000n - ], - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 5000n - ], - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x88B2551c3Ed42cA663796c10Ce68C88A65f73FE2', - 5000n - ] - ]); - }, 20000); // Set a timeout of 10000ms for this test - - /** - * Tests the listening to ERC20 contract operations with multiple criteria decoding the result. - */ - test('listen to multiple contract operations with multiple criteria', async () => { - // Deploy the ERC20 contract - let erc20Factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - erc20Factory = await erc20Factory.startDeployment(); - - const contractERC20 = await erc20Factory.waitForDeployment(); - - // Deploy the EventExample contract - let factoryEventExample = - thorSoloClient.contracts.createContractFactory( - eventExampleAbi, - eventExampleBytecode, - signer - ); - - factoryEventExample = await factoryEventExample.startDeployment(); - - const contractEventExample = - await factoryEventExample.waitForDeployment(); - - await ( - await contractERC20.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000n - ) - ).wait(); - - await (await contractEventExample.transact.setValue(3000n)).wait(); - - const transferCriteria = contractERC20.criteria.Transfer({ - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - }); - - const valueCriteria = contractEventExample.criteria.ValueSet(); - - const events = await thorSoloClient.logs.filterEventLogs({ - criteriaSet: [transferCriteria, valueCriteria] - }); - - console.log(events); - - expect(events[0].decodedData).toEqual([ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 5000n - ]); - - expect(events[1].decodedData).toEqual([ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - 3000n - ]); - }, 20000); // Set a timeout of 10000ms for this test - - /** - * Tests the listening to ERC20 contract operations with multiple criteria decoding the result using the method to group the event by topic. - */ - test('listen to multiple contract operations with multiple criteria using the method to group the event by topic', async () => { - // Deploy the ERC20 contract - let erc20Factory = thorSoloClient.contracts.createContractFactory( - ERC20_ABI, - erc20ContractBytecode, - signer - ); - - erc20Factory = await erc20Factory.startDeployment(); - - const contractERC20 = await erc20Factory.waitForDeployment(); - - // Deploy the EventExample contract - let factoryEventExample = - thorSoloClient.contracts.createContractFactory( - eventExampleAbi, - eventExampleBytecode, - signer - ); - - factoryEventExample = await factoryEventExample.startDeployment(); - - const contractEventExample = - await factoryEventExample.waitForDeployment(); - - await ( - await contractERC20.transact.transfer( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000n - ) - ).wait(); - - await (await contractEventExample.transact.setValue(3000n)).wait(); - - const transferCriteria = contractERC20.criteria.Transfer({ - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - }); - - const valueCriteria = contractEventExample.criteria.ValueSet(); - - const events = await thorSoloClient.logs.filterGroupedEventLogs({ - criteriaSet: [transferCriteria, valueCriteria] - }); - - console.log(events); - - expect(events[0].map((x) => x.decodedData)).toEqual([ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 5000n - ] - ]); - - expect(events[1].map((x) => x.decodedData)).toEqual([ - ['0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', 3000n] - ]); - }, 20000); // Set a timeout of 10000ms for this test -}); diff --git a/packages/network/tests/thor-client/contracts/contract.event.testnet.test.ts b/packages/network/tests/thor-client/contracts/contract.event.testnet.test.ts deleted file mode 100644 index 85b881413..000000000 --- a/packages/network/tests/thor-client/contracts/contract.event.testnet.test.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { TESTNET_URL, ThorClient } from '../../../src'; -import { - emissionAddress, - emissionsABI, - xAllocationAddress, - xAllocationVotingGovernorABI -} from './fixture'; - -/** - * Testnet - Tests for the ThorClient class, focused on event-related functionality. - * - * @group integration/client/thor-client/contracts/event - */ -describe('ThorClient - Testnet allocation events', () => { - // ThorClient instance - let thorTestnetClient: ThorClient; - - beforeEach(() => { - thorTestnetClient = ThorClient.at(TESTNET_URL); - }); - - test('Should filter x allocation events', async () => { - const xAllocationVotingContract = thorTestnetClient.contracts.load( - xAllocationAddress, - xAllocationVotingGovernorABI - ); - - const emissionsContract = thorTestnetClient.contracts.load( - emissionAddress, - emissionsABI - ); - - const roundCreatedCriteria = - xAllocationVotingContract.criteria.RoundCreated(); - const emissionDistributedCriteria = - emissionsContract.criteria.EmissionDistributed(); - - const xAllocationVotingEvents = - await thorTestnetClient.logs.filterEventLogs({ - criteriaSet: [ - roundCreatedCriteria, - emissionDistributedCriteria - ], - options: { - offset: 0, - limit: 256 - }, - order: 'asc' - }); - - expect(xAllocationVotingEvents).toBeDefined(); - expect(Array.from(xAllocationVotingEvents.keys()).length).toEqual(30); - expect(xAllocationVotingEvents.length).toBeGreaterThan(0); - }, 30000); - - test('Should filter x allocation events grouping them by type', async () => { - const xAllocationVotingContract = thorTestnetClient.contracts.load( - xAllocationAddress, - xAllocationVotingGovernorABI - ); - - const emissionsContract = thorTestnetClient.contracts.load( - emissionAddress, - emissionsABI - ); - - const roundCreatedCriteria = - xAllocationVotingContract.criteria.RoundCreated(); - const emissionDistributedCriteria = - emissionsContract.criteria.EmissionDistributed(); - - const xAllocationVotingEvents = - await thorTestnetClient.logs.filterGroupedEventLogs({ - criteriaSet: [ - roundCreatedCriteria, - emissionDistributedCriteria - ], - options: { - offset: 0, - limit: 256 - }, - order: 'asc' - }); - - expect(xAllocationVotingEvents).toBeDefined(); - expect(Array.from(xAllocationVotingEvents.keys()).length).toEqual(2); - expect(xAllocationVotingEvents[0].length).toBeGreaterThan(0); - expect(xAllocationVotingEvents[1].length).toBeGreaterThan(0); - }, 30000); -}); diff --git a/packages/network/tests/thor-client/contracts/contract.solo.test.ts b/packages/network/tests/thor-client/contracts/contract.solo.test.ts deleted file mode 100644 index 7d419f91b..000000000 --- a/packages/network/tests/thor-client/contracts/contract.solo.test.ts +++ /dev/null @@ -1,816 +0,0 @@ -/* eslint-disable */ - -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - ABIContract, - Address, - type DeployParams, - HexUInt -} from '@vechain/sdk-core'; -import { - CannotFindTransaction, - ContractDeploymentFailed, - InvalidTransactionField -} from '@vechain/sdk-errors'; -import { fail } from 'assert'; -import { - Contract, - type ContractFactory, - THOR_SOLO_URL, - ThorClient, - type TransactionReceipt, - VeChainPrivateKeySigner, - VeChainProvider, - type VeChainSigner -} from '../../../src'; -import { - TEST_ACCOUNTS, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS -} from '../../fixture'; -import { - contractBytecode, - deployedContractAbi, - deployedContractBytecode, - depositContractAbi, - depositContractBytecode, - filterContractEventsTestCases, - fourArgsEventAbi, - multipleClausesTestCases, - OWNER_RESTRICTION_ABI, - OWNER_RESTRICTION_BYTECODE, - sampleTwoValuesReturnAbi, - sampleTwoValuesReturnBytecode, - testingContractEVMExtensionTestCases, - testingContractNegativeTestCases, - testingContractTestCases -} from './fixture'; - -/** - * Tests for the ThorClient class, specifically focusing on contract-related functionality. - * - * @NOTE: This test suite runs on the solo network because it requires sending transactions. - * - * @group integration/client/thor-client/contracts - */ -describe('ThorClient - Contracts', () => { - // ThorClient instance - let thorSoloClient: ThorClient; - - // Signer instance - let signer: VeChainSigner; - - // Signer instance - let receiverSigner: VeChainSigner; - - beforeEach(() => { - thorSoloClient = ThorClient.at(THOR_SOLO_URL); - signer = new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.privateKey - ).bytes, - new VeChainProvider(thorSoloClient) - ); - - receiverSigner = new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.privateKey - ).bytes, - new VeChainProvider(thorSoloClient) - ); - }); - - /** - * Asynchronous function to deploy an example smart contract. - * - * @returns A promise that resolves to a `TransactionSendResult` object representing the result of the deployment. - */ - async function createExampleContractFactory(): Promise< - ContractFactory - > { - const deployParams: DeployParams = { types: 'uint', values: ['100'] }; - - const contractFactory = thorSoloClient.contracts.createContractFactory( - deployedContractAbi, - contractBytecode, - signer - ); - - // Start the deployment of the contract - return await contractFactory.startDeployment(deployParams); - } - - /** - * Test case for deploying a smart contract using the contract factory. - */ - test('create a new contract and call it', () => { - // Poll until the transaction receipt is available - const contract = new Contract( - '0x123', - deployedContractAbi, - thorSoloClient.contracts, - signer - ); - expect(contract.address).toBeDefined(); - expect(contract.abi).toBeDefined(); - }, 10000); - - /** - * Test case for deploying a smart contract using the contract factory. - */ - test('create a new contract', () => { - // Poll until the transaction receipt is available - const contract = new Contract( - '0x123', - deployedContractAbi, - thorSoloClient.contracts, - signer - ); - expect(contract.address).toBeDefined(); - expect(contract.abi).toBeDefined(); - }, 10000); - - /** - * Test case for deploying a smart contract using the contract factory. - */ - test('deploy a contract', async () => { - // Deploy an example contract and get the transaction response - const response = await createExampleContractFactory(); - - // Poll until the transaction receipt is available - const contract = await response.waitForDeployment(); - - expect(contract.address).toBeDefined(); - expect(contract.abi).toBeDefined(); - expect(contract.deployTransactionReceipt).toBeDefined(); - - // Extract the contract address from the transaction receipt - const contractAddress = contract.address; - - // Call the get function of the deployed contract to verify that the stored value is 100 - const result = await contract.read.get(); - - expect(result).toEqual([100n]); - - // Assertions - expect(contract.deployTransactionReceipt?.reverted).toBe(false); - expect(contract.deployTransactionReceipt?.outputs).toHaveLength(1); - expect(contractAddress).not.toBeNull(); - expect(Address.isValid(contractAddress)).toBe(true); - }, 10000); - - /** - * Test case for a failed smart contract using the contract factory. - */ - test('failed contract deployment', async () => { - // Create a contract factory - let contractFactory = thorSoloClient.contracts.createContractFactory( - deployedContractAbi, - contractBytecode, - signer - ); - - // Start the deployment of the contract - contractFactory = await contractFactory.startDeployment(); - - // Wait for the deployment to complete and obtain the contract instance - await expect(contractFactory.waitForDeployment()).rejects.toThrow( - ContractDeploymentFailed - ); - }, 10000); - - /** - * Test case for waiting for a contract deployment not started. - */ - test('wait for a contract deployment not started', async () => { - // Create a contract factory - const contractFactory = thorSoloClient.contracts.createContractFactory( - deployedContractAbi, - contractBytecode, - signer - ); - - // Waiting for a deployment that has not started - await expect(contractFactory.waitForDeployment()).rejects.toThrow( - CannotFindTransaction - ); - }, 10000); - - /** - * Test case for retrieving the bytecode of a deployed smart contract. - */ - test('get Contract Bytecode', async () => { - // Create a contract factory already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - // Retrieve the bytecode of the deployed contract - const contractBytecodeResponse = - await thorSoloClient.accounts.getBytecode( - Address.of(contract.address) - ); - - // Assertion: Compare with the expected deployed contract bytecode - expect(`${contractBytecodeResponse}`).toBe(deployedContractBytecode); - }, 10000); - - /** - * Test case for deploying a smart contract using the contract factory. - */ - test('call a contract function', async () => { - // Create a contract factory that is already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - const callFunctionSetResponse = await contract.transact.set(123n); - - const transactionReceiptCallSetContract = - (await callFunctionSetResponse.wait()) as TransactionReceipt; - - expect(transactionReceiptCallSetContract.reverted).toBe(false); - - const callFunctionGetResult = await contract.read.get(); - - expect(callFunctionGetResult).toEqual([123n]); - }, 10000); - - /** - * Test case for calling a contract function with options. - */ - test('call a contract function with options', async () => { - // Create a contract factory that is already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - await (await contract.transact.set(123n)).wait(); - expect(await contract.read.get()).toEqual([123n]); - - contract.setContractReadOptions({ caller: 'invalid address' }); - - // The contract call should fail because the caller address is invalid - await expect(contract.read.get()).rejects.toThrow(); - - contract.clearContractReadOptions(); - - contract.setContractTransactOptions({ - gasPriceCoef: 2442442, - expiration: 32 - }); - - contract.clearContractTransactOptions(); - - await (await contract.transact.set(22323n)).wait(); - expect(await contract.read.get()).toEqual([22323n]); - }, 15000); - - /** - * Test case for calling a contract function with different private keys. - */ - test('call a contract function with different signer', async () => { - // Create a contract factory that is already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - // Set signer with another private key - contract.setSigner( - new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.privateKey - ).bytes, - new VeChainProvider(thorSoloClient) - ) - ); - - // The contract call should fail because the private key is not set - // await expect(contract.transact.set(123n)).rejects.toThrow(); - - contract.setSigner(signer); - - await (await contract.transact.set(123n)).wait(); - - const callFunctionGetResult = await contract.read.get(); - - expect(callFunctionGetResult).toEqual([123n]); - }, 10000); - - /** - * Test case for loading a deployed contract and calling its functions. - */ - test('load a deployed contract and call its functions', async () => { - // Create a contract factory that is already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - // Load the deployed contract using the contract address, ABI and private key - const loadedContract = thorSoloClient.contracts.load( - contract.address, - deployedContractAbi - ); - - // Call the get function of the loaded contract to verify that the stored value is 100 - let callFunctionGetResult = await loadedContract.read.get(); - - expect(callFunctionGetResult).toEqual([100n]); - - // Set the private key of the caller for signing transactions - loadedContract.setSigner(contract.getSigner() as VeChainSigner); - - // Call the set function of the loaded contract to set the value to 123 - const callFunctionSetResponse = await loadedContract.transact.set(123n); - - // Wait for the transaction to complete and obtain the transaction receipt - const transactionReceiptCallSetContract = - (await callFunctionSetResponse.wait()) as TransactionReceipt; - - expect(transactionReceiptCallSetContract.reverted).toBe(false); - - callFunctionGetResult = await loadedContract.read.get(); - - // Assertion: The value should be 123 - expect(callFunctionGetResult).toEqual([123n]); - }, 10000); - - /** - * Test case for loading a deployed contract and trying to get not existing functions and events. - */ - test('load a deployed contract and try to get not existing functions and events', async () => { - // Create a contract factory that is already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - // Load the deployed contract using the contract address, ABI and private key - const loadedContract = thorSoloClient.contracts.load( - contract.address, - deployedContractAbi - ); - - // The get function ABI call should fail because the function does not exist - expect(() => - loadedContract.getFunctionAbi('notExistingFunction') - ).toThrow(); - - // The get event ABI call should fail because the event does not exist - expect(() => - loadedContract.getEventAbi('notExistingFunction') - ).toThrow(); - }, 10000); - - /** - * Test case for loading a deployed contract without adding a private key - */ - test('load a deployed contract without adding a private key and transact', async () => { - // Create a contract factory that is already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - // Load the deployed contract using the contract address, ABI and private key - const loadedContract = thorSoloClient.contracts.load( - contract.address, - deployedContractAbi - ); - - // The contract call should fail because the private key is not set - await expect(loadedContract.transact.set(123n)).rejects.toThrowError( - InvalidTransactionField - ); - }, 10000); - - /** - * Test case for creating a filter for a contract event. - */ - test('Create a filter for a four args event', () => { - // Load the deployed contract using the contract address, ABI and private key - const loadedContract = thorSoloClient.contracts.load( - '0x0000000000000000000000000000456e65726779', - fourArgsEventAbi - ); - - const contractFilter = loadedContract.filters.DataUpdated({ - sender: '0x0000000000000000000000000000456e65726779', - key: 10n, - oldValue: 10n, - newValue: 10n - }); - - expect(contractFilter).toBeDefined(); - expect(contractFilter.criteriaSet[0].criteria.topic0).toBeDefined(); - expect(contractFilter.criteriaSet[0].criteria.topic1).toBeDefined(); - expect(contractFilter.criteriaSet[0].criteria.topic2).toBeDefined(); - expect(contractFilter.criteriaSet[0].criteria.topic3).toBeDefined(); - expect(contractFilter.criteriaSet[0].criteria.topic4).toBeDefined(); - }, 10000); - - test('Deploy the deposit contract and call the deposit method', async () => { - const depositContractFactory = - thorSoloClient.contracts.createContractFactory( - depositContractAbi, - depositContractBytecode, - signer - ); - - const depositContract = await depositContractFactory.startDeployment(); - - const deployedDepositContract = - await depositContract.waitForDeployment(); - - const result = await deployedDepositContract.transact.deposit({ - value: 1000 - }); - - await result.wait(); - - expect( - await deployedDepositContract.read.getBalance( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ) - ).toEqual([1000n]); - }, 10000); - - test('Deploy a contract that returns two values', async () => { - const twoValuesReturnContractFactory = - thorSoloClient.contracts.createContractFactory( - sampleTwoValuesReturnAbi, - sampleTwoValuesReturnBytecode, - signer - ); - - const twoValuesReturnContract = - await twoValuesReturnContractFactory.startDeployment(); - - const deployedTwoValuesReturnContractContract = - await twoValuesReturnContract.waitForDeployment(); - - const [firstResultA, firstResultB] = - await deployedTwoValuesReturnContractContract.read.a(); - const resultB = await deployedTwoValuesReturnContractContract.read.b(); - - expect(firstResultA).toEqual(1n); - expect(firstResultB).toEqual('a'); - expect(resultB).toEqual([]); - }, 10000); - - /** - * Test case for deploying a contract with ownership restrictions. - */ - test('Deploy the ownership restricted contract and call it', async () => { - const contractFactory = thorSoloClient.contracts.createContractFactory( - OWNER_RESTRICTION_ABI, - OWNER_RESTRICTION_BYTECODE, - signer - ); - - const factory = await contractFactory.startDeployment(); - - const deployedContract = await factory.waitForDeployment(); - - const [secretData] = await deployedContract.read.getSecretData(); - - expect(secretData).toEqual(42n); - - const loadedContract = thorSoloClient.contracts.load( - deployedContract.address, - OWNER_RESTRICTION_ABI, - receiverSigner - ); - try { - await loadedContract.read.getSecretData(); - fail('Should fail'); - } catch (error) { - if (error instanceof Error) { - expect(error.message).toEqual( - `Method 'getSecretData()' failed.` + - `\n-Reason: 'Not the contract owner'` + - `\n-Parameters: \n\t` + - `{\n "contractAddress": "${deployedContract.address}"\n}` - ); - } - } - }); - - /** - * Test case for loading a deployed contract and trying to get not existing functions and events. - */ - test('load a deployed contract and create clauses with comments', async () => { - // Create a contract factory that is already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - // Load the deployed contract using the contract address, ABI and private key - const loadedContract = thorSoloClient.contracts.load( - contract.address, - deployedContractAbi - ); - - const clauseSet1 = loadedContract.clause.set( - { - comment: 'set the value in the contract to 123' - }, - 123n - ); - - const clauseSet2 = loadedContract.clause.set( - { comment: 'set the value in the contract to 321' }, - 321n - ); - - expect(clauseSet1).toBeDefined(); - expect(clauseSet2).toBeDefined(); - - expect(clauseSet1.clause.comment).toBe( - 'set the value in the contract to 123' - ); - expect(clauseSet1.clause.abi).toEqual( - '{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}' - ); - expect(clauseSet2.clause.comment).toBe( - 'set the value in the contract to 321' - ); - expect(clauseSet2.clause.abi).toEqual( - '{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}' - ); - }, 10000); - - test('load a deployed contract and create clauses with revision', async () => { - // Create a contract factory that is already deploying the example contract - const factory = await createExampleContractFactory(); - - // Wait for the deployment to complete and obtain the contract instance - const contract = await factory.waitForDeployment(); - - // Load the deployed contract using the contract address, ABI and private key - const loadedContract = thorSoloClient.contracts.load( - contract.address, - deployedContractAbi - ); - - const clauseSet1 = loadedContract.clause.set( - { - revision: 'finalized' - }, - 123n - ); - - const clauseSet2 = loadedContract.clause.set( - { comment: 'set the value in the contract to 321' }, - 321n - ); - - expect(clauseSet1.clause.abi).toEqual( - '{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}' - ); - - expect(clauseSet2.clause.abi).toEqual( - '{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}' - ); - }, 10000); - - /** - * Tests the `TestingContract` functions. - * - * This test iterates over an array of test cases, each representing a different function call - * to the `TestingContract`. For each test case, it uses the test description provided in the - * test case, executes the contract call, and then asserts that the response matches the expected - * value defined in the test case. - * - */ - testingContractTestCases.forEach( - ({ description, functionName, params, expected }) => { - test(description, async () => { - const response = await thorSoloClient.contracts.executeCall( - TESTING_CONTRACT_ADDRESS, - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - functionName - ), - params - ); - - expect(response).toEqual(expected); - }); - } - ); - - /** - * Tests the error test cases for the `TestingContract` functions. - */ - testingContractNegativeTestCases.forEach( - ({ description, functionName, params, expected }) => { - test(description, async () => { - const response = await thorSoloClient.contracts.executeCall( - TESTING_CONTRACT_ADDRESS, - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - functionName - ), - params - ); - expect(response).toStrictEqual(expected); - }); - } - ); - - /** - * Test cases for EVM Extension functions - */ - testingContractEVMExtensionTestCases.forEach( - ({ description, functionName, params, expected }) => { - test(description, async () => { - const response = await thorSoloClient.contracts.executeCall( - TESTING_CONTRACT_ADDRESS, - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - functionName - ), - params - ); - expect(response).toEqual(expected); - }); - } - ); - - test('Should filter the StateChanged event of the testing contract', async () => { - const contract = thorSoloClient.contracts.load( - TESTING_CONTRACT_ADDRESS, - TESTING_CONTRACT_ABI, - signer - ); - - await (await contract.transact.setStateVariable(123n)).wait(); - - const events = await contract.filters - .StateChanged({ - newValue: undefined, - oldValue: undefined, - sender: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - }) - .get(); - - expect(events).toBeDefined(); - - expect(events.at(events.length - 1)?.decodedData?.at(0)).toBe(123n); - }); - - filterContractEventsTestCases.forEach( - ({ - description, - contractBytecode, - contractAbi, - contractCaller, - functionCalls, - eventName, - getParams, - args, - expectedData - }) => { - test( - description, - async () => { - const contractFactory = - thorSoloClient.contracts.createContractFactory( - contractAbi, - contractBytecode, - new VeChainPrivateKeySigner( - HexUInt.of(contractCaller).bytes, - new VeChainProvider(thorSoloClient) - ) - ); - - const factory = await contractFactory.startDeployment(); - - const contract = await factory.waitForDeployment(); - - for (const functionCall of functionCalls) { - if (functionCall.type === 'read') { - // @ts-ignore - await contract.read[functionCall.functionName]( - ...functionCall.params - ); - } else { - // @ts-ignore - const result = await contract.transact[ - functionCall.functionName - ](...functionCall.params); - - await result.wait(); - } - } - - const eventLogs = - await contract.filters[eventName](args).get(getParams); - - expect(eventLogs.map((x) => x.decodedData)).toEqual( - expectedData - ); - }, - 10000 - ); - } - ); - - /** - * Test suite for multiple clauses test cases - */ - describe('Multiple clauses test cases', () => { - multipleClausesTestCases.forEach((x) => { - test( - x.description, - async () => { - // Create contract factories - const contractsFactories = x.contracts.map((contract) => { - return thorSoloClient.contracts.createContractFactory( - contract.contractAbi, - contract.contractBytecode, - new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER - .privateKey - ).bytes, - new VeChainProvider(thorSoloClient) - ) - ); - }); - - // Deploy contracts - const deployments = contractsFactories.map( - async (factory, index) => { - const deploymentParams = - x.contracts[index].deploymentParams; - return await ( - deploymentParams !== undefined - ? await factory.startDeployment( - deploymentParams - ) - : await factory.startDeployment() - ).waitForDeployment(); - } - ); - - const contracts = await Promise.all(deployments); - - // Define contract clauses - const contractClauses = x.contracts.flatMap( - (contract, index) => { - return contract.functionCalls.map( - (functionCall) => { - return contracts[index].clause[ - functionCall.functionName - ](...functionCall.params); - } - ); - } - ); - - // Execute multiple clauses transaction - const transactionResult = - await thorSoloClient.contracts.executeMultipleClausesTransaction( - contractClauses, - new VeChainPrivateKeySigner( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER - .privateKey - ).bytes, - new VeChainProvider(thorSoloClient) - ) - ); - - const result = await transactionResult.wait(); - - expect(result?.reverted).toBe(false); - expect(result?.outputs.length).toBe(x.expectedResults); - }, - 10000 - ); - }); - }); - - /** - * Test suite for 'getBaseGasPrice' method - */ - describe('getBaseGasPrice', () => { - test('Should return the base gas price of the Solo network', async () => { - const baseGasPrice = - await thorSoloClient.contracts.getBaseGasPrice(); - expect(baseGasPrice).toEqual({ - success: true, - result: { plain: 1000000000000000n, array: [1000000000000000n] } - }); - expect(baseGasPrice).toEqual({ - success: true, - result: { plain: BigInt(10 ** 15), array: [BigInt(10 ** 15)] } - }); // 10^13 wei - }); - }); -}); diff --git a/packages/network/tests/thor-client/contracts/contract.testnet.test.ts b/packages/network/tests/thor-client/contracts/contract.testnet.test.ts deleted file mode 100644 index 97809f25c..000000000 --- a/packages/network/tests/thor-client/contracts/contract.testnet.test.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { TESTNET_URL, ThorClient } from '../../../src'; - -/** - * Transactions module tests suite. - * - * @group integration/clients/thor-client/gas - */ -describe('ThorClient - Gas Module', () => { - // ThorClient instance - let thorClient: ThorClient; - - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * Validates the base gas price of the Testnet. - */ - test('Should return the base gas price of the Testnet', async () => { - const baseGasPrice = await thorClient.contracts.getBaseGasPrice(); - const expected = { - success: true, - result: { - plain: 10000000000000n, - array: [10000000000000n] - } - }; - expect(baseGasPrice).toEqual(expected); - expect(baseGasPrice).toEqual({ - ...expected, - result: { - plain: BigInt(10 ** 13), - array: [BigInt(10 ** 13)] - } - }); // 10^13 wei - }); -}); diff --git a/packages/network/tests/thor-client/contracts/fixture.ts b/packages/network/tests/thor-client/contracts/fixture.ts deleted file mode 100644 index cdd428f60..000000000 --- a/packages/network/tests/thor-client/contracts/fixture.ts +++ /dev/null @@ -1,3831 +0,0 @@ -import { - Address, - ERC20_ABI, - HexUInt, - type DeployParams -} from '@vechain/sdk-core'; -import { type Abi } from 'abitype'; -import type { EventDisplayOrder, PaginationOptions, Range } from '../../../src'; -import { TEST_ACCOUNTS } from '../../fixture'; - -const contractBytecode: string = - '0x608060405234801561001057600080fd5b506040516102063803806102068339818101604052810190610032919061007a565b80600081905550506100a7565b600080fd5b6000819050919050565b61005781610044565b811461006257600080fd5b50565b6000815190506100748161004e565b92915050565b6000602082840312156100905761008f61003f565b5b600061009e84828501610065565b91505092915050565b610150806100b66000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806360fe47b11461003b5780636d4ce63c14610057575b600080fd5b610055600480360381019061005091906100c3565b610075565b005b61005f61007f565b60405161006c91906100ff565b60405180910390f35b8060008190555050565b60008054905090565b600080fd5b6000819050919050565b6100a08161008d565b81146100ab57600080fd5b50565b6000813590506100bd81610097565b92915050565b6000602082840312156100d9576100d8610088565b5b60006100e7848285016100ae565b91505092915050565b6100f98161008d565b82525050565b600060208201905061011460008301846100f0565b9291505056fea2646970667358221220785262acbf50fa50a7b4dc8d8087ca8904c7e6b847a13674503fdcbac903b67e64736f6c63430008170033'; - -const deployedContractBytecode: string = - '0x608060405234801561001057600080fd5b50600436106100365760003560e01c806360fe47b11461003b5780636d4ce63c14610057575b600080fd5b610055600480360381019061005091906100c3565b610075565b005b61005f61007f565b60405161006c91906100ff565b60405180910390f35b8060008190555050565b60008054905090565b600080fd5b6000819050919050565b6100a08161008d565b81146100ab57600080fd5b50565b6000813590506100bd81610097565b92915050565b6000602082840312156100d9576100d8610088565b5b60006100e7848285016100ae565b91505092915050565b6100f98161008d565b82525050565b600060208201905061011460008301846100f0565b9291505056fea2646970667358221220785262acbf50fa50a7b4dc8d8087ca8904c7e6b847a13674503fdcbac903b67e64736f6c63430008170033'; - -const erc20ContractBytecode: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600b81526020017f53616d706c65546f6b656e0000000000000000000000000000000000000000008152506040518060400160405280600281526020017f535400000000000000000000000000000000000000000000000000000000000081525081600390816200008f91906200062c565b508060049081620000a191906200062c565b505050620000e633620000b9620000ec60201b60201c565b60ff16600a620000ca919062000896565b620f4240620000da9190620008e7565b620000f560201b60201c565b62000a3a565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200016a5760006040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000161919062000977565b60405180910390fd5b6200017e600083836200018260201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603620001d8578060026000828254620001cb919062000994565b92505081905550620002ae565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101562000267578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016200025e93929190620009e0565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620002f9578060026000828254039250508190555062000346565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620003a5919062000a1d565b60405180910390a3505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043457607f821691505b6020821081036200044a5762000449620003ec565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620004b47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000475565b620004c0868362000475565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200050d620005076200050184620004d8565b620004e2565b620004d8565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b84845462000482565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000450565b620005b18462000465565b81016020851015620005c1578190505b620005d9620005d08562000465565b8301826200056a565b50505b505050565b600082821c905092915050565b60006200060160001984600802620005e1565b1980831691505092915050565b60006200061c8383620005ee565b9150826002028217905092915050565b6200063782620003b2565b67ffffffffffffffff811115620006535762000652620003bd565b5b6200065f82546200041b565b6200066c82828562000591565b600060209050601f831160018114620006a457600084156200068f578287015190505b6200069b85826200060e565b8655506200070b565b601f198416620006b48662000450565b60005b82811015620006de57848901518255600182019150602085019450602081019050620006b7565b86831015620006fe5784890151620006fa601f891682620005ee565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620007a15780860481111562000779576200077862000713565b5b6001851615620007895780820291505b8081029050620007998562000742565b945062000759565b94509492505050565b600082620007bc57600190506200088f565b81620007cc57600090506200088f565b8160018114620007e55760028114620007f05762000826565b60019150506200088f565b60ff84111562000805576200080462000713565b5b8360020a9150848211156200081f576200081e62000713565b5b506200088f565b5060208310610133831016604e8410600b8410161715620008605782820a9050838111156200085a576200085962000713565b5b6200088f565b6200086f84848460016200074f565b9250905081840481111562000889576200088862000713565b5b81810290505b9392505050565b6000620008a382620004d8565b9150620008b083620004d8565b9250620008df7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620007aa565b905092915050565b6000620008f482620004d8565b91506200090183620004d8565b92508282026200091181620004d8565b915082820484148315176200092b576200092a62000713565b5b5092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200095f8262000932565b9050919050565b620009718162000952565b82525050565b60006020820190506200098e600083018462000966565b92915050565b6000620009a182620004d8565b9150620009ae83620004d8565b9250828201905080821115620009c957620009c862000713565b5b92915050565b620009da81620004d8565b82525050565b6000606082019050620009f7600083018662000966565b62000a066020830185620009cf565b62000a156040830184620009cf565b949350505050565b600060208201905062000a346000830184620009cf565b92915050565b610e558062000a4a6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610aa9565b60405180910390f35b6100d060048036038101906100cb9190610b64565b610292565b6040516100dd9190610bbf565b60405180910390f35b6100ee6102b5565b6040516100fb9190610be9565b60405180910390f35b61011e60048036038101906101199190610c04565b6102bf565b60405161012b9190610bbf565b60405180910390f35b61013c6102ee565b6040516101499190610c73565b60405180910390f35b61016c60048036038101906101679190610c8e565b6102f7565b6040516101799190610be9565b60405180910390f35b61018a61033f565b6040516101979190610aa9565b60405180910390f35b6101ba60048036038101906101b59190610b64565b6103d1565b6040516101c79190610bbf565b60405180910390f35b6101ea60048036038101906101e59190610cbb565b6103f4565b6040516101f79190610be9565b60405180910390f35b60606003805461020f90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461023b90610d2a565b80156102885780601f1061025d57610100808354040283529160200191610288565b820191906000526020600020905b81548152906001019060200180831161026b57829003601f168201915b5050505050905090565b60008061029d61047b565b90506102aa818585610483565b600191505092915050565b6000600254905090565b6000806102ca61047b565b90506102d7858285610495565b6102e2858585610529565b60019150509392505050565b60006012905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461034e90610d2a565b80601f016020809104026020016040519081016040528092919081815260200182805461037a90610d2a565b80156103c75780601f1061039c576101008083540402835291602001916103c7565b820191906000526020600020905b8154815290600101906020018083116103aa57829003601f168201915b5050505050905090565b6000806103dc61047b565b90506103e9818585610529565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b610490838383600161061d565b505050565b60006104a184846103f4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146105235781811015610513578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161050a93929190610d6a565b60405180910390fd5b6105228484848403600061061d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361059b5760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105929190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361060d5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016106049190610da1565b60405180910390fd5b6106188383836107f4565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361068f5760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016106869190610da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036107015760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016106f89190610da1565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080156107ee578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516107e59190610be9565b60405180910390a35b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084657806002600082825461083a9190610deb565b92505081905550610919565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156108d2578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016108c993929190610d6a565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361096257806002600082825403925050819055506109af565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a0c9190610be9565b60405180910390a3505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610a53578082015181840152602081019050610a38565b60008484015250505050565b6000601f19601f8301169050919050565b6000610a7b82610a19565b610a858185610a24565b9350610a95818560208601610a35565b610a9e81610a5f565b840191505092915050565b60006020820190508181036000830152610ac38184610a70565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610afb82610ad0565b9050919050565b610b0b81610af0565b8114610b1657600080fd5b50565b600081359050610b2881610b02565b92915050565b6000819050919050565b610b4181610b2e565b8114610b4c57600080fd5b50565b600081359050610b5e81610b38565b92915050565b60008060408385031215610b7b57610b7a610acb565b5b6000610b8985828601610b19565b9250506020610b9a85828601610b4f565b9150509250929050565b60008115159050919050565b610bb981610ba4565b82525050565b6000602082019050610bd46000830184610bb0565b92915050565b610be381610b2e565b82525050565b6000602082019050610bfe6000830184610bda565b92915050565b600080600060608486031215610c1d57610c1c610acb565b5b6000610c2b86828701610b19565b9350506020610c3c86828701610b19565b9250506040610c4d86828701610b4f565b9150509250925092565b600060ff82169050919050565b610c6d81610c57565b82525050565b6000602082019050610c886000830184610c64565b92915050565b600060208284031215610ca457610ca3610acb565b5b6000610cb284828501610b19565b91505092915050565b60008060408385031215610cd257610cd1610acb565b5b6000610ce085828601610b19565b9250506020610cf185828601610b19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610d4257607f821691505b602082108103610d5557610d54610cfb565b5b50919050565b610d6481610af0565b82525050565b6000606082019050610d7f6000830186610d5b565b610d8c6020830185610bda565b610d996040830184610bda565b949350505050565b6000602082019050610db66000830184610d5b565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df682610b2e565b9150610e0183610b2e565b9250828201905080821115610e1957610e18610dbc565b5b9291505056fea2646970667358221220912f5265edaea44910db734f0d00fccd257c78dba79c126931551eaad1a334f764736f6c63430008170033'; - -const erc721ContractBytecode: string = - '0x60806040523480156200001157600080fd5b506040518060400160405280600981526020017f53616d706c654e465400000000000000000000000000000000000000000000008152506040518060400160405280600481526020017f534e46540000000000000000000000000000000000000000000000000000000081525081600090816200008f919062000324565b508060019081620000a1919062000324565b5050506200040b565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200012c57607f821691505b602082108103620001425762000141620000e4565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001ac7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200016d565b620001b886836200016d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600062000205620001ff620001f984620001d0565b620001da565b620001d0565b9050919050565b6000819050919050565b6200022183620001e4565b6200023962000230826200020c565b8484546200017a565b825550505050565b600090565b6200025062000241565b6200025d81848462000216565b505050565b5b8181101562000285576200027960008262000246565b60018101905062000263565b5050565b601f821115620002d4576200029e8162000148565b620002a9846200015d565b81016020851015620002b9578190505b620002d1620002c8856200015d565b83018262000262565b50505b505050565b600082821c905092915050565b6000620002f960001984600802620002d9565b1980831691505092915050565b6000620003148383620002e6565b9150826002028217905092915050565b6200032f82620000aa565b67ffffffffffffffff8111156200034b576200034a620000b5565b5b62000357825462000113565b6200036482828562000289565b600060209050601f8311600181146200039c576000841562000387578287015190505b62000393858262000306565b86555062000403565b601f198416620003ac8662000148565b60005b82811015620003d657848901518255600182019150602085019450602081019050620003af565b86831015620003f65784890151620003f2601f891682620002e6565b8355505b6001600288020188555050505b505050505050565b611ea0806200041b6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063691c65d41161008c578063a22cb46511610066578063a22cb4651461026f578063b88d4fde1461028b578063c87b56dd146102a7578063e985e9c5146102d7576100ea565b8063691c65d4146101f157806370a082311461022157806395d89b4114610251576100ea565b8063095ea7b3116100c8578063095ea7b31461016d57806323b872dd1461018957806342842e0e146101a55780636352211e146101c1576100ea565b806301ffc9a7146100ef57806306fdde031461011f578063081812fc1461013d575b600080fd5b61010960048036038101906101049190611673565b610307565b60405161011691906116bb565b60405180910390f35b6101276103e9565b6040516101349190611766565b60405180910390f35b610157600480360381019061015291906117be565b61047b565b604051610164919061182c565b60405180910390f35b61018760048036038101906101829190611873565b610497565b005b6101a3600480360381019061019e91906118b3565b6104ad565b005b6101bf60048036038101906101ba91906118b3565b6105af565b005b6101db60048036038101906101d691906117be565b6105cf565b6040516101e8919061182c565b60405180910390f35b61020b60048036038101906102069190611906565b6105e1565b6040516102189190611942565b60405180910390f35b61023b60048036038101906102369190611906565b610610565b6040516102489190611942565b60405180910390f35b6102596106ca565b6040516102669190611766565b60405180910390f35b61028960048036038101906102849190611989565b61075c565b005b6102a560048036038101906102a09190611afe565b610772565b005b6102c160048036038101906102bc91906117be565b61078f565b6040516102ce9190611766565b60405180910390f35b6102f160048036038101906102ec9190611b81565b6107f8565b6040516102fe91906116bb565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806103d257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806103e257506103e18261088c565b5b9050919050565b6060600080546103f890611bf0565b80601f016020809104026020016040519081016040528092919081815260200182805461042490611bf0565b80156104715780601f1061044657610100808354040283529160200191610471565b820191906000526020600020905b81548152906001019060200180831161045457829003601f168201915b5050505050905090565b6000610486826108f6565b506104908261097e565b9050919050565b6104a982826104a46109bb565b6109c3565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361051f5760006040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401610516919061182c565b60405180910390fd5b6000610533838361052e6109bb565b6109d5565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146105a9578382826040517f64283d7b0000000000000000000000000000000000000000000000000000000081526004016105a093929190611c21565b60405180910390fd5b50505050565b6105ca83838360405180602001604052806000815250610772565b505050565b60006105da826108f6565b9050919050565b600080600660008154809291906105f790611c87565b9190505590506106078382610bef565b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036106835760006040517f89c62b6400000000000000000000000000000000000000000000000000000000815260040161067a919061182c565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600180546106d990611bf0565b80601f016020809104026020016040519081016040528092919081815260200182805461070590611bf0565b80156107525780601f1061072757610100808354040283529160200191610752565b820191906000526020600020905b81548152906001019060200180831161073557829003601f168201915b5050505050905090565b61076e6107676109bb565b8383610c0d565b5050565b61077d8484846104ad565b61078984848484610d7c565b50505050565b606061079a826108f6565b5060006107a5610f33565b905060008151116107c557604051806020016040528060008152506107f0565b806107cf84610f4a565b6040516020016107e0929190611d0b565b6040516020818303038152906040525b915050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008061090283611018565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361097557826040517f7e27328900000000000000000000000000000000000000000000000000000000815260040161096c9190611942565b60405180910390fd5b80915050919050565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600033905090565b6109d08383836001611055565b505050565b6000806109e184611018565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610a2357610a2281848661121a565b5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610ab457610a65600085600080611055565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614610b37576001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b846002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4809150509392505050565b610c098282604051806020016040528060008152506112de565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610c7e57816040517f5b08ba18000000000000000000000000000000000000000000000000000000008152600401610c75919061182c565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610d6f91906116bb565b60405180910390a3505050565b60008373ffffffffffffffffffffffffffffffffffffffff163b1115610f2d578273ffffffffffffffffffffffffffffffffffffffff1663150b7a02610dc06109bb565b8685856040518563ffffffff1660e01b8152600401610de29493929190611d84565b6020604051808303816000875af1925050508015610e1e57506040513d601f19601f82011682018060405250810190610e1b9190611de5565b60015b610ea2573d8060008114610e4e576040519150601f19603f3d011682016040523d82523d6000602084013e610e53565b606091505b506000815103610e9a57836040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401610e91919061182c565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610f2b57836040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401610f22919061182c565b60405180910390fd5b505b50505050565b606060405180602001604052806000815250905090565b606060006001610f59846112fa565b01905060008167ffffffffffffffff811115610f7857610f776119d3565b5b6040519080825280601f01601f191660200182016040528015610faa5781602001600182028036833780820191505090505b509050600082602001820190505b60011561100d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161100157611000611e12565b5b04945060008503610fb8575b819350505050919050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b808061108e5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156111c257600061109e846108f6565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561110957508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b801561111c575061111a81846107f8565b155b1561115e57826040517fa9fbf51f000000000000000000000000000000000000000000000000000000008152600401611155919061182c565b60405180910390fd5b81156111c057838573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b836004600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b61122583838361144d565b6112d957600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361129a57806040517f7e2732890000000000000000000000000000000000000000000000000000000081526004016112919190611942565b60405180910390fd5b81816040517f177e802f0000000000000000000000000000000000000000000000000000000081526004016112d0929190611e41565b60405180910390fd5b505050565b6112e8838361150e565b6112f56000848484610d7c565b505050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611358577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161134e5761134d611e12565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310611395576d04ee2d6d415b85acef8100000000838161138b5761138a611e12565b5b0492506020810190505b662386f26fc1000083106113c457662386f26fc1000083816113ba576113b9611e12565b5b0492506010810190505b6305f5e10083106113ed576305f5e10083816113e3576113e2611e12565b5b0492506008810190505b612710831061141257612710838161140857611407611e12565b5b0492506004810190505b60648310611435576064838161142b5761142a611e12565b5b0492506002810190505b600a8310611444576001810190505b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561150557508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806114c657506114c584846107f8565b5b8061150457508273ffffffffffffffffffffffffffffffffffffffff166114ec8361097e565b73ffffffffffffffffffffffffffffffffffffffff16145b5b90509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036115805760006040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600401611577919061182c565b60405180910390fd5b600061158e838360006109d5565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146116025760006040517f73c6ac6e0000000000000000000000000000000000000000000000000000000081526004016115f9919061182c565b60405180910390fd5b505050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6116508161161b565b811461165b57600080fd5b50565b60008135905061166d81611647565b92915050565b60006020828403121561168957611688611611565b5b60006116978482850161165e565b91505092915050565b60008115159050919050565b6116b5816116a0565b82525050565b60006020820190506116d060008301846116ac565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156117105780820151818401526020810190506116f5565b60008484015250505050565b6000601f19601f8301169050919050565b6000611738826116d6565b61174281856116e1565b93506117528185602086016116f2565b61175b8161171c565b840191505092915050565b60006020820190508181036000830152611780818461172d565b905092915050565b6000819050919050565b61179b81611788565b81146117a657600080fd5b50565b6000813590506117b881611792565b92915050565b6000602082840312156117d4576117d3611611565b5b60006117e2848285016117a9565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611816826117eb565b9050919050565b6118268161180b565b82525050565b6000602082019050611841600083018461181d565b92915050565b6118508161180b565b811461185b57600080fd5b50565b60008135905061186d81611847565b92915050565b6000806040838503121561188a57611889611611565b5b60006118988582860161185e565b92505060206118a9858286016117a9565b9150509250929050565b6000806000606084860312156118cc576118cb611611565b5b60006118da8682870161185e565b93505060206118eb8682870161185e565b92505060406118fc868287016117a9565b9150509250925092565b60006020828403121561191c5761191b611611565b5b600061192a8482850161185e565b91505092915050565b61193c81611788565b82525050565b60006020820190506119576000830184611933565b92915050565b611966816116a0565b811461197157600080fd5b50565b6000813590506119838161195d565b92915050565b600080604083850312156119a05761199f611611565b5b60006119ae8582860161185e565b92505060206119bf85828601611974565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611a0b8261171c565b810181811067ffffffffffffffff82111715611a2a57611a296119d3565b5b80604052505050565b6000611a3d611607565b9050611a498282611a02565b919050565b600067ffffffffffffffff821115611a6957611a686119d3565b5b611a728261171c565b9050602081019050919050565b82818337600083830152505050565b6000611aa1611a9c84611a4e565b611a33565b905082815260208101848484011115611abd57611abc6119ce565b5b611ac8848285611a7f565b509392505050565b600082601f830112611ae557611ae46119c9565b5b8135611af5848260208601611a8e565b91505092915050565b60008060008060808587031215611b1857611b17611611565b5b6000611b268782880161185e565b9450506020611b378782880161185e565b9350506040611b48878288016117a9565b925050606085013567ffffffffffffffff811115611b6957611b68611616565b5b611b7587828801611ad0565b91505092959194509250565b60008060408385031215611b9857611b97611611565b5b6000611ba68582860161185e565b9250506020611bb78582860161185e565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611c0857607f821691505b602082108103611c1b57611c1a611bc1565b5b50919050565b6000606082019050611c36600083018661181d565b611c436020830185611933565b611c50604083018461181d565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611c9282611788565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611cc457611cc3611c58565b5b600182019050919050565b600081905092915050565b6000611ce5826116d6565b611cef8185611ccf565b9350611cff8185602086016116f2565b80840191505092915050565b6000611d178285611cda565b9150611d238284611cda565b91508190509392505050565b600081519050919050565b600082825260208201905092915050565b6000611d5682611d2f565b611d608185611d3a565b9350611d708185602086016116f2565b611d798161171c565b840191505092915050565b6000608082019050611d99600083018761181d565b611da6602083018661181d565b611db36040830185611933565b8181036060830152611dc58184611d4b565b905095945050505050565b600081519050611ddf81611647565b92915050565b600060208284031215611dfb57611dfa611611565b5b6000611e0984828501611dd0565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000604082019050611e56600083018561181d565b611e636020830184611933565b939250505056fea2646970667358221220af86505f0580469a6f5c34114f42782e33b1678efb535f9aeaeb0817e598ec2c64736f6c63430008160033'; - -const depositContractBytecode: string = - '0x608060405234801561001057600080fd5b50610405806100206000396000f3fe6080604052600436106100345760003560e01c806327e235e314610039578063d0e30db014610076578063f8b2cb4f14610080575b600080fd5b34801561004557600080fd5b50610060600480360381019061005b9190610268565b6100bd565b60405161006d91906102ae565b60405180910390f35b61007e6100d5565b005b34801561008c57600080fd5b506100a760048036038101906100a29190610268565b6101bd565b6040516100b491906102ae565b60405180910390f35b60006020528060005260406000206000915090505481565b60003411610118576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161010f9061034c565b60405180910390fd5b346000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610166919061039b565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167fd15c9547ea5c06670c0010ce19bc32d54682a4b3801ece7f3ab0c3f17106b4bb346040516101b391906102ae565b60405180910390a2565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102358261020a565b9050919050565b6102458161022a565b811461025057600080fd5b50565b6000813590506102628161023c565b92915050565b60006020828403121561027e5761027d610205565b5b600061028c84828501610253565b91505092915050565b6000819050919050565b6102a881610295565b82525050565b60006020820190506102c3600083018461029f565b92915050565b600082825260208201905092915050565b7f4465706f73697420616d6f756e74206d7573742062652067726561746572207460008201527f68616e2030000000000000000000000000000000000000000000000000000000602082015250565b60006103366025836102c9565b9150610341826102da565b604082019050919050565b6000602082019050818103600083015261036581610329565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103a682610295565b91506103b183610295565b92508282019050808211156103c9576103c861036c565b5b9291505056fea2646970667358221220fd4fcedf2b3aacc02a6c483409206998028d766cf51d642f6c5c35d6f81118e864736f6c63430008180033'; - -const sampleTwoValuesReturnBytecode: string = - '0x608060405234801561001057600080fd5b506101ea806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630dbe671f1461003b5780634df7e3d01461005a575b600080fd5b610043610064565b604051610051929190610184565b60405180910390f35b6100626100a8565b005b6000606060016040518060400160405280600181526020017f6100000000000000000000000000000000000000000000000000000000000000815250915091509091565b600060606100b4610064565b80925081935050506100c4610064565b50809250506100d1610064565b9050809150505050565b6000819050919050565b6100ee816100db565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561012e578082015181840152602081019050610113565b60008484015250505050565b6000601f19601f8301169050919050565b6000610156826100f4565b61016081856100ff565b9350610170818560208601610110565b6101798161013a565b840191505092915050565b600060408201905061019960008301856100e5565b81810360208301526101ab818461014b565b9050939250505056fea26469706673582212201b347b344b0405eee69f8551d7f0dff5cb414de0237f3a6e9192c43efbf009ab64736f6c63430008140033'; - -// to recharge the delegator, deposit to this address: 0xD4a88FE48909486B7A91ec821598d73740398337, lasts until 2024-05-10 -const TESTNET_DELEGATE_URL = 'https://sponsor-testnet.vechain.energy/by/473'; - -const ERC20_CONTRACT_ADDRESS_ON_TESTNET = - '0x755780b48a853282a6b6a88aa7b544a7ffe8451d'; - -const sampleTwoValuesReturnAbi = [ - { - inputs: [], - name: 'a', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - }, - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [], - name: 'b', - outputs: [], - stateMutability: 'pure', - type: 'function' - } -] as const; - -const depositContractAbi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'depositor', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256' - } - ], - name: 'DepositMade', - type: 'event' - }, - { - inputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - name: 'balances', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'deposit', - outputs: [], - stateMutability: 'payable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'addr', - type: 'address' - } - ], - name: 'getBalance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; -const deployedContractAbi = [ - { - inputs: [], - name: 'get', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [{ internalType: 'uint256', name: 'x', type: 'uint256' }], - name: 'set', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -const eventExampleAbi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: '_setter', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: '_value', - type: 'uint256' - } - ], - name: 'ValueSet', - type: 'event' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_newValue', - type: 'uint256' - } - ], - name: 'setValue', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'value', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; - -const eventExampleBytecode = - '0x608060405234801561001057600080fd5b5061019b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633fa4f2451461003b5780635524107714610059575b600080fd5b610043610075565b60405161005091906100ec565b60405180910390f35b610073600480360381019061006e9190610138565b61007b565b005b60005481565b806000819055503373ffffffffffffffffffffffffffffffffffffffff167ff3f57717dff9f5f10af315efdbfadc60c42152c11fc0c3c413bbfbdc661f143c826040516100c891906100ec565b60405180910390a250565b6000819050919050565b6100e6816100d3565b82525050565b600060208201905061010160008301846100dd565b92915050565b600080fd5b610115816100d3565b811461012057600080fd5b50565b6000813590506101328161010c565b92915050565b60006020828403121561014e5761014d610107565b5b600061015c84828501610123565b9150509291505056fea2646970667358221220d6092bd20e3b6594cb285317ce56a11fd752ee174eaac9ee555f0db6f4f3d4f764736f6c63430008180033'; - -const fourArgsEventAbi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - name: 'sender', - type: 'address' - }, - { - indexed: true, - name: 'key', - type: 'uint256' - }, - { - indexed: true, - name: 'oldValue', - type: 'uint256' - }, - { - indexed: true, - name: 'newValue', - type: 'uint256' - } - ], - name: 'DataUpdated', - type: 'event' - } -] as const; - -/** - * Represents a test case for a smart contract function. - * This interface is designed to capture the necessary details to execute and validate - * a function call within a testing framework. - */ -interface TestCase { - /** - * A description of the test case. This is used to provide context for the test. - */ - description: string; - - /** - * The name of the function to be tested. This should match exactly with the function name - * in the smart contract. - */ - functionName: string; - - /** - * An array of parameters to be passed to the function. The order and types of these parameters - * should match the expected input of the smart contract function. - */ - params: unknown[]; - - /** - * The expected result of the function call. This can vary in type depending on what - * the function returns. It's used to assert whether the function behaves as expected. - */ - expected: unknown; - - /** - * Indicates whether the function call is expected to revert or throw an error. - * A value of 'true' means the test is expecting the function to fail. - */ - reverted: boolean; - - /** - * Indicates whether the function call is a read-only call. A value of 'true' means the function call is read-only. - */ - isReadOnly: boolean; -} - -const ExampleEnum = { - SMALL: 0, - MEDIUM: 1, - LARGE: 2 -}; - -const erc721ContractTestCases: TestCase[] = [ - { - description: 'should mint an NFT for the caller address', - functionName: 'mintItem', - params: [TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address], - expected: [ - '0x0000000000000000000000000000000000000000', - Address.checksum( - HexUInt.of(TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address) - ), - 0n - ], - reverted: false, - isReadOnly: false - }, - { - description: 'should mint an NFT for the caller address', - functionName: 'mintItem', - params: [TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address], - expected: [ - '0x0000000000000000000000000000000000000000', - Address.checksum( - HexUInt.of(TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address) - ), - 1n - ], - reverted: false, - isReadOnly: false - }, - { - description: - 'should mint an NFT for the specific address of another user', - functionName: 'mintItem', - params: [TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address], - expected: [ - '0x0000000000000000000000000000000000000000', - Address.checksum( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address.toLowerCase() - ) - ), - 2n - ], - reverted: false, - isReadOnly: false - }, - { - description: - 'should get the current NFT balance of the CONTRACT_MANAGER address', - functionName: 'balanceOf', - params: [TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address], - expected: { - success: true, - result: { - plain: 2n, - array: [2n] - } - }, - reverted: false, - isReadOnly: true - }, - { - description: - 'should get the current NFT balance of the DELEGATOR address', - functionName: 'balanceOf', - params: [TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address], - expected: { - success: true, - result: { - plain: 1n, - array: [1n] - } - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should transfer the NFT to DELEGATOR address', - functionName: 'transferFrom', - params: [ - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address, - TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - 1n - ], - expected: [ - Address.checksum( - HexUInt.of(TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address) - ), - Address.checksum( - HexUInt.of(TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address) - ), - 1n - ], - reverted: false, - isReadOnly: false - }, - { - description: - 'should get the current NFT balance of the CONTRACT_MANAGER address', - functionName: 'balanceOf', - params: [TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address], - expected: { - success: true, - result: { - plain: 1n, - array: [1n] - } - }, - reverted: false, - isReadOnly: true - }, - { - description: - 'should get the current NFT balance of the DELEGATOR address', - functionName: 'balanceOf', - params: [TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address], - expected: { - success: true, - result: { - plain: 2n, - array: [2n] - } - }, - reverted: false, - isReadOnly: true - } -]; - -const testingContractTestCases: TestCase[] = [ - { - description: 'should return the bool value false', - functionName: 'boolData', - params: [false], - expected: { result: { array: [false], plain: false }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the bool value true', - functionName: 'boolData', - params: [true], - expected: { result: { array: [true], plain: true }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the int value 1', - functionName: 'intData', - params: [1], - expected: { result: { array: [1n], plain: 1n }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the int value -1', - functionName: 'intData', - params: [-1], - expected: { result: { array: [-1n], plain: -1n }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the int value 0', - functionName: 'intData', - params: [0], - expected: { result: { array: [0n], plain: 0n }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the uint value 0', - functionName: 'uintData', - params: [0], - expected: { result: { array: [0n], plain: 0n }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the uint value 1', - functionName: 'uintData', - params: [1], - expected: { result: { array: [1n], plain: 1n }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: - 'should return the address value 0x0000000000000000000000000000000000000000', - functionName: 'addressData', - params: ['0x0000000000000000000000000000000000000000'], - expected: { - result: { - array: ['0x0000000000000000000000000000000000000000'], - plain: '0x0000000000000000000000000000000000000000' - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: - 'should return the bytes32 value 0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0', - functionName: 'bytes32Data', - params: [ - '0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0' - ], - expected: { - result: { - array: [ - '0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0' - ], - plain: '0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0' - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the string value "a"', - functionName: 'stringData', - params: ['a'], - expected: { result: { array: ['a'], plain: 'a' }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the passed fixed array', - functionName: 'fixedArrayData', - params: [[123, 456, 789]], - expected: { - result: { array: [[123n, 456n, 789n]], plain: [123n, 456n, 789n] }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the passed dynamic array', - functionName: 'dynamicArrayData', - params: [[123, 456, 789, 323, 123]], - expected: { - result: { - array: [[123n, 456n, 789n, 323n, 123n]], - plain: [123n, 456n, 789n, 323n, 123n] - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the passed struct', - functionName: 'structData', - params: [{ id: 10, name: 'test' }], - expected: { - result: { - array: [[10n, 'test']], - plain: { id: 10n, name: 'test' } - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the passed enum', - functionName: 'enumData', - params: [ExampleEnum.SMALL], - expected: { - result: { array: [ExampleEnum.SMALL], plain: ExampleEnum.SMALL }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the passed multiple values', - functionName: 'multipleData', - params: [ - 1, - '0x0000000000000000000000000000000000000000', - '0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0', - 'a', - [123, 456, 789], - [123, 456, 789, 323, 123], - { id: 10, name: 'test' }, - ExampleEnum.SMALL - ], - expected: { - result: { - array: [ - 1n, - '0x0000000000000000000000000000000000000000', - '0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0', - 'a', - [123n, 456n, 789n], - [123n, 456n, 789n, 323n, 123n], - [10n, 'test'], - ExampleEnum.SMALL - ], - plain: [ - 1n, - '0x0000000000000000000000000000000000000000', - '0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0', - 'a', - [123n, 456n, 789n], - [123n, 456n, 789n, 323n, 123n], - { id: 10n, name: 'test' }, - 0 - ] - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the passed multiple int values', - functionName: 'multipleIntData', - params: [1, 222, 333, 287274, 390343843, 123223663], - expected: { - result: { - array: [1, 222, 333, 287274n, 390343843n, 123223663n], - plain: [1, 222, 333, 287274n, 390343843n, 123223663n] - }, - success: true - }, - reverted: false, - isReadOnly: true - } -]; - -const testingContractNegativeTestCases: TestCase[] = [ - { - description: 'testRequireError() test', - functionName: 'testRequireError', - params: [8], - expected: { - result: { errorMessage: 'Value must be greater than 10' }, - success: false - }, - reverted: true, - isReadOnly: true - }, - { - description: 'testAssertError() test', - functionName: 'testAssertError', - params: [1], - expected: { result: { errorMessage: 'Panic(0x01)' }, success: false }, - reverted: true, - isReadOnly: true - }, - { - description: 'testRevertError() test', - functionName: 'testRevertError', - params: [4], - expected: { - result: { errorMessage: 'Value must be at least 5' }, - success: false - }, - reverted: true, - isReadOnly: true - }, - { - description: 'testOverflowError() test', - functionName: 'testOverflowError', - params: [255], - expected: { result: { errorMessage: 'Panic(0x11)' }, success: false }, - reverted: true, - isReadOnly: true - }, - { - description: 'testInvalidOpcodeError() test', - functionName: 'testInvalidOpcodeError', - params: [], - expected: { result: { errorMessage: '' }, success: false }, - reverted: true, - isReadOnly: true - } -]; - -const testingContractEVMExtensionTestCases: TestCase[] = [ - { - description: 'should return the blockID of the given block number', - functionName: 'getBlockID', - params: [1], - expected: { - result: { - array: [ - '0x00000001fb5387f59d35a8e76dcce151cb229a3910ac5f4731ff55f7ca36a809' - ], - plain: '0x00000001fb5387f59d35a8e76dcce151cb229a3910ac5f4731ff55f7ca36a809' - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: - 'should return the block total score of the given block defined by the block number', - functionName: 'getBlockTotalScore', - params: [1], - expected: { result: { array: [1n], plain: 1n }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the block time of the given block number', - functionName: 'getBlockTime', - params: [1], - expected: { - result: { array: [1702231120n], plain: 1702231120n }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the block signer of the given block number', - functionName: 'getBlockSigner', - params: [1], - expected: { - result: { - array: ['0xf077b491b355E64048cE21E3A6Fc4751eEeA77fa'], - plain: '0xf077b491b355E64048cE21E3A6Fc4751eEeA77fa' - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the total supply of VET', - functionName: 'getTotalSupply', - params: [], - expected: { - result: { - array: [10000000000000000000000000000n], - plain: 10000000000000000000000000000n - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: - 'should return the `provedWork` of the current transaction', - functionName: 'getTxProvedWork', - params: [], - expected: { result: { array: [0n], plain: 0n }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: - 'should return the transaction ID of the current transaction', - functionName: 'getTxID', - params: [], - expected: { - result: { - array: [ - '0x0000000000000000000000000000000000000000000000000000000000000000' - ], - plain: '0x0000000000000000000000000000000000000000000000000000000000000000' - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the `blockRef` of the current transaction', - functionName: 'getTxBlockRef', - params: [], - expected: { - result: { - array: ['0x0000000000000000'], - plain: '0x0000000000000000' - }, - success: true - }, - reverted: false, - isReadOnly: true - }, - { - description: - 'should return the `expiration` of the current transaction', - functionName: 'getTxExpiration', - params: [], - expected: { result: { array: [0n], plain: 0n }, success: true }, - reverted: false, - isReadOnly: true - }, - { - description: 'should return the data hashed using Blake2b256', - functionName: 'calculateBlake2b256', - params: ['0x'], - expected: { - result: { - array: [ - '0x0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' - ], - plain: '0x0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' - }, - success: true - }, - reverted: false, - isReadOnly: true - } -]; - -interface FunctionCallTestCase { - functionName: string; - params: unknown[]; - type: 'read' | 'transact'; -} - -interface FilterEventTestCase { - description: string; - contractBytecode: string; - contractAbi: Abi; - contractCaller: string; - functionCalls: FunctionCallTestCase[]; - eventName: string; - getParams?: { - range?: Range; - options?: PaginationOptions; - order?: EventDisplayOrder; - }; - args: Record; - expectedData: unknown[]; -} - -interface MultipleClausesTestCase { - description: string; - contracts: Array<{ - contractBytecode: string; - contractAbi: Abi; - contractCaller: string; - deploymentParams?: DeployParams; - functionCalls: FunctionCallTestCase[]; - }>; - expectedResults: number; -} - -const multipleClausesTestCases: MultipleClausesTestCase[] = [ - { - description: 'should execute multiple clauses', - contracts: [ - { - contractBytecode: erc20ContractBytecode, - contractAbi: ERC20_ABI, - contractCaller: - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [ - { - functionName: 'transfer', - params: [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - 1000 - ], - type: 'transact' - }, - { - functionName: 'transfer', - params: [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - 4000 - ], - type: 'transact' - } - ] - }, - { - contractBytecode, - contractAbi: deployedContractAbi, - contractCaller: - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [ - { - functionName: 'set', - params: [1000], - type: 'transact' - } - ], - deploymentParams: { - types: 'uint256', - values: ['1000'] - } - } - ], - expectedResults: 3 - }, - { - description: 'should execute multiple clauses', - contracts: [ - { - contractBytecode, - contractAbi: deployedContractAbi, - contractCaller: - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [ - { - functionName: 'set', - params: [1000], - type: 'transact' - } - ], - deploymentParams: { - types: 'uint256', - values: ['1000'] - } - }, - { - contractBytecode: depositContractBytecode, - contractAbi: depositContractAbi, - contractCaller: - TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [ - { - functionName: 'deposit', - params: [{ value: 1000 }], - type: 'transact' - }, - { - functionName: 'deposit', - params: [{ value: 2000 }], - type: 'transact' - }, - { - functionName: 'deposit', - params: [{ value: 7000 }], - type: 'transact' - } - ] - } - ], - expectedResults: 4 - } -]; -const filterContractEventsTestCases: FilterEventTestCase[] = [ - { - description: 'should filter the ValueSet event', - contractBytecode: eventExampleBytecode, - contractAbi: eventExampleAbi, - contractCaller: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [ - { - functionName: 'setValue', - params: [1000], - type: 'transact' - } - ], - eventName: 'ValueSet', - args: { _setter: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address }, - expectedData: [['0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', 1000n]] - }, - { - description: - 'should filter the first Transfer event of the initial supply', - contractBytecode: erc20ContractBytecode, - contractAbi: ERC20_ABI, - contractCaller: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [], - eventName: 'Transfer', - args: { - from: undefined, - to: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address - }, - expectedData: [ - [ - '0x0000000000000000000000000000000000000000', - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - 1000000000000000000000000n - ] - ] - }, - { - description: - 'should not be able to filter the event, since I am checking just the block 0', - contractBytecode: erc20ContractBytecode, - contractAbi: ERC20_ABI, - contractCaller: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [], - eventName: 'Transfer', - getParams: { - range: { - unit: 'block', - from: 0, - to: 0 - } - }, - args: { - from: undefined, - to: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.address - }, - expectedData: [] - }, - { - description: 'should filter the two transfer events', - contractBytecode: erc20ContractBytecode, - contractAbi: ERC20_ABI, - contractCaller: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [ - { - functionName: 'transfer', - params: [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000 - ], - type: 'transact' - }, - { - functionName: 'transfer', - params: [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000 - ], - type: 'transact' - } - ], - eventName: 'Transfer', - args: { - from: undefined, - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - }, - expectedData: [ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 1000n - ], - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 5000n - ] - ] - }, - { - description: - 'should filter the two transfer events with descending order', - contractBytecode: erc20ContractBytecode, - contractAbi: ERC20_ABI, - contractCaller: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [ - { - functionName: 'transfer', - params: [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000 - ], - type: 'transact' - }, - { - functionName: 'transfer', - params: [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000 - ], - type: 'transact' - } - ], - eventName: 'Transfer', - getParams: { - order: 'desc' - }, - args: { - from: undefined, - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - }, - expectedData: [ - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 5000n - ], - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 1000n - ] - ] - }, - { - description: - 'should try to filter the second Transfer event for a specific value but since value is not indexed, all movements are returned', - contractBytecode: erc20ContractBytecode, - contractAbi: ERC20_ABI, - contractCaller: TEST_ACCOUNTS.TRANSACTION.CONTRACT_MANAGER.privateKey, - functionCalls: [ - { - functionName: 'transfer', - params: [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 1000 - ], - type: 'transact' - }, - { - functionName: 'transfer', - params: [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - 5000 - ], - type: 'transact' - } - ], - eventName: 'Transfer', - args: { - from: undefined, - to: undefined, - value: 5000n - }, - expectedData: [ - [ - '0x0000000000000000000000000000000000000000', - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - 1000000000000000000000000n - ], - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 1000n - ], - [ - '0xF02f557c753edf5fcdCbfE4c1c3a448B3cC84D54', - '0x9E7911de289c3c856ce7f421034F66b6Cde49C39', - 5000n - ] - ] - } -]; - -const OWNER_RESTRICTION_ABI = [ - { - inputs: [], - stateMutability: 'nonpayable', - type: 'constructor' - }, - { - inputs: [], - name: 'getSecretData', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'newData', - type: 'uint256' - } - ], - name: 'setSecretData', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - } -] as const; - -// IMPORTANT NOTE: This vebetterdao contract abi is just for testing purposes. It should never be used in production. -const xAllocationVotingGovernorABI = [ - { - inputs: [ - { - internalType: 'contract IVotes', - name: '_vot3Token', - type: 'address' - }, - { - internalType: 'uint256', - name: '_quorumPercentage', - type: 'uint256' - }, - { - internalType: 'uint32', - name: '_initialVotingPeriod', - type: 'uint32' - }, - { - internalType: 'address', - name: 'b3trGovernor_', - type: 'address' - }, - { - internalType: 'address', - name: '_voterRewards', - type: 'address' - }, - { - internalType: 'address[]', - name: '_admins', - type: 'address[]' - }, - { - internalType: 'string', - name: '_xAppsBaseURI', - type: 'string' - } - ], - stateMutability: 'nonpayable', - type: 'constructor' - }, - { - inputs: [], - name: 'AccessControlBadConfirmation', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address' - }, - { - internalType: 'bytes32', - name: 'neededRole', - type: 'bytes32' - } - ], - name: 'AccessControlUnauthorizedAccount', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address' - } - ], - name: 'B3TRGovernorOnlyExecutor', - type: 'error' - }, - { - inputs: [], - name: 'CheckpointUnorderedInsertion', - type: 'error' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'timepoint', - type: 'uint256' - }, - { - internalType: 'uint48', - name: 'clock', - type: 'uint48' - } - ], - name: 'ERC5805FutureLookup', - type: 'error' - }, - { - inputs: [], - name: 'ERC6372InconsistentClock', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'voter', - type: 'address' - } - ], - name: 'GovernorAlreadyCastVote', - type: 'error' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - } - ], - name: 'GovernorAppNotAvailableForVoting', - type: 'error' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'quorumNumerator', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'quorumDenominator', - type: 'uint256' - } - ], - name: 'GovernorInvalidQuorumFraction', - type: 'error' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'votingPeriod', - type: 'uint256' - } - ], - name: 'GovernorInvalidVotingPeriod', - type: 'error' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'GovernorNonexistentRound', - type: 'error' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - }, - { - internalType: 'enum IXAllocationVotingGovernor.RoundState', - name: 'current', - type: 'uint8' - }, - { - internalType: 'bytes32', - name: 'expectedStates', - type: 'bytes32' - } - ], - name: 'GovernorUnexpectedRoundState', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address' - }, - { - internalType: 'uint256', - name: 'currentNonce', - type: 'uint256' - } - ], - name: 'InvalidAccountNonce', - type: 'error' - }, - { - inputs: [ - { - internalType: 'uint8', - name: 'bits', - type: 'uint8' - }, - { - internalType: 'uint256', - name: 'value', - type: 'uint256' - } - ], - name: 'SafeCastOverflowedUintDowncast', - type: 'error' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'value', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'length', - type: 'uint256' - } - ], - name: 'StringsInsufficientHexLength', - type: 'error' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'voter', - type: 'address' - }, - { - indexed: true, - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - }, - { - indexed: false, - internalType: 'bytes32[]', - name: 'appsIds', - type: 'bytes32[]' - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'voteWeights', - type: 'uint256[]' - } - ], - name: 'AllocationVoteCast', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'id', - type: 'bytes32' - }, - { - indexed: false, - internalType: 'address', - name: 'addr', - type: 'address' - }, - { - indexed: false, - internalType: 'string', - name: 'name', - type: 'string' - }, - { - indexed: false, - internalType: 'bool', - name: 'appAvailableForAllocationVoting', - type: 'bool' - } - ], - name: 'AppAdded', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'oldQuorumNumerator', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'newQuorumNumerator', - type: 'uint256' - } - ], - name: 'QuorumNumeratorUpdated', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - indexed: true, - internalType: 'bytes32', - name: 'previousAdminRole', - type: 'bytes32' - }, - { - indexed: true, - internalType: 'bytes32', - name: 'newAdminRole', - type: 'bytes32' - } - ], - name: 'RoleAdminChanged', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - indexed: true, - internalType: 'address', - name: 'account', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'sender', - type: 'address' - } - ], - name: 'RoleGranted', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - indexed: true, - internalType: 'address', - name: 'account', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'sender', - type: 'address' - } - ], - name: 'RoleRevoked', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - }, - { - indexed: false, - internalType: 'address', - name: 'proposer', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: 'voteStart', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'voteEnd', - type: 'uint256' - } - ], - name: 'RoundCreated', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - }, - { - indexed: false, - internalType: 'bool', - name: 'isAvailable', - type: 'bool' - } - ], - name: 'VotingElegibilityChanged', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'oldVotingPeriod', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'newVotingPeriod', - type: 'uint256' - } - ], - name: 'VotingPeriodSet', - type: 'event' - }, - { - inputs: [], - name: 'CLOCK_MODE', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'COUNTING_MODE', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [], - name: 'DEFAULT_ADMIN_ROLE', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'appAddress', - type: 'address' - }, - { - internalType: 'string', - name: 'appName', - type: 'string' - } - ], - name: 'addApp', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'allElegibleApps', - outputs: [ - { - internalType: 'bytes32[]', - name: '', - type: 'bytes32[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - } - ], - name: 'appURI', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'b3trGovernor', - outputs: [ - { - internalType: 'contract IGovernor', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'baseURI', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - }, - { - internalType: 'bytes32[]', - name: 'appIds', - type: 'bytes32[]' - }, - { - internalType: 'uint256[]', - name: 'voteWeights', - type: 'uint256[]' - } - ], - name: 'castVote', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'clock', - outputs: [ - { - internalType: 'uint48', - name: '', - type: 'uint48' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'currentRoundId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'finalize', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'getAllApps', - outputs: [ - { - components: [ - { - internalType: 'bytes32', - name: 'id', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'receiverAddress', - type: 'address' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - }, - { - internalType: 'uint48', - name: 'createdAt', - type: 'uint48' - } - ], - internalType: 'struct XApps.App[]', - name: '', - type: 'tuple[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'id', - type: 'bytes32' - } - ], - name: 'getApp', - outputs: [ - { - components: [ - { - internalType: 'bytes32', - name: 'id', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'receiverAddress', - type: 'address' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - }, - { - internalType: 'uint48', - name: 'createdAt', - type: 'uint48' - } - ], - internalType: 'struct XApps.App', - name: '', - type: 'tuple' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - } - ], - name: 'getAppReceiverAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - }, - { - internalType: 'bytes32', - name: 'app', - type: 'bytes32' - } - ], - name: 'getAppVotes', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getCurrentAllocationRoundSnapshot', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - } - ], - name: 'getRoleAdmin', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'getRoundApps', - outputs: [ - { - internalType: 'bytes32[]', - name: '', - type: 'bytes32[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'getRoundAppsWithDetails', - outputs: [ - { - components: [ - { - internalType: 'bytes32', - name: 'id', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'receiverAddress', - type: 'address' - }, - { - internalType: 'string', - name: 'name', - type: 'string' - }, - { - internalType: 'uint48', - name: 'createdAt', - type: 'uint48' - } - ], - internalType: 'struct XApps.App[]', - name: '', - type: 'tuple[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address' - }, - { - internalType: 'uint256', - name: 'timepoint', - type: 'uint256' - } - ], - name: 'getVotes', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'account', - type: 'address' - } - ], - name: 'grantRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'account', - type: 'address' - } - ], - name: 'hasRole', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - }, - { - internalType: 'address', - name: 'user', - type: 'address' - } - ], - name: 'hasVoted', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address' - } - ], - name: 'hasVotedOnce', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'string', - name: 'appName', - type: 'string' - } - ], - name: 'hashName', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'isActive', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - } - ], - name: 'isElegibleForVoteLatestCheckpoint', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - }, - { - internalType: 'uint256', - name: 'timepoint', - type: 'uint256' - } - ], - name: 'isElegibleForVotePastCheckpoint', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - }, - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'isEligibleForVote', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'isFinalized', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'latestSucceededRoundId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'name', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'owner', - type: 'address' - } - ], - name: 'nonces', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'blockNumber', - type: 'uint256' - } - ], - name: 'quorum', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'quorumDenominator', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'timepoint', - type: 'uint256' - } - ], - name: 'quorumNumerator', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'quorumNumerator', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'quorumReached', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'callerConfirmation', - type: 'address' - } - ], - name: 'renounceRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'account', - type: 'address' - } - ], - name: 'revokeRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'roundDeadline', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'roundProposer', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'roundQuorum', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'roundSnapshot', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_newAdmin', - type: 'address' - } - ], - name: 'setAdminRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'b3trGovernor_', - type: 'address' - } - ], - name: 'setB3trGovernanceAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'string', - name: 'baseURI_', - type: 'string' - } - ], - name: 'setBaseURI', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - }, - { - internalType: 'bool', - name: 'isElegible', - type: 'bool' - } - ], - name: 'setVotingElegibility', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint32', - name: 'newVotingPeriod', - type: 'uint32' - } - ], - name: 'setVotingPeriod', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'startNewRound', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'state', - outputs: [ - { - internalType: 'enum IXAllocationVotingGovernor.RoundState', - name: '', - type: 'uint8' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes4', - name: 'interfaceId', - type: 'bytes4' - } - ], - name: 'supportsInterface', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'token', - outputs: [ - { - internalType: 'contract IERC5805', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'totalVoters', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'roundId', - type: 'uint256' - } - ], - name: 'totalVotes', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'appId', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'newReceiverAddress', - type: 'address' - } - ], - name: 'updateAppReceiverAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'newQuorumNumerator', - type: 'uint256' - } - ], - name: 'updateQuorumNumerator', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'version', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'voterRewards', - outputs: [ - { - internalType: 'contract IVoterRewards', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'votingPeriod', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; - -// IMPORTANT NOTE: This vebetterdao contract abi is just for testing purposes. It should never be used in production. -const emissionsABI = [ - { - inputs: [], - stateMutability: 'nonpayable', - type: 'constructor' - }, - { - inputs: [], - name: 'AccessControlBadConfirmation', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address' - }, - { - internalType: 'bytes32', - name: 'neededRole', - type: 'bytes32' - } - ], - name: 'AccessControlUnauthorizedAccount', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'target', - type: 'address' - } - ], - name: 'AddressEmptyCode', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'implementation', - type: 'address' - } - ], - name: 'ERC1967InvalidImplementation', - type: 'error' - }, - { - inputs: [], - name: 'ERC1967NonPayable', - type: 'error' - }, - { - inputs: [], - name: 'FailedInnerCall', - type: 'error' - }, - { - inputs: [], - name: 'InvalidInitialization', - type: 'error' - }, - { - inputs: [], - name: 'NotInitializing', - type: 'error' - }, - { - inputs: [], - name: 'ReentrancyGuardReentrantCall', - type: 'error' - }, - { - inputs: [], - name: 'UUPSUnauthorizedCallContext', - type: 'error' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'slot', - type: 'bytes32' - } - ], - name: 'UUPSUnsupportedProxiableUUID', - type: 'error' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'cycle', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'xAllocations', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'vote2Earn', - type: 'uint256' - }, - { - indexed: false, - internalType: 'uint256', - name: 'treasury', - type: 'uint256' - } - ], - name: 'EmissionDistributed', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint64', - name: 'version', - type: 'uint64' - } - ], - name: 'Initialized', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - indexed: true, - internalType: 'bytes32', - name: 'previousAdminRole', - type: 'bytes32' - }, - { - indexed: true, - internalType: 'bytes32', - name: 'newAdminRole', - type: 'bytes32' - } - ], - name: 'RoleAdminChanged', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - indexed: true, - internalType: 'address', - name: 'account', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'sender', - type: 'address' - } - ], - name: 'RoleGranted', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - indexed: true, - internalType: 'address', - name: 'account', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'sender', - type: 'address' - } - ], - name: 'RoleRevoked', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'implementation', - type: 'address' - } - ], - name: 'Upgraded', - type: 'event' - }, - { - inputs: [], - name: 'DEFAULT_ADMIN_ROLE', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'MINTER_ROLE', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'UPGRADER_ROLE', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'UPGRADE_INTERFACE_VERSION', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'b3tr', - outputs: [ - { - internalType: 'contract IB3TR', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'bootstrap', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'cycleDuration', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'distribute', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'cycle', - type: 'uint256' - } - ], - name: 'emissions', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'xAllocations', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'vote2Earn', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'treasury', - type: 'uint256' - } - ], - internalType: 'struct Emissions.Emission', - name: '', - type: 'tuple' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getCurrentCycle', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getNextCycleBlock', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getRemainingEmissions', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - } - ], - name: 'getRoleAdmin', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'cycle', - type: 'uint256' - } - ], - name: 'getTreasuryAmount', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'cycle', - type: 'uint256' - } - ], - name: 'getVote2EarnAmount', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'cycle', - type: 'uint256' - } - ], - name: 'getXAllocationAmount', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'account', - type: 'address' - } - ], - name: 'grantRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'account', - type: 'address' - } - ], - name: 'hasRole', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'initialXAppAllocation', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - components: [ - { - internalType: 'address', - name: 'minter', - type: 'address' - }, - { - internalType: 'address', - name: 'admin', - type: 'address' - }, - { - internalType: 'address', - name: 'upgrader', - type: 'address' - }, - { - internalType: 'address', - name: 'b3trAddress', - type: 'address' - }, - { - internalType: 'address[3]', - name: 'destinations', - type: 'address[3]' - }, - { - internalType: 'uint256', - name: 'initialXAppAllocation', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'cycleDuration', - type: 'uint256' - }, - { - internalType: 'uint256[4]', - name: 'decaySettings', - type: 'uint256[4]' - }, - { - internalType: 'uint256', - name: 'treasuryPercentage', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'maxVote2EarnDecay', - type: 'uint256' - } - ], - internalType: 'struct Emissions.InitializationData', - name: 'data', - type: 'tuple' - } - ], - name: 'initialize', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'cycle', - type: 'uint256' - } - ], - name: 'isCycleDistributed', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'cycle', - type: 'uint256' - } - ], - name: 'isCycleEnded', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'isNextCycleDistributable', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'lastEmissionBlock', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'maxVote2EarnDecay', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'nextCycle', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'proxiableUUID', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'callerConfirmation', - type: 'address' - } - ], - name: 'renounceRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes32', - name: 'role', - type: 'bytes32' - }, - { - internalType: 'address', - name: 'account', - type: 'address' - } - ], - name: 'revokeRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'scalingFactor', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_cycleDuration', - type: 'uint256' - } - ], - name: 'setCycleDuration', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_maxVote2EarnDecay', - type: 'uint256' - } - ], - name: 'setMaxVote2EarnDecay', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_scalingFactor', - type: 'uint256' - } - ], - name: 'setScalingFactor', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'treasuryAddress', - type: 'address' - } - ], - name: 'setTreasuryAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_percentage', - type: 'uint256' - } - ], - name: 'setTreasuryPercentage', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'vote2EarnAddress', - type: 'address' - } - ], - name: 'setVote2EarnAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_decay', - type: 'uint256' - } - ], - name: 'setVote2EarnDecay', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_period', - type: 'uint256' - } - ], - name: 'setVote2EarnDecayPeriod', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_decay', - type: 'uint256' - } - ], - name: 'setXAllocationsDecay', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: '_period', - type: 'uint256' - } - ], - name: 'setXAllocationsDecayPeriod', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: '_xAllocationsGovernor', - type: 'address' - } - ], - name: 'setXAllocationsGovernorAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'xAllocationAddress', - type: 'address' - } - ], - name: 'setXallocationsAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'start', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'bytes4', - name: 'interfaceId', - type: 'bytes4' - } - ], - name: 'supportsInterface', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'totalEmissions', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'treasury', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'treasuryPercentage', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'newImplementation', - type: 'address' - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes' - } - ], - name: 'upgradeToAndCall', - outputs: [], - stateMutability: 'payable', - type: 'function' - }, - { - inputs: [], - name: 'version', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'pure', - type: 'function' - }, - { - inputs: [], - name: 'vote2Earn', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'vote2EarnDecay', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'vote2EarnDecayPeriod', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'xAllocations', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'xAllocationsDecay', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'xAllocationsDecayPeriod', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'xAllocationsGovernor', - outputs: [ - { - internalType: 'contract IXAllocationVotingGovernor', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; - -const emissionAddress = '0x3d7616213191a10460e49cfdb7edbf88d6a10942'; - -const xAllocationAddress = '0x90c1a329e11ce6429eef0ab9b8f7daab68694e7d'; - -const OWNER_RESTRICTION_BYTECODE = - '0x6080604052348015600f57600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602a6001819055506102eb806100676000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80637ea1e23c1461003b578063c21250fc14610057575b600080fd5b610055600480360381019061005091906101e1565b610075565b005b61005f61010d565b60405161006c919061021d565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fa90610295565b60405180910390fd5b8060018190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461019e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019590610295565b60405180910390fd5b600154905090565b600080fd5b6000819050919050565b6101be816101ab565b81146101c957600080fd5b50565b6000813590506101db816101b5565b92915050565b6000602082840312156101f7576101f66101a6565b5b6000610205848285016101cc565b91505092915050565b610217816101ab565b82525050565b6000602082019050610232600083018461020e565b92915050565b600082825260208201905092915050565b7f4e6f742074686520636f6e7472616374206f776e657200000000000000000000600082015250565b600061027f601683610238565b915061028a82610249565b602082019050919050565b600060208201905081810360008301526102ae81610272565b905091905056fea26469706673582212200719d4ab638d395991460f36ead3fd54bf340678d7805bce38f901b5533bf69664736f6c63430008190033'; - -export { - contractBytecode, - deployedContractAbi, - deployedContractBytecode, - depositContractAbi, - depositContractBytecode, - emissionAddress, - emissionsABI, - ERC20_CONTRACT_ADDRESS_ON_TESTNET, - erc20ContractBytecode, - erc721ContractBytecode, - erc721ContractTestCases, - eventExampleAbi, - eventExampleBytecode, - filterContractEventsTestCases, - fourArgsEventAbi, - multipleClausesTestCases, - OWNER_RESTRICTION_ABI, - OWNER_RESTRICTION_BYTECODE, - sampleTwoValuesReturnAbi, - sampleTwoValuesReturnBytecode, - testingContractEVMExtensionTestCases, - testingContractNegativeTestCases, - testingContractTestCases, - TESTNET_DELEGATE_URL, - xAllocationAddress, - xAllocationVotingGovernorABI -}; diff --git a/packages/network/tests/thor-client/debug/DebugModule.solo.test.ts b/packages/network/tests/thor-client/debug/DebugModule.solo.test.ts deleted file mode 100644 index 12e599fcb..000000000 --- a/packages/network/tests/thor-client/debug/DebugModule.solo.test.ts +++ /dev/null @@ -1,443 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { Address, BlockId, HexUInt } from '@vechain/sdk-core'; -import { transfer1VTHOClause } from '../transactions/fixture'; -import { - THOR_SOLO_URL, - ThorClient, - type TraceReturnType, - type TracerName, - type TransactionReceipt -} from '../../../src'; -import { sendTransactionWithAccountIndex } from './fixture-thorest'; - -const TIMEOUT = 10000; - -const TO = Address.of('0x0000000000000000000000000000456E65726779'); - -async function testTraceContractCall( - thorClient: ThorClient, - tracerName: TracerName, - txPromise: Promise -): Promise> { - const txReceipt = await txPromise; - return await thorClient.debug.traceContractCall( - { - target: { - to: TO, - data: HexUInt.of(transfer1VTHOClause.data) - }, - options: { - caller: txReceipt?.gasPayer as string, - gasPayer: txReceipt?.gasPayer as string - }, - config: {} - }, - tracerName - ); -} - -async function testTransactionClause( - thorClient: ThorClient, - tracerName: TracerName, - txPromise: Promise -): Promise> { - const txReceipt = await txPromise; - return await thorClient.debug.traceTransactionClause( - { - target: { - blockId: BlockId.of(txReceipt?.meta.blockID as string), - transaction: BlockId.of(txReceipt?.meta.txID as string), - clauseIndex: 0 - }, - config: {} - }, - tracerName - ); -} - -/** - * Test AccountsModule class. - * - * @group integration/network/thor-client - * - * **NOTE**: these tests succeeds once per Thor Solo run. - * Stop and start Thor Solo to re-run tests. - */ -describe('DebugModule testnet tests', () => { - const thorClient = ThorClient.at(THOR_SOLO_URL); - - describe('name = empty, sender account index = 7', () => { - const tracerName = ''; - const senderAccountIndex = 7; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = 4byte, sender account index = 8', () => { - const senderAccountIndex = 8; - const tracerName = '4byte'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = call, sender account index = 9', () => { - const senderAccountIndex = 9; - const tracerName = 'call'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = noop, sender account index = 10', () => { - const senderAccountIndex = 10; - const tracerName = 'noop'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = prestate, sender account index = 11', () => { - const senderAccountIndex = 11; - const tracerName = 'prestate'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = unigram, sender account index = 12', () => { - const senderAccountIndex = 12; - const tracerName = 'unigram'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = bigram, sender account index = 13', () => { - const senderAccountIndex = 13; - const tracerName = 'bigram'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = trigram, sender account index = 14', () => { - const senderAccountIndex = 14; - const tracerName = 'trigram'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = evmdis, sender account index = 15', () => { - const senderAccountIndex = 15; - const tracerName = 'evmdis'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = opcount, sender account index = 16', () => { - const senderAccountIndex = 16; - const tracerName = 'opcount'; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); - - describe('name = null, sender account index = 17', () => { - const senderAccountIndex = 17; - const tracerName = null; - const txPromise = sendTransactionWithAccountIndex( - senderAccountIndex, - thorClient - ); - test( - 'ok <- traceContractCall', - async () => { - const result = await testTraceContractCall( - thorClient, - tracerName, - txPromise - ); - expect(result).toBeDefined(); - }, - TIMEOUT - ); - - test( - 'ok <- traceTransactionClause', - async () => { - const actual = await testTransactionClause( - thorClient, - tracerName, - txPromise - ); - expect(actual).toBeDefined(); - }, - TIMEOUT - ); - }); -}); diff --git a/packages/network/tests/thor-client/debug/DebugModule.testnet.test.ts b/packages/network/tests/thor-client/debug/DebugModule.testnet.test.ts deleted file mode 100644 index bc22014e8..000000000 --- a/packages/network/tests/thor-client/debug/DebugModule.testnet.test.ts +++ /dev/null @@ -1,537 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { InvalidDataType } from '@vechain/sdk-errors'; -import { - TESTNET_URL, - ThorClient, - type ContractTraceTarget, - type RetrieveStorageRangeOptions, - type TracerName, - type TransactionTraceTarget -} from '../../../src'; -import { - Address, - BlockId, - BlockRef, - HexUInt, - VET, - VTHO -} from '@vechain/sdk-core'; - -const TIMEOUT = 5000; - -/** - * Test AccountsModule class. - * - * @group integration/network/thor-client - */ -describe('DebugModule testnet tests', () => { - const thorClient = ThorClient.at(TESTNET_URL); - - describe('retrieveStorageRange method tests', () => { - test( - 'InvalidDataType <- negative clause index', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - clauseIndex: -1, - transaction: 0 - }; - const options = { - address: Address.of( - '0x0000000000000000000000000000456E65726779' - ), - keyStart: BlockId.of(0), - maxResult: 10 - }; - await expect( - thorClient.debug.retrieveStorageRange({ target, options }) - ).rejects.toThrowError(InvalidDataType); - }, - TIMEOUT - ); - - test( - 'InvalidDataType <- negative transaction', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - clauseIndex: 0, - transaction: -1 - }; - const options = { - address: Address.of( - '0x0000000000000000000000000000456E65726779' - ), - keyStart: BlockId.of(0), - maxResult: 10 - }; - await expect( - thorClient.debug.retrieveStorageRange({ target, options }) - ).rejects.toThrowError(InvalidDataType); - }, - TIMEOUT - ); - - test( - 'ok <- transaction 1', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - clauseIndex: 0, - transaction: 0 - }; - const options: RetrieveStorageRangeOptions = { - address: Address.of( - '0x0000000000000000000000000000456E65726779' - ), - keyStart: BlockId.of(0), - maxResult: 10 - }; - const expected = { - storage: { - '0x004f6609cc5d569ecfdbd606d943edc5d83a893186f2942aef5e133e356ed17c': - { - key: '0x9a92ca715ec8529b3ee4dbefd75e142176b92c3d93701808be4e36296718a5f3', - value: '0x000000000000000000000000000000000000046ff5af2138c51ba45a80000000' - }, - '0x0065bf3c383c7f05733ee6567e3a1201970bb5f4288d1bdb6d894167f8fc68dd': - { - key: '0xf3dfa1b3c541595cd415aef361e508553fc80af15b3e2e0d9a4e2408f2111ed8', - value: '0xfffffffffffffffffffffffffffffffffffffffffffffe280bc404dc5470db3e' - }, - '0x01783f86c9e29f37f3277ed5abb62353ef8baf304337e511f1b5edefc9756b23': - { - key: '0x01cfb1f8b52bdbeb1178ba8fc499479815330143d1acddb9c9d5686cd596ec24', - value: '0x0000000000000000000000000000000000000010000000000000000000000000' - }, - '0x0195180093382541d5396e797bd49250b1664fe8db68ff5c1d53ca95046f4549': - { - key: '0x3f4626c77582db20d0d690ce3ad9bfde8f9dd508c0212a187684678bd9dc397a', - value: '0x000000000000000000000000000000000000000082eed4d8eb7286de6e540000' - }, - '0x02631b1c9d1e3f1360c4c6ee00ea48161dc85a0e153a0a484429bbcef16e581e': - { - key: '0xc5e3f1ff368ddfee94124549ec19d8a50547b5cb0cc55ba72188b7159fb3ab3f', - value: '0x00000000000000000000000000000000000000000052b7d2dcc80cd2e4000000' - }, - '0x038658243306b2d07b512b04e6ddd4d70c49fd93969d71d51b0af7cf779d1c8f': - { - key: '0x87b232cdb2002f97b61df380acf088f13e5006543d63780567aa2b886c6a1a90', - value: '0x00000000000000000000000000000000000000000052b7cd7100aea580f00000' - }, - '0x03969104d4e5233e212c939a85ef26b8156e2fbb0485d6d751c677e854e9ba55': - { - key: '0xa887493a2b531915738a065a24263abae3722b9a8928a96c14c1f52a05964f23', - value: '0x00000000000000000000000000000000000000000000003635c9adc5dea00000' - }, - '0x04379cd040e82a999f53dba26500b68e4dd783b2039d723fe9e06edecfc8c9f1': - { - key: '0x831ade39167b84e87f89fd4cd0bcec5783d2281fe44d2bc6cb93daaff46d569e', - value: '0x000000000000000000000000000000000000000000002a1b4ae1206dd9bd0000' - }, - '0x0465f4b6f9fccdb2ad6f4eac8aa7731bfe4c78f6cf22f397b5ef10398d4d5771': - { - key: '0x5d56afd38de44f293bdce388b7d98120f55971a0f3a608797f1ddaced0f2b047', - value: '0x00000000000000000000000000000000000000000052b7c8053950781de00000' - }, - '0x04af8500fb85efaaa5f171ef60708fc306c474011fabb6fbafcb626f09661a01': - { - key: '0x136aee904ebcade77dc8d3c6e48a2365b1d9dff83f78eb90d2f6e5ef4a6466c6', - value: '0x000000000000000000000000008ca1a3b5cbedeb0f1a0900000080845b322ac0' - } - }, - nextKey: - '0x04e9569439bd218fce594dbd705b41f2afe6b6d8abcb9c5aaa5b1a52b7ab7cea' - }; - const actual = await thorClient.debug.retrieveStorageRange({ - target, - options - }); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - - test( - 'ok <- transaction 2', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - clauseIndex: 0, - transaction: 1 - }; - const options: RetrieveStorageRangeOptions = { - address: Address.of( - '0x0000000000000000000000000000456E65726779' - ), - keyStart: BlockId.of(0), - maxResult: 10 - }; - const expected = { - storage: { - '0x004f6609cc5d569ecfdbd606d943edc5d83a893186f2942aef5e133e356ed17c': - { - key: '0x9a92ca715ec8529b3ee4dbefd75e142176b92c3d93701808be4e36296718a5f3', - value: '0x000000000000000000000000000000000000046ff5af2138c51ba45a80000000' - }, - '0x0065bf3c383c7f05733ee6567e3a1201970bb5f4288d1bdb6d894167f8fc68dd': - { - key: '0xf3dfa1b3c541595cd415aef361e508553fc80af15b3e2e0d9a4e2408f2111ed8', - value: '0xfffffffffffffffffffffffffffffffffffffffffffffe280bc404dc5470db3e' - }, - '0x01783f86c9e29f37f3277ed5abb62353ef8baf304337e511f1b5edefc9756b23': - { - key: '0x01cfb1f8b52bdbeb1178ba8fc499479815330143d1acddb9c9d5686cd596ec24', - value: '0x0000000000000000000000000000000000000010000000000000000000000000' - }, - '0x0195180093382541d5396e797bd49250b1664fe8db68ff5c1d53ca95046f4549': - { - key: '0x3f4626c77582db20d0d690ce3ad9bfde8f9dd508c0212a187684678bd9dc397a', - value: '0x000000000000000000000000000000000000000082eed4d8eb7286de6e540000' - }, - '0x02631b1c9d1e3f1360c4c6ee00ea48161dc85a0e153a0a484429bbcef16e581e': - { - key: '0xc5e3f1ff368ddfee94124549ec19d8a50547b5cb0cc55ba72188b7159fb3ab3f', - value: '0x00000000000000000000000000000000000000000052b7d2dcc80cd2e4000000' - }, - '0x038658243306b2d07b512b04e6ddd4d70c49fd93969d71d51b0af7cf779d1c8f': - { - key: '0x87b232cdb2002f97b61df380acf088f13e5006543d63780567aa2b886c6a1a90', - value: '0x00000000000000000000000000000000000000000052b7cd7100aea580f00000' - }, - '0x03969104d4e5233e212c939a85ef26b8156e2fbb0485d6d751c677e854e9ba55': - { - key: '0xa887493a2b531915738a065a24263abae3722b9a8928a96c14c1f52a05964f23', - value: '0x00000000000000000000000000000000000000000000003635c9adc5dea00000' - }, - '0x04379cd040e82a999f53dba26500b68e4dd783b2039d723fe9e06edecfc8c9f1': - { - key: '0x831ade39167b84e87f89fd4cd0bcec5783d2281fe44d2bc6cb93daaff46d569e', - value: '0x000000000000000000000000000000000000000000002a1b4ae1206dd9bd0000' - }, - '0x0465f4b6f9fccdb2ad6f4eac8aa7731bfe4c78f6cf22f397b5ef10398d4d5771': - { - key: '0x5d56afd38de44f293bdce388b7d98120f55971a0f3a608797f1ddaced0f2b047', - value: '0x00000000000000000000000000000000000000000052b7c8053950781de00000' - }, - '0x04af8500fb85efaaa5f171ef60708fc306c474011fabb6fbafcb626f09661a01': - { - key: '0x136aee904ebcade77dc8d3c6e48a2365b1d9dff83f78eb90d2f6e5ef4a6466c6', - value: '0x000000000000000000000000008ca1a3b5cbedeb0f1a0900000080845b322ac0' - } - }, - nextKey: - '0x04e9569439bd218fce594dbd705b41f2afe6b6d8abcb9c5aaa5b1a52b7ab7cea' - }; - const actual = await thorClient.debug.retrieveStorageRange({ - target, - options - }); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - }); - - describe('traceContractCall method tests', () => { - test( - 'ok <- contract deployment', - async () => { - const target: ContractTraceTarget = { - to: null, // because it is a contract deployment. - data: HexUInt.of( - '0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce5671461025957806370a082311461028a57806395d89b41146102e1578063a9059cbb14610371578063bb35783b146103d6578063d89135cd1461045b578063dd62ed3e14610486575b600080fd5b3480156100c057600080fd5b506100c96104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053a565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be61062b565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610865565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b506102f661094d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037d57600080fd5b506103bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098a565b604051808215151515815260200191505060405180910390f35b3480156103e257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b50610470610b67565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0d565b6040518082815260200191505060405180910390f35b60606040805190810160405280600681526020017f566554686f720000000000000000000000000000000000000000000000000000815250905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1663592b389c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b8101908080519060200190929190505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6275696c74696e3a20696e73756666696369656e7420616c6c6f77616e63650081525060200191505060405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061085a848484610c93565b600190509392505050565b60006012905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663ee660480836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b81019080805190602001909291905050509050919050565b60606040805190810160405280600481526020017f5654484f00000000000000000000000000000000000000000000000000000000815250905090565b6000610997338484610c93565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610add57503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663059950e9866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b1515610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6275696c74696e3a2073656c66206f72206d617374657220726571756972656481525060200191505060405180910390fd5b610b5c848484610c93565b600190509392505050565b60003073ffffffffffffffffffffffffffffffffffffffff1663138d4d0c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b8101908080519060200190929190505050905090565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000811115610eaa573073ffffffffffffffffffffffffffffffffffffffff166339ed08d584836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050506040513d6020811015610d6957600080fd5b81019080805190602001909291905050501515610dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6275696c74696e3a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631cedfac183836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820bd55cb9aff347dc60fe8280ae6b08a6f6deacc85a4e1c89ba0a8ef31fbcaecc60029' - ) - }; - const options = { - caller: Address.of( - '0x0000000000000000000000000000000000000000' - ).toString(), - gasPayer: Address.of( - '0x0000000000000000000000000000000000000000' - ).toString(), - gas: Number(VTHO.of(0).wei) - }; - const name = 'call'; - const expected = { - from: '0x0000000000000000000000000000000000000000', - gas: '0x0', - gasUsed: '0x0', - input: '0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce5671461025957806370a082311461028a57806395d89b41146102e1578063a9059cbb14610371578063bb35783b146103d6578063d89135cd1461045b578063dd62ed3e14610486575b600080fd5b3480156100c057600080fd5b506100c96104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053a565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be61062b565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610865565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b506102f661094d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037d57600080fd5b506103bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098a565b604051808215151515815260200191505060405180910390f35b3480156103e257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b50610470610b67565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0d565b6040518082815260200191505060405180910390f35b60606040805190810160405280600681526020017f566554686f720000000000000000000000000000000000000000000000000000815250905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1663592b389c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b8101908080519060200190929190505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6275696c74696e3a20696e73756666696369656e7420616c6c6f77616e63650081525060200191505060405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061085a848484610c93565b600190509392505050565b60006012905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663ee660480836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b81019080805190602001909291905050509050919050565b60606040805190810160405280600481526020017f5654484f00000000000000000000000000000000000000000000000000000000815250905090565b6000610997338484610c93565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610add57503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663059950e9866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b1515610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6275696c74696e3a2073656c66206f72206d617374657220726571756972656481525060200191505060405180910390fd5b610b5c848484610c93565b600190509392505050565b60003073ffffffffffffffffffffffffffffffffffffffff1663138d4d0c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b8101908080519060200190929190505050905090565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000811115610eaa573073ffffffffffffffffffffffffffffffffffffffff166339ed08d584836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050506040513d6020811015610d6957600080fd5b81019080805190602001909291905050501515610dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6275696c74696e3a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631cedfac183836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820bd55cb9aff347dc60fe8280ae6b08a6f6deacc85a4e1c89ba0a8ef31fbcaecc60029', - error: 'execution reverted', - value: '0x0', - type: 'CREATE' - }; - const actual = await thorClient.debug.traceContractCall( - { - target, - options, - config: {} - }, - name - ); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - - test( - 'ok <- token transfer', - async () => { - const target = { - to: Address.of( - '0x0000000000000000000000000000456E65726779' - ), - data: HexUInt.of( - '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000' - ), - value: VET.of(0) - }; - const options = { - caller: Address.of( - '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF' - ).toString(), - gasPayer: Address.of( - '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF' - ).toString(), - expiration: 18, - blockRef: BlockRef.of('0x0101d05409d55cce').toString(), - gas: 0 - }; - const name = 'call'; - const expected = { - from: '0x625fce8dd8e2c05e82e77847f3da06af6e55a7af', - gas: '0x0', - gasUsed: '0x0', - to: '0x0000000000000000000000000000456e65726779', - input: '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000', - output: '0x0000000000000000000000000000000000000000000000000000000000000001', - calls: [ - { - from: '0x0000000000000000000000000000456e65726779', - gas: '0x2eefd15', - gasUsed: '0xefe', - to: '0x0000000000000000000000000000456e65726779', - input: '0x39ed08d5000000000000000000000000625fce8dd8e2c05e82e77847f3da06af6e55a7af000000000000000000000000000000000000000000000004563918244f400000', - output: '0x0000000000000000000000000000000000000000000000000000000000000001', - value: '0x0', - type: 'CALL' - }, - { - from: '0x0000000000000000000000000000456e65726779', - gas: '0x2eee7d0', - gasUsed: '0xefe', - to: '0x0000000000000000000000000000456e65726779', - input: '0x1cedfac10000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000', - value: '0x0', - type: 'CALL' - } - ], - value: '0x0', - type: 'CALL' - }; - const actual = await thorClient.debug.traceContractCall( - { - target, - options, - config: {} - }, - name - ); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - }); - - describe('traceTransactionClause method tests', () => { - test( - 'InvalidDataType <- negative clause index', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 0, - clauseIndex: -1 - }; - const name: TracerName = 'call'; - await expect( - thorClient.debug.traceTransactionClause( - { - target, - config: {} - }, - name - ) - ).rejects.toThrowError(InvalidDataType); - }, - TIMEOUT - ); - - test( - 'InvalidDataType <- negative transaction index', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: -1, - clauseIndex: 0 - }; - - const name: TracerName = 'call'; - await expect( - thorClient.debug.traceTransactionClause( - { - target, - config: {} - }, - name - ) - ).rejects.toThrowError(InvalidDataType); - }, - TIMEOUT - ); - - test( - 'ok <- transaction 1 - transaction ID', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: BlockId.of( - '0x2dbc8268a2dbf889abe828c0671cb9adce61f537aab8855480aff6967e0ed687' - ), - clauseIndex: 0 - }; - const name: TracerName = 'call'; - const expected = { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x11c5', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0x02fe53050000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000f6e657742617365546f6b656e5552490000000000000000000000000000000000', - value: '0x0', - type: 'CALL' - }; - const actual = await thorClient.debug.traceTransactionClause( - { - target, - config: {} - }, - name - ); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - - test( - 'ok <- transaction 1 - transaction index', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 0, - clauseIndex: 0 - }; - const name: TracerName = 'call'; - const expected = { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x11c5', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0x02fe53050000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000f6e657742617365546f6b656e5552490000000000000000000000000000000000', - value: '0x0', - type: 'CALL' - }; - const actual = await thorClient.debug.traceTransactionClause( - { - target, - config: {} - }, - name - ); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - - test( - 'ok <- transaction 2 - transaction id', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: BlockId.of( - '0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f' - ), - clauseIndex: 0 - }; - const name: TracerName = 'call'; - const expected = { - from: '0x105199a26b10e55300cb71b46c5b5e867b7df427', - gas: '0x8b92', - gasUsed: '0x50fa', - to: '0xaa854565401724f7061e0c366ca132c87c1e5f60', - input: '0xf14fcbc800d770b9faa11ba944366f3e7a14c166f780ece542e557e0b7fe4870fcbe8dbe', - value: '0x0', - type: 'CALL' - }; - const actual = await thorClient.debug.traceTransactionClause( - { - target, - config: {} - }, - name - ); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - - test( - 'ok <- transaction 2 - transaction index', - async () => { - const target: TransactionTraceTarget = { - blockId: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 1, - clauseIndex: 0 - }; - const name: TracerName = 'call'; - const expected = { - from: '0x105199a26b10e55300cb71b46c5b5e867b7df427', - gas: '0x8b92', - gasUsed: '0x50fa', - to: '0xaa854565401724f7061e0c366ca132c87c1e5f60', - input: '0xf14fcbc800d770b9faa11ba944366f3e7a14c166f780ece542e557e0b7fe4870fcbe8dbe', - value: '0x0', - type: 'CALL' - }; - const actual = await thorClient.debug.traceTransactionClause( - { - target, - config: {} - }, - name - ); - expect(actual).toEqual(expected); - }, - TIMEOUT - ); - }); -}); diff --git a/packages/network/tests/thor-client/debug/fixture-thorest.ts b/packages/network/tests/thor-client/debug/fixture-thorest.ts deleted file mode 100644 index 84145f446..000000000 --- a/packages/network/tests/thor-client/debug/fixture-thorest.ts +++ /dev/null @@ -1,496 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; - -import { - THOR_SOLO_ACCOUNTS, - type ThorClient, - type TransactionReceipt -} from '../../../src'; -import { - transactionNonces, - transfer1VTHOClause, - transferTransactionBodyValueAsNumber -} from '../transactions/fixture'; -import { HexUInt, BlockId, Transaction } from '@vechain/sdk-core'; - -/** - * Debug traceTransactionClause tests fixture testnet - * - * @NOTE we refers to block 0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f. - * It has the following transactions: - * * Index 0 - 0x2dbc8268a2dbf889abe828c0671cb9adce61f537aab8855480aff6967e0ed687 (1 clause, index 0) - * * Index 1 - 0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f (1 clause, index 0) - */ -const traceTransactionClauseTestnetFixture = { - // Positive test cases - positiveCases: [ - // Transaction 1 - With transaction ID - { - testName: - 'traceTransactionClause - transaction 1 with transaction ID', - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: BlockId.of( - '0x2dbc8268a2dbf889abe828c0671cb9adce61f537aab8855480aff6967e0ed687' - ), - clauseIndex: 0, - expected: { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x11c5', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0x02fe53050000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000f6e657742617365546f6b656e5552490000000000000000000000000000000000', - value: '0x0', - type: 'CALL' - } - }, - // Transaction 1 - With transaction index into block - { - testName: - 'traceTransactionClause - transaction 1 with transaction index into block', - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 0, - clauseIndex: 0, - expected: { - from: '0x7487d912d03ab9de786278f679592b3730bdd540', - gas: '0x11c5', - gasUsed: '0x0', - to: '0x6e1ffe60656421eb12de92433c5a319ba606bb81', - input: '0x02fe53050000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000f6e657742617365546f6b656e5552490000000000000000000000000000000000', - value: '0x0', - type: 'CALL' - } - }, - // Transaction 2 - With transaction ID - { - testName: - 'traceTransactionClause - transaction 2 with transaction ID', - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: BlockId.of( - '0x05b31824569f2f2ec64c62c4e6396199f56ae872ff219288eb3293b4a36e7b0f' - ), - clauseIndex: 0, - expected: { - from: '0x105199a26b10e55300cb71b46c5b5e867b7df427', - gas: '0x8b92', - gasUsed: '0x50fa', - to: '0xaa854565401724f7061e0c366ca132c87c1e5f60', - input: '0xf14fcbc800d770b9faa11ba944366f3e7a14c166f780ece542e557e0b7fe4870fcbe8dbe', - value: '0x0', - type: 'CALL' - } - }, - // Transaction 2 - With transaction index into block - { - testName: - 'traceTransactionClause - transaction 2 with transaction index into block', - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 1, - clauseIndex: 0, - expected: { - from: '0x105199a26b10e55300cb71b46c5b5e867b7df427', - gas: '0x8b92', - gasUsed: '0x50fa', - to: '0xaa854565401724f7061e0c366ca132c87c1e5f60', - input: '0xf14fcbc800d770b9faa11ba944366f3e7a14c166f780ece542e557e0b7fe4870fcbe8dbe', - value: '0x0', - type: 'CALL' - } - } - ], - // Negative test cases - negativeCases: [ - // Invalid block ID - { - testName: 'traceTransactionClause - transaction 1 invalid block ID', - blockID: 'INVALID', - transaction: BlockId.of( - '0x2dbc8268a2dbf889abe828c0671cb9adce61f537aab8855480aff6967e0ed687' - ), - clauseIndex: 0, - expectedError: InvalidDataType - }, - // Invalid transaction ID - { - testName: - 'traceTransactionClause - transaction 1 invalid transaction ID', - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 'INVALID', - clauseIndex: 0, - expectedError: InvalidDataType - }, - // Invalid transaction index - { - testName: - 'traceTransactionClause - transaction 1 invalid transaction index', - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: -1, - clauseIndex: 0, - expectedError: InvalidDataType - }, - // Invalid clause index - { - testName: - 'traceTransactionClause - transaction 1 invalid clause index', - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 0, - clauseIndex: -1, - expectedError: InvalidDataType - } - ] -}; - -/** - * VTHO contract testnet - 0x0000000000000000000000000000456E65726779 - */ -const traceContractCallTestnetFixture = { - // Positive test cases - positiveCases: [ - // Transfer token - Transaction 0x7bf1cbf0485e265075a771ac4b0875b09019163f93d8e281adb893875c36453f - { - testName: 'traceContractCall - transfer token', - to: '0x0000000000000000000000000000456E65726779', - value: '0x0', - data: '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000', - caller: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - gasPayer: '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF', - gas: 0, - expiration: 18, - blockRef: '0x0101d05409d55cce', - expected: { - from: '0x625fce8dd8e2c05e82e77847f3da06af6e55a7af', - gas: '0x0', - gasUsed: '0x0', - to: '0x0000000000000000000000000000456e65726779', - input: '0xa9059cbb0000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000', - output: '0x0000000000000000000000000000000000000000000000000000000000000001', - calls: [ - { - from: '0x0000000000000000000000000000456e65726779', - gas: '0x2eefd15', - gasUsed: '0xefe', - to: '0x0000000000000000000000000000456e65726779', - input: '0x39ed08d5000000000000000000000000625fce8dd8e2c05e82e77847f3da06af6e55a7af000000000000000000000000000000000000000000000004563918244f400000', - output: '0x0000000000000000000000000000000000000000000000000000000000000001', - value: '0x0', - type: 'CALL' - }, - { - from: '0x0000000000000000000000000000456e65726779', - gas: '0x2eee7d0', - gasUsed: '0xefe', - to: '0x0000000000000000000000000000456e65726779', - input: '0x1cedfac10000000000000000000000000000000000000000000000000000456e65726779000000000000000000000000000000000000000000000004563918244f400000', - value: '0x0', - type: 'CALL' - } - ], - value: '0x0', - type: 'CALL' - } - } //, - // Contract deployment transaction - // { - // testName: 'traceContractCall - contract deployment', - // to: null, - // data: '0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce5671461025957806370a082311461028a57806395d89b41146102e1578063a9059cbb14610371578063bb35783b146103d6578063d89135cd1461045b578063dd62ed3e14610486575b600080fd5b3480156100c057600080fd5b506100c96104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053a565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be61062b565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610865565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b506102f661094d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037d57600080fd5b506103bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098a565b604051808215151515815260200191505060405180910390f35b3480156103e257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b50610470610b67565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0d565b6040518082815260200191505060405180910390f35b60606040805190810160405280600681526020017f566554686f720000000000000000000000000000000000000000000000000000815250905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1663592b389c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b8101908080519060200190929190505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6275696c74696e3a20696e73756666696369656e7420616c6c6f77616e63650081525060200191505060405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061085a848484610c93565b600190509392505050565b60006012905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663ee660480836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b81019080805190602001909291905050509050919050565b60606040805190810160405280600481526020017f5654484f00000000000000000000000000000000000000000000000000000000815250905090565b6000610997338484610c93565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610add57503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663059950e9866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b1515610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6275696c74696e3a2073656c66206f72206d617374657220726571756972656481525060200191505060405180910390fd5b610b5c848484610c93565b600190509392505050565b60003073ffffffffffffffffffffffffffffffffffffffff1663138d4d0c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b8101908080519060200190929190505050905090565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000811115610eaa573073ffffffffffffffffffffffffffffffffffffffff166339ed08d584836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050506040513d6020811015610d6957600080fd5b81019080805190602001909291905050501515610dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6275696c74696e3a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631cedfac183836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820bd55cb9aff347dc60fe8280ae6b08a6f6deacc85a4e1c89ba0a8ef31fbcaecc60029', - // caller: '0x0000000000000000000000000000000000000000', - // gasPayer: '0x0000000000000000000000000000000000000000', - // gas: 0, - // expected: { - // from: '0x0000000000000000000000000000000000000000', - // gas: '0x0', - // gasUsed: '0x0', - // input: '0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce5671461025957806370a082311461028a57806395d89b41146102e1578063a9059cbb14610371578063bb35783b146103d6578063d89135cd1461045b578063dd62ed3e14610486575b600080fd5b3480156100c057600080fd5b506100c96104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061053a565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be61062b565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610865565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b506102f661094d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037d57600080fd5b506103bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098a565b604051808215151515815260200191505060405180910390f35b3480156103e257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b50610470610b67565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c0d565b6040518082815260200191505060405180910390f35b60606040805190810160405280600681526020017f566554686f720000000000000000000000000000000000000000000000000000815250905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1663592b389c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b8101908080519060200190929190505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6275696c74696e3a20696e73756666696369656e7420616c6c6f77616e63650081525060200191505060405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061085a848484610c93565b600190509392505050565b60006012905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663ee660480836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d602081101561093557600080fd5b81019080805190602001909291905050509050919050565b60606040805190810160405280600481526020017f5654484f00000000000000000000000000000000000000000000000000000000815250905090565b6000610997338484610c93565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610add57503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663059950e9866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16145b1515610b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f6275696c74696e3a2073656c66206f72206d617374657220726571756972656481525060200191505060405180910390fd5b610b5c848484610c93565b600190509392505050565b60003073ffffffffffffffffffffffffffffffffffffffff1663138d4d0c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b8101908080519060200190929190505050905090565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000811115610eaa573073ffffffffffffffffffffffffffffffffffffffff166339ed08d584836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b505050506040513d6020811015610d6957600080fd5b81019080805190602001909291905050501515610dee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6275696c74696e3a20696e73756666696369656e742062616c616e636500000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631cedfac183836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820bd55cb9aff347dc60fe8280ae6b08a6f6deacc85a4e1c89ba0a8ef31fbcaecc60029', - // error: 'execution reverted', - // value: '0x0', - // type: 'CREATE' - // } - // } - ], - // Negative test cases - negativeCases: [ - // Invalid to - { - testName: 'traceContractCall - invalid to', - to: 'INVALID', - value: '0x0', - data: '0x0', - caller: '0x', - expectedError: InvalidDataType - }, - // Invalid value - { - testName: 'traceContractCall - invalid value', - to: null, - value: 'INVALID', - data: '0x0', - caller: '0x', - expectedError: InvalidDataType - }, - // Invalid data - { - testName: 'traceContractCall - invalid data', - to: null, - value: '0x0', - data: 'INVALID', - caller: '0x', - expectedError: InvalidDataType - } - ] -}; - -/** - * Debug retrieveStorageRange Testnet Fixture - * - * @NOTE we refers again to: - * * block 0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f - * * VTHO contract testnet - 0x0000000000000000000000000000456E65726779 - */ -const retrieveStorageRangeTestnetFixture = { - positiveCases: [ - // First transaction - { - testName: 'retrieveStorageRange - VTHO contract transaction 0', - address: '0x0000000000000000000000000000456E65726779', - keyStart: BlockId.of( - '0x0000000000000000000000000000000000000000000000000000000000000000' - ), - maxResult: 10, - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 0, - clauseIndex: 0, - expected: { - storage: { - '0x004f6609cc5d569ecfdbd606d943edc5d83a893186f2942aef5e133e356ed17c': - { - key: '0x9a92ca715ec8529b3ee4dbefd75e142176b92c3d93701808be4e36296718a5f3', - value: '0x000000000000000000000000000000000000046ff5af2138c51ba45a80000000' - }, - '0x0065bf3c383c7f05733ee6567e3a1201970bb5f4288d1bdb6d894167f8fc68dd': - { - key: '0xf3dfa1b3c541595cd415aef361e508553fc80af15b3e2e0d9a4e2408f2111ed8', - value: '0xfffffffffffffffffffffffffffffffffffffffffffffe280bc404dc5470db3e' - }, - '0x01783f86c9e29f37f3277ed5abb62353ef8baf304337e511f1b5edefc9756b23': - { - key: '0x01cfb1f8b52bdbeb1178ba8fc499479815330143d1acddb9c9d5686cd596ec24', - value: '0x0000000000000000000000000000000000000010000000000000000000000000' - }, - '0x0195180093382541d5396e797bd49250b1664fe8db68ff5c1d53ca95046f4549': - { - key: '0x3f4626c77582db20d0d690ce3ad9bfde8f9dd508c0212a187684678bd9dc397a', - value: '0x000000000000000000000000000000000000000082eed4d8eb7286de6e540000' - }, - '0x02631b1c9d1e3f1360c4c6ee00ea48161dc85a0e153a0a484429bbcef16e581e': - { - key: '0xc5e3f1ff368ddfee94124549ec19d8a50547b5cb0cc55ba72188b7159fb3ab3f', - value: '0x00000000000000000000000000000000000000000052b7d2dcc80cd2e4000000' - }, - '0x038658243306b2d07b512b04e6ddd4d70c49fd93969d71d51b0af7cf779d1c8f': - { - key: '0x87b232cdb2002f97b61df380acf088f13e5006543d63780567aa2b886c6a1a90', - value: '0x00000000000000000000000000000000000000000052b7cd7100aea580f00000' - }, - '0x03969104d4e5233e212c939a85ef26b8156e2fbb0485d6d751c677e854e9ba55': - { - key: '0xa887493a2b531915738a065a24263abae3722b9a8928a96c14c1f52a05964f23', - value: '0x00000000000000000000000000000000000000000000003635c9adc5dea00000' - }, - '0x04379cd040e82a999f53dba26500b68e4dd783b2039d723fe9e06edecfc8c9f1': - { - key: '0x831ade39167b84e87f89fd4cd0bcec5783d2281fe44d2bc6cb93daaff46d569e', - value: '0x000000000000000000000000000000000000000000002a1b4ae1206dd9bd0000' - }, - '0x0465f4b6f9fccdb2ad6f4eac8aa7731bfe4c78f6cf22f397b5ef10398d4d5771': - { - key: '0x5d56afd38de44f293bdce388b7d98120f55971a0f3a608797f1ddaced0f2b047', - value: '0x00000000000000000000000000000000000000000052b7c8053950781de00000' - }, - '0x04af8500fb85efaaa5f171ef60708fc306c474011fabb6fbafcb626f09661a01': - { - key: '0x136aee904ebcade77dc8d3c6e48a2365b1d9dff83f78eb90d2f6e5ef4a6466c6', - value: '0x000000000000000000000000008ca1a3b5cbedeb0f1a0900000080845b322ac0' - } - }, - nextKey: - '0x04e9569439bd218fce594dbd705b41f2afe6b6d8abcb9c5aaa5b1a52b7ab7cea' - } - }, - // Second transaction - { - testName: 'retrieveStorageRange - VTHO contract transaction 0', - address: '0x0000000000000000000000000000456E65726779', - keyStart: - '0x0000000000000000000000000000000000000000000000000000000000000000', - maxResult: 10, - blockID: BlockId.of( - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f' - ), - transaction: 1, - clauseIndex: 0, - expected: { - storage: { - '0x004f6609cc5d569ecfdbd606d943edc5d83a893186f2942aef5e133e356ed17c': - { - key: '0x9a92ca715ec8529b3ee4dbefd75e142176b92c3d93701808be4e36296718a5f3', - value: '0x000000000000000000000000000000000000046ff5af2138c51ba45a80000000' - }, - '0x0065bf3c383c7f05733ee6567e3a1201970bb5f4288d1bdb6d894167f8fc68dd': - { - key: '0xf3dfa1b3c541595cd415aef361e508553fc80af15b3e2e0d9a4e2408f2111ed8', - value: '0xfffffffffffffffffffffffffffffffffffffffffffffe280bc404dc5470db3e' - }, - '0x01783f86c9e29f37f3277ed5abb62353ef8baf304337e511f1b5edefc9756b23': - { - key: '0x01cfb1f8b52bdbeb1178ba8fc499479815330143d1acddb9c9d5686cd596ec24', - value: '0x0000000000000000000000000000000000000010000000000000000000000000' - }, - '0x0195180093382541d5396e797bd49250b1664fe8db68ff5c1d53ca95046f4549': - { - key: '0x3f4626c77582db20d0d690ce3ad9bfde8f9dd508c0212a187684678bd9dc397a', - value: '0x000000000000000000000000000000000000000082eed4d8eb7286de6e540000' - }, - '0x02631b1c9d1e3f1360c4c6ee00ea48161dc85a0e153a0a484429bbcef16e581e': - { - key: '0xc5e3f1ff368ddfee94124549ec19d8a50547b5cb0cc55ba72188b7159fb3ab3f', - value: '0x00000000000000000000000000000000000000000052b7d2dcc80cd2e4000000' - }, - '0x038658243306b2d07b512b04e6ddd4d70c49fd93969d71d51b0af7cf779d1c8f': - { - key: '0x87b232cdb2002f97b61df380acf088f13e5006543d63780567aa2b886c6a1a90', - value: '0x00000000000000000000000000000000000000000052b7cd7100aea580f00000' - }, - '0x03969104d4e5233e212c939a85ef26b8156e2fbb0485d6d751c677e854e9ba55': - { - key: '0xa887493a2b531915738a065a24263abae3722b9a8928a96c14c1f52a05964f23', - value: '0x00000000000000000000000000000000000000000000003635c9adc5dea00000' - }, - '0x04379cd040e82a999f53dba26500b68e4dd783b2039d723fe9e06edecfc8c9f1': - { - key: '0x831ade39167b84e87f89fd4cd0bcec5783d2281fe44d2bc6cb93daaff46d569e', - value: '0x000000000000000000000000000000000000000000002a1b4ae1206dd9bd0000' - }, - '0x0465f4b6f9fccdb2ad6f4eac8aa7731bfe4c78f6cf22f397b5ef10398d4d5771': - { - key: '0x5d56afd38de44f293bdce388b7d98120f55971a0f3a608797f1ddaced0f2b047', - value: '0x00000000000000000000000000000000000000000052b7c8053950781de00000' - }, - '0x04af8500fb85efaaa5f171ef60708fc306c474011fabb6fbafcb626f09661a01': - { - key: '0x136aee904ebcade77dc8d3c6e48a2365b1d9dff83f78eb90d2f6e5ef4a6466c6', - value: '0x000000000000000000000000008ca1a3b5cbedeb0f1a0900000080845b322ac0' - } - }, - nextKey: - '0x04e9569439bd218fce594dbd705b41f2afe6b6d8abcb9c5aaa5b1a52b7ab7cea' - } - } - ], - negativeCases: [ - // Invalid blockID - { - testName: 'retrieveStorageRange - Invalid block id as input', - address: '0x0000000000000000000000000000456E65726779', - keyStart: - '0x0000000000000000000000000000000000000000000000000000000000000000', - maxResult: 10, - blockID: 'INVALID', - transaction: 0, - clauseIndex: 0, - expectedError: InvalidDataType - }, - // Invalid transaction - { - testName: 'retrieveStorageRange - Invalid transaction as input - 1', - address: '0x0000000000000000000000000000456E65726779', - keyStart: - '0x0000000000000000000000000000000000000000000000000000000000000000', - maxResult: 10, - blockID: - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f', - transaction: -1, - clauseIndex: 0, - expectedError: InvalidDataType - }, - // Invalid transaction - { - testName: 'retrieveStorageRange - Invalid transaction as input - 2', - address: '0x0000000000000000000000000000456E65726779', - keyStart: - '0x0000000000000000000000000000000000000000000000000000000000000000', - maxResult: 10, - blockID: - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f', - transaction: 'INVALID', - clauseIndex: 0, - expectedError: InvalidDataType - }, - // Invalid clauseIndex - { - testName: 'retrieveStorageRange - Invalid block id as input', - address: '0x0000000000000000000000000000456E65726779', - keyStart: - '0x0000000000000000000000000000000000000000000000000000000000000000', - maxResult: 10, - blockID: - '0x010e80e3278e234b8a5d1195c376909456b94d1f7cf3cb7bfab1e8998dbcfa8f', - transaction: 0, - clauseIndex: -1, - expectedError: InvalidDataType - } - ] -}; - -/** - * Send a transaction using a sender account index - * @param senderIndex The index of the sender account - * @param thorClient The ThorClient instance - * @returns The transaction receipt - */ -const sendTransactionWithAccountIndex = async ( - senderIndex: number, - thorClient: ThorClient -): Promise => { - // Estimate the gas required for the transfer transaction - const gasResult = await thorClient.gas.estimateGas( - [transfer1VTHOClause], - THOR_SOLO_ACCOUNTS[senderIndex].address - ); - - // Create the signed transfer transaction - const tx = Transaction.of({ - ...transferTransactionBodyValueAsNumber, - gas: gasResult.totalGas, - nonce: transactionNonces - .sendTransactionWithANumberAsValueInTransactionBody[0] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[senderIndex].privateKey).bytes); - - // Send the transaction and obtain the transaction ID - const sendTransactionResult = - await thorClient.transactions.sendTransaction(tx); - - // Wait for the transaction to be included in a block - return await sendTransactionResult.wait(); -}; - -export { - traceTransactionClauseTestnetFixture, - traceContractCallTestnetFixture, - retrieveStorageRangeTestnetFixture, - sendTransactionWithAccountIndex -}; diff --git a/packages/network/tests/thor-client/gas/fixture.ts b/packages/network/tests/thor-client/gas/fixture.ts deleted file mode 100644 index eba11fc52..000000000 --- a/packages/network/tests/thor-client/gas/fixture.ts +++ /dev/null @@ -1,346 +0,0 @@ -import { ABIContract, Units } from '@vechain/sdk-core'; -import { InvalidDataType } from '@vechain/sdk-errors'; -import { BUILT_IN_CONTRACTS } from '../../../src'; -import { - TEST_ACCOUNTS, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS -} from '../../fixture'; -import { transfer1VTHOClause } from '../transactions/fixture'; - -/** - * Test cases for `estimateGas` method - */ -const estimateGasTestCases = { - revert: [ - { - description: - 'Should estimate gas cost of a transaction that reverts with 1 clause', - clauses: [ - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - Units.parseEther('1000000000').bi - ]) - .toString() - } - ], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: {}, - expected: { - revertReasons: ['builtin: insufficient balance'], - reverted: true, - totalGas: 39455, - vmErrors: ['execution reverted'] - } - }, - { - description: - 'Should estimate gas cost of a transaction that reverts with 2 clauses where both revert', - clauses: [ - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - Units.parseEther('1000000000').bi - ]) - .toString() - }, - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1000000000').toString(), - data: '0x' - } - ], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: {}, - expected: { - revertReasons: ['builtin: insufficient balance'], - reverted: true, - totalGas: 55455, - vmErrors: ['execution reverted'] - } - }, - { - description: - 'Should estimate gas cost of a transaction that reverts with 2 clauses where only second reverts', - clauses: [ - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - Units.parseEther('1').bi - ]) - .toString() - }, - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1000000000').toString(), - data: '0x' - } - ], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: {}, - expected: { - revertReasons: ['', ''], - reverted: true, - totalGas: 67518, - vmErrors: ['', 'insufficient balance for transfer'] - } - }, - { - description: - 'Should estimate gas cost of a transaction that reverts with 3 clauses where only last reverts', - clauses: [ - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - Units.parseEther('1').bi - ]) - .toString() - }, - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - Units.parseEther('1').bi - ]) - .toString() - }, - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - Units.parseEther('1000000000').bi - ]) - .toString() - } - ], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: {}, - expected: { - revertReasons: ['', '', 'builtin: insufficient balance'], - reverted: true, - totalGas: 102491, - vmErrors: ['', '', 'execution reverted'] - } - }, - { - description: - 'Should estimate gas cost of a transaction that reverts with a Panic(uint256) error', - clauses: [ - { - to: TESTING_CONTRACT_ADDRESS, - value: '0', - data: ABIContract.ofAbi(TESTING_CONTRACT_ABI) - .encodeFunctionInput( - 'testAssertError', - [1] // Any number !== 0 will cause Panic error - ) - .toString() - } - ], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: {}, - expected: { - revertReasons: ['Panic(0x01)'], // 0x01: If you call assert with an argument that evaluates to false. - reverted: true, - totalGas: 37009, - vmErrors: ['execution reverted'] - } - }, - { - description: - 'Should estimate gas cost of a transaction that reverts due to offered gas below the gas required', - clauses: [transfer1VTHOClause], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: { - gas: 1000 - }, - expected: { - reverted: true, - totalGas: 39192, - revertReasons: [''], - vmErrors: ['out of gas'] - } - } - ], - success: [ - { - description: - 'Should estimate gas cost of a transaction that transfers 1 VTHO', - clauses: [transfer1VTHOClause], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: {}, - expected: { - reverted: false, - totalGas: 51518, - revertReasons: [], - vmErrors: [] - } - }, - { - description: - 'Should estimate gas cost of a transaction that executes many clauses', - clauses: [ - transfer1VTHOClause, - transfer1VTHOClause, - { - to: TESTING_CONTRACT_ADDRESS, - value: '0', - data: ABIContract.ofAbi(TESTING_CONTRACT_ABI) - .encodeFunctionInput( - 'testAssertError', - [0] // Any number !== 0 will cause Panic error - ) - .toString() - }, - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - } - ], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: {}, - expected: { - reverted: false, - totalGas: 115954, - revertReasons: [], - vmErrors: [] - } - }, - { - description: - 'Should estimate gas cost of a transaction with delegation context', - clauses: [transfer1VTHOClause], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: { - gasPayer: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address - }, - expected: { - reverted: false, - totalGas: 51518, - revertReasons: [], - vmErrors: [] - } - }, - { - description: - 'Should estimate gas cost of a transaction sending VET', - clauses: [ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - } - ], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: {}, - expected: { - reverted: false, - totalGas: 21000, - revertReasons: [], - vmErrors: [] - } - }, - { - description: - 'Should estimate gas cost of a transaction sending VET with 2 clauses', - clauses: [ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - }, - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - } - ], - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address, - options: { - gasPadding: 0.2 // 20% - }, - expected: { - reverted: false, - totalGas: 44400, // 37000 + 20% - revertReasons: [], - vmErrors: [] - } - } - ] -}; - -/** - * Test cases where the estimation throws an error - */ -const invalidEstimateGasTestCases = [ - { - clauses: [], - options: {}, - expectedError: InvalidDataType - }, - { - clauses: [ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - } - ], - options: { - gasPadding: 1.1 - }, - expectedError: InvalidDataType - }, - { - clauses: [ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - } - ], - options: { - gasPadding: 0 - }, - expectedError: InvalidDataType - }, - { - clauses: [ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - } - ], - options: { - gasPadding: -1 - }, - expectedError: InvalidDataType - } -]; - -export { estimateGasTestCases, invalidEstimateGasTestCases }; diff --git a/packages/network/tests/thor-client/gas/gas.solo.test.ts b/packages/network/tests/thor-client/gas/gas.solo.test.ts deleted file mode 100644 index 88266a79d..000000000 --- a/packages/network/tests/thor-client/gas/gas.solo.test.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Hex } from '@vechain/sdk-core'; -import { THOR_SOLO_URL, ThorClient } from '../../../src'; -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { estimateGasTestCases, invalidEstimateGasTestCases } from './fixture'; -import { stringifyData } from '@vechain/sdk-errors'; - -/** - * Gas module tests. - * - * @group integration/clients/thor-client/gas - */ -describe('ThorClient - Gas Module', () => { - // ThorClient instance - let thorSoloClient: ThorClient; - - beforeEach(() => { - thorSoloClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * Test suite for 'estimateGas' method - */ - describe('estimateGas', () => { - /** - * Test cases where the transaction should revert - */ - estimateGasTestCases.revert.forEach( - ({ description, clauses, caller, options, expected }) => { - test( - description, - async () => { - const result = await thorSoloClient.gas.estimateGas( - clauses, - caller, - options - ); - - expect(result).toBeDefined(); - expect(result).toStrictEqual(expected); - }, - 3000 - ); - } - ); - - /** - * Test cases where the transaction should succeed - */ - estimateGasTestCases.success.forEach( - ({ description, clauses, caller, options, expected }) => { - test( - description, - async () => { - const result = await thorSoloClient.gas.estimateGas( - clauses, - caller, - options - ); - - expect(result).toBeDefined(); - expect(result).toStrictEqual(expected); - }, - 3000 - ); - } - ); - - /** - * Test cases where the gas estimate should throw an error - */ - invalidEstimateGasTestCases.forEach( - ({ clauses, options, expectedError }) => { - test(`Should throw an error with clauses: ${stringifyData( - clauses - )}, options: ${stringifyData(options)}`, async () => { - await expect( - thorSoloClient.gas.estimateGas( - clauses, - // Random address - Hex.random(20).toString(), - options - ) - ).rejects.toThrow(expectedError); - }); - } - ); - }); -}); diff --git a/packages/network/tests/thor-client/logs/fixture.ts b/packages/network/tests/thor-client/logs/fixture.ts deleted file mode 100644 index 0ccc46bb1..000000000 --- a/packages/network/tests/thor-client/logs/fixture.ts +++ /dev/null @@ -1,251 +0,0 @@ -import { - type FilterRawEventLogsOptions, - type FilterTransferLogsOptions -} from '../../../src'; - -const argFilterEventLogs: FilterRawEventLogsOptions = { - range: { - unit: 'block', - from: 0, - to: 100000 - }, - options: { - offset: 0, - limit: 10 - }, - criteriaSet: [ - { - address: '0x0000000000000000000000000000456E65726779', - topic0: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - topic1: '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - } - ], - order: 'asc' -}; - -const argFilterTransferLogs: FilterTransferLogsOptions = { - range: { - unit: 'block', - from: 0, - to: 100000 - }, - options: { - offset: 0, - limit: 10 - }, - criteriaSet: [ - { - txOrigin: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d', - sender: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d', - recipient: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed' - } - ], - order: 'asc' -}; - -const expectedFilterEventLogs = [ - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e55fff280', - meta: { - blockID: - '0x000060716a6decc7127d221e8a53cd7b33992db6236490f79d47585f9ae7ca14', - blockNumber: 24689, - blockTimestamp: 1530261290, - txID: '0x0ee8df3a9de6787ec0848ea8951ed8899bb053b6b4af167228dd7c0c012f5346', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - meta: { - blockID: - '0x00006135c993e6cd1ed99aac34679caac80759764ecb01431c9bea0199f3bf4c', - blockNumber: 24885, - blockTimestamp: 1530263250, - txID: '0x86b3364c0faf2df6365b975cf1bd8046264b1eeaa2f266fe15b2df27d7954f65', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x000000000000000000000000f881a94423f22ee9a0e3e1442f515f43c966b7ed' - ], - data: '0x00000000000000000000000000000000000000000000021e19e0c9bab2400000', - meta: { - blockID: - '0x000069fa97729ea3aaddd0756bb2bf2044fc16cb7d2b391b7982059deb43a86c', - blockNumber: 27130, - blockTimestamp: 1530285700, - txID: '0x9edf26009aa903e2c5e7afbb39a547c9cf324a7f3eedafc33691ce2c9e5c9541', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x000000000000000000000000f881a94423f22ee9a0e3e1442f515f43c966b7ed' - ], - data: '0x00000000000000000000000000000000000000000000021e19e0c9bab2400000', - meta: { - blockID: - '0x00006a01f75077f2aeebff51f046071bfa4d696ac51612c88eff4877165f73e3', - blockNumber: 27137, - blockTimestamp: 1530285770, - txID: '0xf8ee11a6807b53a0a29df509fbaab15f73c1f2a3f9f8fed14e961c62c4226c9b', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - meta: { - blockID: - '0x00006a2e2b18a4e7697c54045d2d615fe1a2eaad9a698e803c15b847ad4a7f95', - blockNumber: 27182, - blockTimestamp: 1530286220, - txID: '0x9fada14187c54ca93741c7b20483f52dc83b3f5a934082ea1d7a7d75216c1b80', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e' - ], - data: '0x00000000000000000000000000000000000000000000124bc0ddd92e56000000', - meta: { - blockID: - '0x00006a423cfbab794f79328cbd0f29f08f0ed1466c076153445d10c3e0ac21b2', - blockNumber: 27202, - blockTimestamp: 1530286420, - txID: '0xed2c6e452326f2ea126632830ebb8abca5bbfbed9da0780bf65efbbf555c8452', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x000000000000000000000000a7df76f0b8e0d191c5f27563720d1edcd76876db' - ], - data: '0x0000000000000000000000000000000000000000000001b1ae4d6e2ef5000000', - meta: { - blockID: - '0x000080f380a9d89d090360092764d3022e3a39aa7a46a5767f8ed43a80305aac', - blockNumber: 33011, - blockTimestamp: 1530344510, - txID: '0x6dded962eda4c04b91805a7ea63ef7e0a76284e36402986c19bb153fe07200e8', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x000000000000000000000000b18d55e99335b6f5b416f427c0035bf791cb226f' - ], - data: '0x0000000000000000000000000000000000000000000000a2a15d09519be00000', - meta: { - blockID: - '0x000084f2cb4c3e5ce3b3b311358902ed99ce9dfe70bfb768d2054142b26b6e5a', - blockNumber: 34034, - blockTimestamp: 1530354740, - txID: '0x4192b2351439f2b3979ef18bc9c16678a5fbb601f80c32787cf22bb3282f2925', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x000000000000000000000000ebc860f3dd7f7aa3f38eb4b17315db73e8f6d319' - ], - data: '0x000000000000000000000000000000000000000000000163746089a18cd20000', - meta: { - blockID: - '0x000089c7b155093311a0ab543f46f2f52f83ca87cbfb04c26507ad134f25f6d2', - blockNumber: 35271, - blockTimestamp: 1530367110, - txID: '0x7234d0e34abe1e7e612fcd3aae108087ef5d85707333afecfa24b5ad31a7a4aa', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 0 - } - }, - { - address: '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000005034aa590125b64023a0262112b98d72e3c8e40e', - '0x000000000000000000000000ebdb7c7bd6b46e9611101057e5b98a89697d38a7' - ], - data: '0x00000000000000000000000000000000000000000000180863c9a3f1c3a40000', - meta: { - blockID: - '0x000089c7b155093311a0ab543f46f2f52f83ca87cbfb04c26507ad134f25f6d2', - blockNumber: 35271, - blockTimestamp: 1530367110, - txID: '0x7234d0e34abe1e7e612fcd3aae108087ef5d85707333afecfa24b5ad31a7a4aa', - txOrigin: '0x5034aa590125b64023a0262112b98d72e3c8e40e', - clauseIndex: 1 - } - } -]; - -const expectedFilterTransferLogs = [ - { - amount: '0x152d02c7e14af6800000', - meta: { - blockID: - '0x00003abbf8435573e0c50fed42647160eabbe140a87efbe0ffab8ef895b7686e', - blockNumber: 15035, - blockTimestamp: 1530164750, - clauseIndex: 0, - txID: '0x9daa5b584a98976dfca3d70348b44ba5332f966e187ba84510efb810a0f9f851', - txOrigin: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d' - }, - recipient: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed', - sender: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d' - } -]; - -export { - argFilterEventLogs, - argFilterTransferLogs, - expectedFilterEventLogs, - expectedFilterTransferLogs -}; diff --git a/packages/network/tests/thor-client/logs/logs.testnet.test.ts b/packages/network/tests/thor-client/logs/logs.testnet.test.ts deleted file mode 100644 index 6a86a0f58..000000000 --- a/packages/network/tests/thor-client/logs/logs.testnet.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { - argFilterEventLogs, - argFilterTransferLogs, - expectedFilterEventLogs, - expectedFilterTransferLogs -} from './fixture'; -import { TESTNET_URL, ThorClient } from '../../../src'; - -/** - * ThorClient class tests - * - * @group integration/clients/thor-client/logs - */ -describe('ThorClient - Logs Module', () => { - // ThorClient instance - let thorClient: ThorClient; - - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * filterGroupedEventLogs tests - */ - test('filterEventLogs', async () => { - const eventLogs = - await thorClient.logs.filterRawEventLogs(argFilterEventLogs); - expect(eventLogs).toEqual(expectedFilterEventLogs); - }, 3000); - - /** - * filterTransferLogs tests - */ - test('filterTransferLogs', async () => { - const transferLogs = await thorClient.logs.filterTransferLogs( - argFilterTransferLogs - ); - // - expect(transferLogs).toEqual(expectedFilterTransferLogs); - }, 3000); -}); diff --git a/packages/network/tests/thor-client/nodes/fixture.ts b/packages/network/tests/thor-client/nodes/fixture.ts deleted file mode 100644 index c420b5901..000000000 --- a/packages/network/tests/thor-client/nodes/fixture.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @internal - * Block with a timestamp much older than the current time - */ -const blockWithOldTimeStamp = { - number: 16935885, - id: '0x01026bcde286e4c5b55507477edc666bb79b41ea97b6e78d65726fe557131533', - size: 361, - parentID: - '0x01026bcc5214fdc936b9afd15460479dfe35972219f78f322e23cc8184a035ab', - timestamp: 16993933000, - gasLimit: 30000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 131653862, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 1, - stateRoot: - '0x0b43423ced22d182d73728e47fef395169bff38c725dfdb84589e3cedfad2db2', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: true, - signer: '0xd6fab81fd54b989655b42d51b0344ddcb5007a5a', - isTrunk: true, - isFinalized: false, - transactions: [] -}; - -/** - * @internal - * Block with a missing timestamp - */ -const blockWithMissingTimeStamp = { - number: 16935885, - id: '0x01026bcde286e4c5b55507477edc666bb79b41ea97b6e78d65726fe557131533', - size: 361, - parentID: - '0x01026bcc5214fdc936b9afd15460479dfe35972219f78f322e23cc8184a035ab', - gasLimit: 30000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 131653862, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 1, - stateRoot: - '0x0b43423ced22d182d73728e47fef395169bff38c725dfdb84589e3cedfad2db2', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: true, - signer: '0xd6fab81fd54b989655b42d51b0344ddcb5007a5a', - isTrunk: true, - isFinalized: false, - transactions: [] -}; - -/** - * @internal - * Block with an invalid timestamp format - */ -const blockWithInvalidTimeStampFormat = { - number: 16935885, - id: '0x01026bcde286e4c5b55507477edc666bb79b41ea97b6e78d65726fe557131533', - size: 361, - parentID: - '0x01026bcc5214fdc936b9afd15460479dfe35972219f78f322e23cc8184a035ab', - timestamp: 'bad timestamp type', - gasLimit: 30000000, - beneficiary: '0xb4094c25f86d628fdd571afc4077f0d0196afb48', - gasUsed: 0, - totalScore: 131653862, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 1, - stateRoot: - '0x0b43423ced22d182d73728e47fef395169bff38c725dfdb84589e3cedfad2db2', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - com: true, - signer: '0xd6fab81fd54b989655b42d51b0344ddcb5007a5a', - isTrunk: true, - isFinalized: false, - transactions: [] -}; - -export { - blockWithOldTimeStamp, - blockWithMissingTimeStamp, - blockWithInvalidTimeStampFormat -}; diff --git a/packages/network/tests/thor-client/nodes/nodes.mock.testnet.test.ts b/packages/network/tests/thor-client/nodes/nodes.mock.testnet.test.ts deleted file mode 100644 index 64d49cc1b..000000000 --- a/packages/network/tests/thor-client/nodes/nodes.mock.testnet.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { beforeEach, describe, expect, jest, test } from '@jest/globals'; -import { - blockWithInvalidTimeStampFormat, - blockWithMissingTimeStamp, - blockWithOldTimeStamp -} from './fixture'; -import { InvalidDataType } from '@vechain/sdk-errors'; -import { ThorClient } from '../../../src'; -import { SimpleHttpClient } from '../../../src/http'; - -/** - * Node integration tests - * @group integration/clients/thor-client/nodes - * - */ -describe('ThorClient - Nodes Module', () => { - // ThorClient instance - let thorClient: ThorClient; - - /** - * @internal - * a well-formed URL to ensure we get to the axios call in the node health check - */ - const URL = 'http://example.com'; - - beforeEach(() => { - thorClient = ThorClient.at(URL); - }); - - test('valid URL/node but Error is thrown by network provider', async () => { - // Mock an error on the HTTPClient - jest.spyOn(SimpleHttpClient.prototype, 'http').mockImplementation( - () => { - throw new Error(); - } - ); - - /** - * client required to access a node - * @internal - */ - - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError(); - }); - - test('valid/available node but invalid block format', async () => { - // Mock the response to force the JSON response to be null - jest.spyOn(SimpleHttpClient.prototype, 'http').mockResolvedValueOnce( - {} - ); - - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidDataType - ); - - // Mock the response to force the JSON response to not be an object - jest.spyOn(SimpleHttpClient.prototype, 'http').mockResolvedValueOnce({ - invalidKey: 1 - }); - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidDataType - ); - - // Mock the response to force the JSON response to have a timestamp non-existent - jest.spyOn(SimpleHttpClient.prototype, 'http').mockResolvedValueOnce( - blockWithMissingTimeStamp - ); - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidDataType - ); - - // Mock the response to force the JSON response to have a timestamp not a number - jest.spyOn(SimpleHttpClient.prototype, 'http').mockResolvedValueOnce( - blockWithInvalidTimeStampFormat - ); - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidDataType - ); - }); - - test('valid & available node but node is out of sync', async () => { - // Mock the response to force the JSON response to be out of sync (i.e. > 30 seconds) - jest.spyOn(SimpleHttpClient.prototype, 'http').mockResolvedValueOnce( - blockWithOldTimeStamp - ); - - await expect(thorClient.nodes.isHealthy()).resolves.toBe(false); - }); -}); diff --git a/packages/network/tests/thor-client/nodes/nodes.testnet.test.ts b/packages/network/tests/thor-client/nodes/nodes.testnet.test.ts deleted file mode 100644 index 51d4464c2..000000000 --- a/packages/network/tests/thor-client/nodes/nodes.testnet.test.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { InvalidHTTPRequest } from '@vechain/sdk-errors'; -import { TESTNET_URL, ThorClient } from '../../../src'; - -/** - * Node integration tests - * @group integration/clients/thor-client/nodes - */ -describe('ThorClient - Nodes Module', () => { - /** - * Should return an array of nodes or an empty array - */ - test('Should get nodes', async () => { - /** - * client required accessing a node - * @internal - */ - const thorClient = ThorClient.at(TESTNET_URL); - const peerNodes = await thorClient.nodes.getNodes(); - - expect(peerNodes).toBeDefined(); - expect(Array.isArray(peerNodes)).toBe(true); - }, 3000); - - test('valid URL but inaccessible VeChain node', async () => { - /** - * client required to access a node - * @internal - */ - const thorClient = ThorClient.at('https://www.google.ie'); - - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidHTTPRequest - ); - }, 5000); - - test('null or empty URL or blank URL', async () => { - let thorClient = ThorClient.at(''); - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidHTTPRequest - ); - - thorClient = ThorClient.at(' '); - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidHTTPRequest - ); - }); - - test('invalid URL', async () => { - /** - * client required to access a node - * @internal - */ - const thorClient = ThorClient.at('INVALID_URL'); - - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidHTTPRequest - ); - }); - - test('valid and available synchronized node', async () => { - const thorClient = ThorClient.at('https://testnet.vechain.org/'); - - const healthyNode = await thorClient.nodes.isHealthy(); - expect(healthyNode).toBe(true); - }, 10000); - - test('null or empty URL or blank URL', async () => { - let thorClient = ThorClient.at(''); - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidHTTPRequest - ); - - thorClient = ThorClient.at(' '); - await expect(thorClient.nodes.isHealthy()).rejects.toThrowError( - InvalidHTTPRequest - ); - }); -}); diff --git a/packages/network/tests/thor-client/transactions/fixture-thorest.ts b/packages/network/tests/thor-client/transactions/fixture-thorest.ts deleted file mode 100644 index 6d70851e5..000000000 --- a/packages/network/tests/thor-client/transactions/fixture-thorest.ts +++ /dev/null @@ -1,496 +0,0 @@ -import { ABIContract, dataUtils, Units } from '@vechain/sdk-core'; -import { InvalidDataType } from '@vechain/sdk-errors'; -import { BUILT_IN_CONTRACTS } from '../../../src'; -import { TEST_ACCOUNTS, ZERO_ADDRESS } from '../../fixture'; - -/** - * Transaction details function fixture. - */ -const transactionDetails = { - correct: [ - { - testName: - 'Should be able to retrieve a transaction - NO RAW FORMAT', - transaction: { - id: '0x46d195f69e1ac3922d42c207e4705a3d1642883d97e58f7efc72f179ea326adb', - raw: false, - pending: false - }, - expected: { - id: '0x46d195f69e1ac3922d42c207e4705a3d1642883d97e58f7efc72f179ea326adb', - chainTag: 39, - blockRef: '0x010284a0b704e751', - expiration: 2000, - clauses: [ - { - to: '0x5d57f07dfeb8c224121433d5b1b401c82bd88f3d', - value: '0x2ea11e32ad50000', - data: '0x' - } - ], - gasPriceCoef: 0, - gas: 41192, - origin: '0x2d4ed6b8abd00bc2ef0bdb2258a946c214d9d0af', - delegator: null, - nonce: '0x76eed751cef0e52d', - dependsOn: null, - size: 130, - meta: { - blockID: - '0x010284a1fea0635a2e47dd21f8a1761406df1013e5f4af79e311d8a27373980d', - blockNumber: 16942241, - blockTimestamp: 1699453780 - } - } - }, - { - testName: 'Should be able to retrieve a transaction - RAW FORMAT', - transaction: { - id: '0x46d195f69e1ac3922d42c207e4705a3d1642883d97e58f7efc72f179ea326adb', - raw: true, - pending: true - }, - expected: { - raw: '0xf8802788010284a0b704e7518207d0e0df945d57f07dfeb8c224121433d5b1b401c82bd88f3d8802ea11e32ad50000808082a0e8808876eed751cef0e52dc0b841b2bb1ba31c7b78383bf7e01097038d26e6f1c685bdc73fce981f574eb7bb3abd6e59660e522c4870f1d033c0f82420448f44139e0fb2254a36d98ed387964c3c00', - meta: { - blockID: - '0x010284a1fea0635a2e47dd21f8a1761406df1013e5f4af79e311d8a27373980d', - blockNumber: 16942241, - blockTimestamp: 1699453780 - } - } - } - ], - errors: [ - { - testName: 'Should throw error when invalid transaction id is given', - transaction: { - id: 'WRONG_ID' - }, - expected: InvalidDataType - }, - { - testName: 'Should throw error when invalid head of block is given', - transaction: { - id: '0x46d195f69e1ac3922d42c207e4705a3d1642883d97e58f7efc72f179ea326adb', - raw: false, - pending: false, - head: 'WRONG_HEAD' - }, - expected: InvalidDataType - } - ] -}; - -/** - * Transaction receipts function fixture. - */ -const transactionReceipts = { - correct: [ - { - testName: 'Should be able to retrieve a transaction receipt', - transaction: { - id: '0x46d195f69e1ac3922d42c207e4705a3d1642883d97e58f7efc72f179ea326adb' - }, - expected: { - gasUsed: 21000, - gasPayer: '0x2d4ed6b8abd00bc2ef0bdb2258a946c214d9d0af', - paid: '0x2ea11e32ad50000', - reward: '0xdfd22a8cd98000', - reverted: false, - meta: { - blockID: - '0x010284a1fea0635a2e47dd21f8a1761406df1013e5f4af79e311d8a27373980d', - blockNumber: 16942241, - blockTimestamp: 1699453780, - txID: '0x46d195f69e1ac3922d42c207e4705a3d1642883d97e58f7efc72f179ea326adb', - txOrigin: '0x2d4ed6b8abd00bc2ef0bdb2258a946c214d9d0af' - }, - outputs: [ - { - contractAddress: null, - events: [], - transfers: [ - { - sender: '0x2d4ed6b8abd00bc2ef0bdb2258a946c214d9d0af', - recipient: - '0x5d57f07dfeb8c224121433d5b1b401c82bd88f3d', - amount: '0x2ea11e32ad50000' - } - ] - } - ] - } - } - ], - errors: [ - { - testName: 'Should throw error when invalid transaction id is given', - transaction: { - id: 'WRONG_ID' - }, - expected: InvalidDataType - }, - { - testName: 'Should throw error when invalid head of block is given', - transaction: { - id: '0x46d195f69e1ac3922d42c207e4705a3d1642883d97e58f7efc72f179ea326adb', - head: 'WRONG_HEAD' - }, - expected: InvalidDataType - }, - { - testName: - 'Should throw error when invalid head of block hex string length is given', - transaction: { - id: '0x46d195f69e1ac3922d42c207e4705a3d1642883d97e58f7efc72f179ea326adb', - head: '0x1234' - }, - expected: InvalidDataType - } - ] -}; - -/** - * Send transaction function errors fixture. - */ -const sendTransactionErrors = { - correct: [ - { - testName: 'Should be able to send a transaction with 1 clause', - transaction: { - clauses: [ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - value: 1000000, - data: '0x' - } - ] - } - }, - { - testName: 'Should be able to send a transaction with more clauses', - transaction: { - clauses: [ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - value: 1000000, - data: '0x' - }, - { - to: TEST_ACCOUNTS.TRANSACTION.DELEGATOR.address, - value: 1000000, - data: '0x' - } - ] - } - } - ], - errors: [ - { - testName: - 'Should throw error when invalid encoded raw transaction hex string is given', - transaction: { - raw: 'INVALID_HEX_STRING' - }, - expected: InvalidDataType - }, - { - testName: - 'Should throw error when invalid encoded raw transaction is given', - transaction: { - raw: '0x123456789abcdef' - }, - expected: InvalidDataType - } - ] -}; - -/** - * Simulate transactions test cases - */ -const simulateTransaction = { - correct: { - transfer: [ - { - testName: - 'Should be able to simulate a transaction with more clauses', - transaction: { - clauses: [ - /** - * Sends 1 VET to the receiver. - */ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - value: '1000000000000000000', - data: '0x' - }, - /** - * Send 1 VTHO to the receiver. - */ - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi( - BUILT_IN_CONTRACTS.ENERGY_ABI - ) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION - .TRANSACTION_RECEIVER.address, - Units.parseEther('1').bi - ]) - .toString() - } - ], - simulateTransactionOptions: { - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER - .address, - callerPrivateKey: - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER - .privateKey - } - }, - expected: { - simulationResults: [ - { - data: '0x', - events: [], - /** - * VET TRANSFER - */ - transfers: [ - { - sender: '0x2669514f9fe96bc7301177ba774d3da8a06cace4', - recipient: - '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - amount: '0xde0b6b3a7640000' - } - ], - gasUsed: 0, - reverted: false, - vmError: '' - }, - { - data: '0x0000000000000000000000000000000000000000000000000000000000000001', - events: [ - /** - * ERC-20 Transfer event - */ - { - address: - '0x0000000000000000000000000000456e65726779', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000002669514f9fe96bc7301177ba774d3da8a06cace4', - '0x0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c39' - ], - data: '0x0000000000000000000000000000000000000000000000000de0b6b3a7640000' - } - ], - transfers: [], - gasUsed: 13326, - reverted: false, - vmError: '' - } - ] - } - } - ], - /** - * Simulate calls to smart contracts (i.e., getters thus no gas is consumed) - */ - smartContractCall: [ - { - testName: - 'Should be able to simulate a call to a smart contract (params.sol)', - transaction: { - clauses: [ - /** - * Calls the PARAMS 'get(bytes32)' function. - * Passes "base-gas-price" encoded as bytes 32 as the parameter. - */ - { - to: BUILT_IN_CONTRACTS.PARAMS_ADDRESS, - value: '0', - data: ABIContract.ofAbi( - BUILT_IN_CONTRACTS.PARAMS_ABI - ) - .encodeFunctionInput('get', [ - dataUtils.encodeBytes32String( - 'base-gas-price', - 'left' - ) - ]) - .toString() - } - ] - }, - expected: { - simulationResults: [ - { - /** - * Base gas price set in the params.sol built-in contract. - * - * The value set for thor-solo is `1000000000000000` (0,001 VTHO) - * - * @link see [thor/params.go](https://github.com/vechain/thor/blob/master/thor/params.go) - */ - data: '0x00000000000000000000000000000000000000000000000000038d7ea4c68000', - events: [], - transfers: [], - gasUsed: 591, - reverted: false, - vmError: '' - } - ] - } - }, - { - testName: - 'Should be able to simulate a call to a smart contract (energy.sol)', - transaction: { - clauses: [ - /** - * Calls the ENERGY 'balanceOf' function. - * Passes the address to check the balance of. - */ - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - /** - * Checks the VTHO balance of TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER - */ - data: ABIContract.ofAbi( - BUILT_IN_CONTRACTS.ENERGY_ABI - ) - .encodeFunctionInput('balanceOf', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER - .address - ]) - .toString() - } - ], - simulateTransactionOptions: { - revision: '0' - } - }, - expected: { - simulationResults: [ - { - /** - * At block 0 (genesis) the balance of VTHO of TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER should be 0. - * This because the seeding happens after the genesis block. - */ - data: '0x0000000000000000000000000000000000000000000000000000000000000000', - events: [], - transfers: [], - gasUsed: 870, - reverted: false, - vmError: '' - } - ] - } - } - ], - deployContract: [ - { - testName: - 'Should be able to simulate a contract deployment transaction', - transaction: { - clauses: [ - { - to: null, - value: '0', - /** - * Sample contract bytecode (Without constructor arguments) - * - * @remarks - When deploying a contract that requires constructor arguments, the encoded constructor must be appended to the bytecode - * Otherwise the contract might revert if the constructor arguments are required. - */ - data: '0x60806040526040518060400160405280600681526020017f48656c6c6f210000000000000000000000000000000000000000000000000000815250600090816200004a9190620002d9565b503480156200005857600080fd5b50620003c0565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620000e157607f821691505b602082108103620000f757620000f662000099565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001617fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000122565b6200016d868362000122565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620001ba620001b4620001ae8462000185565b6200018f565b62000185565b9050919050565b6000819050919050565b620001d68362000199565b620001ee620001e582620001c1565b8484546200012f565b825550505050565b600090565b62000205620001f6565b62000212818484620001cb565b505050565b5b818110156200023a576200022e600082620001fb565b60018101905062000218565b5050565b601f82111562000289576200025381620000fd565b6200025e8462000112565b810160208510156200026e578190505b620002866200027d8562000112565b83018262000217565b50505b505050565b600082821c905092915050565b6000620002ae600019846008026200028e565b1980831691505092915050565b6000620002c983836200029b565b9150826002028217905092915050565b620002e4826200005f565b67ffffffffffffffff8111156200030057620002ff6200006a565b5b6200030c8254620000c8565b620003198282856200023e565b600060209050601f8311600181146200035157600084156200033c578287015190505b620003488582620002bb565b865550620003b8565b601f1984166200036186620000fd565b60005b828110156200038b5784890151825560018201915060208501945060208101905062000364565b86831015620003ab5784890151620003a7601f8916826200029b565b8355505b6001600288020188555050505b505050505050565b61081480620003d06000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631718ad881461004657806319ff1d211461007657806349da5de414610094575b600080fd5b610060600480360381019061005b91906102c1565b6100b0565b60405161006d919061037e565b60405180910390f35b61007e6101b5565b60405161008b919061037e565b60405180910390f35b6100ae60048036038101906100a99190610405565b610243565b005b606081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610122576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101199061049e565b60405180910390fd5b6000805461012f906104ed565b80601f016020809104026020016040519081016040528092919081815260200182805461015b906104ed565b80156101a85780601f1061017d576101008083540402835291602001916101a8565b820191906000526020600020905b81548152906001019060200180831161018b57829003601f168201915b5050505050915050919050565b600080546101c2906104ed565b80601f01602080910402602001604051908101604052809291908181526020018280546101ee906104ed565b801561023b5780601f106102105761010080835404028352916020019161023b565b820191906000526020600020905b81548152906001019060200180831161021e57829003601f168201915b505050505081565b81816000918261025492919061070e565b505050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061028e82610263565b9050919050565b61029e81610283565b81146102a957600080fd5b50565b6000813590506102bb81610295565b92915050565b6000602082840312156102d7576102d6610259565b5b60006102e5848285016102ac565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561032857808201518184015260208101905061030d565b60008484015250505050565b6000601f19601f8301169050919050565b6000610350826102ee565b61035a81856102f9565b935061036a81856020860161030a565b61037381610334565b840191505092915050565b600060208201905081810360008301526103988184610345565b905092915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126103c5576103c46103a0565b5b8235905067ffffffffffffffff8111156103e2576103e16103a5565b5b6020830191508360018202830111156103fe576103fd6103aa565b5b9250929050565b6000806020838503121561041c5761041b610259565b5b600083013567ffffffffffffffff81111561043a5761043961025e565b5b610446858286016103af565b92509250509250929050565b7f496e76616c696420616464726573730000000000000000000000000000000000600082015250565b6000610488600f836102f9565b915061049382610452565b602082019050919050565b600060208201905081810360008301526104b78161047b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061050557607f821691505b602082108103610518576105176104be565b5b50919050565b600082905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026105ba7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261057d565b6105c4868361057d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061060b610606610601846105dc565b6105e6565b6105dc565b9050919050565b6000819050919050565b610625836105f0565b61063961063182610612565b84845461058a565b825550505050565b600090565b61064e610641565b61065981848461061c565b505050565b5b8181101561067d57610672600082610646565b60018101905061065f565b5050565b601f8211156106c25761069381610558565b61069c8461056d565b810160208510156106ab578190505b6106bf6106b78561056d565b83018261065e565b50505b505050565b600082821c905092915050565b60006106e5600019846008026106c7565b1980831691505092915050565b60006106fe83836106d4565b9150826002028217905092915050565b610718838361051e565b67ffffffffffffffff81111561073157610730610529565b5b61073b82546104ed565b610746828285610681565b6000601f8311600181146107755760008415610763578287013590505b61076d85826106f2565b8655506107d5565b601f19841661078386610558565b60005b828110156107ab57848901358255600182019150602085019450602081019050610786565b868310156107c857848901356107c4601f8916826106d4565b8355505b6001600288020188555050505b5050505050505056fea2646970667358221220131b1aac58b5047d715ef4f6d1b050c9a836905c50de69cf41edc485446e5f5f64736f6c63430008110033' - } - ] - }, - expected: { - simulationResults: [ - { - data: '0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631718ad881461004657806319ff1d211461007657806349da5de414610094575b600080fd5b610060600480360381019061005b91906102c1565b6100b0565b60405161006d919061037e565b60405180910390f35b61007e6101b5565b60405161008b919061037e565b60405180910390f35b6100ae60048036038101906100a99190610405565b610243565b005b606081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610122576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101199061049e565b60405180910390fd5b6000805461012f906104ed565b80601f016020809104026020016040519081016040528092919081815260200182805461015b906104ed565b80156101a85780601f1061017d576101008083540402835291602001916101a8565b820191906000526020600020905b81548152906001019060200180831161018b57829003601f168201915b5050505050915050919050565b600080546101c2906104ed565b80601f01602080910402602001604051908101604052809291908181526020018280546101ee906104ed565b801561023b5780601f106102105761010080835404028352916020019161023b565b820191906000526020600020905b81548152906001019060200180831161021e57829003601f168201915b505050505081565b81816000918261025492919061070e565b505050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061028e82610263565b9050919050565b61029e81610283565b81146102a957600080fd5b50565b6000813590506102bb81610295565b92915050565b6000602082840312156102d7576102d6610259565b5b60006102e5848285016102ac565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561032857808201518184015260208101905061030d565b60008484015250505050565b6000601f19601f8301169050919050565b6000610350826102ee565b61035a81856102f9565b935061036a81856020860161030a565b61037381610334565b840191505092915050565b600060208201905081810360008301526103988184610345565b905092915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126103c5576103c46103a0565b5b8235905067ffffffffffffffff8111156103e2576103e16103a5565b5b6020830191508360018202830111156103fe576103fd6103aa565b5b9250929050565b6000806020838503121561041c5761041b610259565b5b600083013567ffffffffffffffff81111561043a5761043961025e565b5b610446858286016103af565b92509250509250929050565b7f496e76616c696420616464726573730000000000000000000000000000000000600082015250565b6000610488600f836102f9565b915061049382610452565b602082019050919050565b600060208201905081810360008301526104b78161047b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061050557607f821691505b602082108103610518576105176104be565b5b50919050565b600082905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026105ba7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261057d565b6105c4868361057d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061060b610606610601846105dc565b6105e6565b6105dc565b9050919050565b6000819050919050565b610625836105f0565b61063961063182610612565b84845461058a565b825550505050565b600090565b61064e610641565b61065981848461061c565b505050565b5b8181101561067d57610672600082610646565b60018101905061065f565b5050565b601f8211156106c25761069381610558565b61069c8461056d565b810160208510156106ab578190505b6106bf6106b78561056d565b83018261065e565b50505b505050565b600082821c905092915050565b60006106e5600019846008026106c7565b1980831691505092915050565b60006106fe83836106d4565b9150826002028217905092915050565b610718838361051e565b67ffffffffffffffff81111561073157610730610529565b5b61073b82546104ed565b610746828285610681565b6000601f8311600181146107755760008415610763578287013590505b61076d85826106f2565b8655506107d5565b601f19841661078386610558565b60005b828110156107ab57848901358255600182019150602085019450602081019050610786565b868310156107c857848901356107c4601f8916826106d4565b8355505b6001600288020188555050505b5050505050505056fea2646970667358221220131b1aac58b5047d715ef4f6d1b050c9a836905c50de69cf41edc485446e5f5f64736f6c63430008110033', - events: [ - { - address: - '0x841a6556c524d47030762eb14dc4af897e605d9b', - topics: [ - '0xb35bf4274d4295009f1ec66ed3f579db287889444366c03d3a695539372e8951' - ], - data: '0x0000000000000000000000000000000000000000000000000000000000000000' - } - ], - transfers: [], - gasUsed: 434928, // The required gas to deploy the contract - reverted: false, - vmError: '' - } - ] - } - } - ] - }, - errors: [ - { - testName: - "Shouldn't be able to simulate a transfer without specifying the caller", - transaction: { - clauses: [ - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - value: '1000000', - data: '0x' - } - ], - simulateTransactionOptions: { - caller: ZERO_ADDRESS - } - }, - vmError: 'insufficient balance for transfer' - }, - { - testName: - "Shouldn't be able to simulate a transaction exceeding the gas limit", - transaction: { - clauses: [ - /** - * Send 1 VTHO to the receiver. - */ - { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - .address, - Units.parseEther('1').bi - ]) - .toString() - } - ], - simulateTransactionOptions: { - caller: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER - .address, - gas: 1 - } - }, - vmError: 'out of gas' - } - ] -}; - -export { - sendTransactionErrors, - simulateTransaction, - transactionDetails, - transactionReceipts -}; diff --git a/packages/network/tests/thor-client/transactions/fixture.ts b/packages/network/tests/thor-client/transactions/fixture.ts deleted file mode 100644 index 4f30651d6..000000000 --- a/packages/network/tests/thor-client/transactions/fixture.ts +++ /dev/null @@ -1,504 +0,0 @@ -import { - ABIContract, - networkInfo, - Units, - type TransactionBody -} from '@vechain/sdk-core'; -import { BUILT_IN_CONTRACTS } from '../../../src'; -import { - TEST_ACCOUNTS, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS -} from '../../fixture'; - -/** - * Some random transaction nonces to use into tests - */ -const transactionNonces = { - waitForTransactionTestCases: [10000000, 10000001, 10000002, 10000003], - sendTransactionWithANumberAsValueInTransactionBody: [10000004], - invalidWaitForTransactionTestCases: [10000005], - shouldThrowErrorIfTransactionIsntSigned: [10000006] -}; - -/** - * Clause to transfer 1 VTHO to TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - */ -const transfer1VTHOClause = { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: '0', - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - Units.parseEther('1').bi - ]) - .toString() -}; - -/** - * Clause to transfer 1 VTHO to TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - */ -const transfer1VTHOClauseWithValueAsANumber = { - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: 0, - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - Units.parseEther('1').bi - ]) - .toString() -}; - -/** - * transaction body that transfers 1 VTHO to TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - */ -const transferTransactionBody: Omit = { - clauses: [transfer1VTHOClause], - chainTag: networkInfo.solo.chainTag, - blockRef: networkInfo.solo.genesisBlock.id.slice(0, 18), - expiration: 1000, - gasPriceCoef: 128, - dependsOn: null -}; - -/** - * transaction body that transfers 1 VTHO to TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER - */ -const transferTransactionBodyValueAsNumber: Omit< - TransactionBody, - 'gas' | 'nonce' -> = { - clauses: [transfer1VTHOClauseWithValueAsANumber], - chainTag: networkInfo.solo.chainTag, - blockRef: networkInfo.solo.genesisBlock.id.slice(0, 18), - expiration: 1000, - gasPriceCoef: 128, - dependsOn: null -}; - -/** - * Expected transaction receipt values. - * Note that this object is not a valid `TransactionReceipt` object. - */ -const expectedReceipt = { - events: [], - gasPayer: '0x2669514f9fe96bc7301177ba774d3da8a06cace4', - gasUsed: 36518, - outputs: [ - { - contractAddress: null, - events: [ - { - address: '0x0000000000000000000000000000456e65726779', - data: '0x0000000000000000000000000000000000000000000000000de0b6b3a7640000', - topics: [ - '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - '0x0000000000000000000000002669514f9fe96bc7301177ba774d3da8a06cace4', - '0x0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c39' - ] - } - ], - transfers: [] - } - ], - reverted: false -}; - -/** - * waitForTransaction test cases that should return a transaction receipt - */ -const waitForTransactionTestCases = [ - { - description: - 'Should wait for transaction without timeout and return TransactionReceipt', - options: { - timeoutMs: undefined, - intervalMs: undefined, - nonce: transactionNonces.waitForTransactionTestCases[0] - } - }, - { - description: - 'Should wait for transaction with timeout and return TransactionReceipt', - options: { - timeoutMs: 5000, - intervalMs: undefined, - nonce: transactionNonces.waitForTransactionTestCases[1] - } - }, - { - description: - 'Should wait for transaction with intervalMs TransactionReceipt', - options: { - timeoutMs: undefined, - intervalMs: 100, - nonce: transactionNonces.waitForTransactionTestCases[2] - } - }, - { - description: - 'Should wait for transaction with intervalMs & timeoutMs and return TransactionReceipt', - options: { - timeoutMs: 5000, - intervalMs: 100, - nonce: transactionNonces.waitForTransactionTestCases[3] - } - } -]; - -/** - * waitForTransaction test cases that should not return a transaction receipt. Instead, should return null. - */ -const invalidWaitForTransactionTestCases = [ - { - description: 'Should throw error when timeoutMs is too low', - options: { - timeoutMs: 1, - intervalMs: undefined, - nonce: transactionNonces.invalidWaitForTransactionTestCases[0] - } - } -]; - -/** - * buildTransactionBody test cases - */ -const buildTransactionBodyClausesTestCases = [ - { - description: 'Should build transaction body that transfers 1 VTHO', - clauses: [transfer1VTHOClause], - options: {}, - expected: { - solo: { - chainTag: 246, - clauses: [ - { - data: '0xa9059cbb0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c390000000000000000000000000000000000000000000000000de0b6b3a7640000', - to: '0x0000000000000000000000000000456e65726779', - value: '0' - } - ], - dependsOn: null, - expiration: 32, - gas: 51518, - gasPriceCoef: 0, - reserved: undefined - }, - testnet: { - chainTag: 39, - clauses: [ - { - data: '0xa9059cbb0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c390000000000000000000000000000000000000000000000000de0b6b3a7640000', - to: '0x0000000000000000000000000000456e65726779', - value: '0' - } - ], - dependsOn: null, - expiration: 32, - gas: 39263, - gasPriceCoef: 0, - reserved: undefined - } - } - }, - { - description: - 'Should build transaction that executes many clauses and all options', - clauses: [ - transfer1VTHOClause, - transfer1VTHOClause, - { - to: TESTING_CONTRACT_ADDRESS, - value: '0', - data: ABIContract.ofAbi(TESTING_CONTRACT_ABI) - .encodeFunctionInput( - 'testAssertError', - [0] // Any number !== 0 will cause Panic error - ) - .toString() - }, - { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - } - ], - options: { - gasPriceCoef: 255, - expiration: 1000, - isDelegated: true, - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f' // Any valid tx id - }, - expected: { - solo: { - chainTag: 246, - clauses: [ - { - data: '0xa9059cbb0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c390000000000000000000000000000000000000000000000000de0b6b3a7640000', - to: '0x0000000000000000000000000000456e65726779', - value: '0' - }, - { - data: '0xa9059cbb0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c390000000000000000000000000000000000000000000000000de0b6b3a7640000', - to: '0x0000000000000000000000000000456e65726779', - value: '0' - }, - { - data: '0xc7bce69d0000000000000000000000000000000000000000000000000000000000000000', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: '0' - }, - { - data: '0x', - to: '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - value: '1000000000000000000' - } - ], - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f', - expiration: 1000, - gas: 115954, - gasPriceCoef: 255, - reserved: { features: 1 } - }, - testnet: { - chainTag: 39, - clauses: [ - { - data: '0xa9059cbb0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c390000000000000000000000000000000000000000000000000de0b6b3a7640000', - to: '0x0000000000000000000000000000456e65726779', - value: '0' - }, - { - data: '0xa9059cbb0000000000000000000000009e7911de289c3c856ce7f421034f66b6cde49c390000000000000000000000000000000000000000000000000de0b6b3a7640000', - to: '0x0000000000000000000000000000456e65726779', - value: '0' - }, - { - data: '0xc7bce69d0000000000000000000000000000000000000000000000000000000000000000', - to: '0xb2c20a6de401003a671659b10629eb82ff254fb8', - value: '0' - }, - { - data: '0x', - to: '0x9e7911de289c3c856ce7f421034f66b6cde49c39', - value: '1000000000000000000' - } - ], - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f', - expiration: 1000, - gas: 89855, - gasPriceCoef: 255, - reserved: { features: 1 } - } - } - }, - { - description: 'Should resolve names into addresses in all clauses', - clauses: [ - { - to: 'vtho.test-sdk.vet', - value: '0', - data: '0x' - }, - { - to: 'params.test-sdk.vet', - value: Units.parseEther('1').toString(), - data: '0x' - } - ], - options: { - gasPriceCoef: 255, - expiration: 1000, - isDelegated: true, - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f' // Any valid tx id - }, - expected: { - solo: { - chainTag: 246, - clauses: [ - { - data: '0x', - to: '0x0000000000000000000000000000456E65726779', - value: '0' - }, - { - data: '0x', - to: '0x0000000000000000000000000000506172616D73', - value: '1000000000000000000' - } - ], - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f', - expiration: 1000, - gas: 52046, - gasPriceCoef: 255, - reserved: { features: 1 } - }, - testnet: { - chainTag: 39, - clauses: [ - { - data: '0x', - to: '0x0000000000000000000000000000456E65726779', - value: '0' - }, - { - data: '0x', - to: '0x0000000000000000000000000000506172616D73', - value: '1000000000000000000' - } - ], - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f', - expiration: 1000, - gas: 52046, - gasPriceCoef: 255, - reserved: { features: 1 } - } - } - }, - { - description: - 'Should not modify "to" part of clauses when no name is used', - clauses: [ - { - to: '0x0000000000000000000000000000456E65726779', - value: '0', - data: '0x' - }, - { - to: null, - value: '0', - data: '0x' - }, - { - to: 'vtho.test-sdk.vet', - value: '0', - data: '0x' - } - ], - options: { - gasPriceCoef: 255, - expiration: 1000, - isDelegated: true, - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f' // Any valid tx id - }, - expected: { - solo: { - chainTag: 246, - clauses: [ - { - data: '0x', - to: '0x0000000000000000000000000000456E65726779', - value: '0' - }, - { - to: null, - data: '0x', - value: '0' - }, - { - data: '0x', - to: '0x0000000000000000000000000000456E65726779', - value: '0' - } - ], - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f', - expiration: 1000, - gas: 100046, - gasPriceCoef: 255, - reserved: { features: 1 } - }, - testnet: { - chainTag: 39, - clauses: [ - { - data: '0x', - to: '0x0000000000000000000000000000456E65726779', - value: '0' - }, - { - to: null, - data: '0x', - value: '0' - }, - { - data: '0x', - to: '0x0000000000000000000000000000456E65726779', - value: '0' - } - ], - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f', - expiration: 1000, - gas: 100046, - gasPriceCoef: 255, - reserved: { features: 1 } - } - } - } -]; - -/** - * Fixture for getRevertReason method - */ -const getRevertReasonTestCasesFixture = [ - { - description: - 'Should be able to get Error message from reverted transaction', - revertedTransactionHash: - '0xf464a7dbdf0c89452261dc00d6cb31f1ce87aee2212c30c8d1eceea8ee31528e', - expected: 'SUBMISSION_ALREADY_MADE' - }, - { - description: - 'Should be able to get Panic message code from reverted transaction', - revertedTransactionHash: - '0x0a5177fb83346bb6ff7ca8408889f0c99f44b2b1b5c8bf6f0eb53c4b2e81d98d', - expected: 'Panic(0x12)' - }, - { - description: - 'Should return empty string if reverted transaction has no revert reason', - revertedTransactionHash: - '0x6417ee27afe19acc9765eb35e3d05fcca7a0b98d3a321855acaa981696c816a1', - expected: '' - }, - { - description: 'Should return null if transaction IS NOT reverted', - revertedTransactionHash: - '0xcc9ce45f0c7c0d95e0c1afbd4c0c5cee01876968c8b610e0f02d7ff8d6344682', - expected: null - }, - { - description: 'Should return null if transaction IS NOT found', - revertedTransactionHash: - '0x00000000000000000000000d4c0c5cee01876960000000000000000000000000', - expected: null - }, - { - description: 'Should be able to read solidity errors', - revertedTransactionHash: - '0x8f443452163e8fbd17ea9b541baba5a633c25f7f28e1523f18ddbae16440d6e5', - expected: '0 input is not allowed', - errorFragment: 'error SimpleSolidityError(string message)' - } -]; - -export { - buildTransactionBodyClausesTestCases, - expectedReceipt, - getRevertReasonTestCasesFixture, - invalidWaitForTransactionTestCases, - transactionNonces, - transfer1VTHOClause, - transferTransactionBody, - transferTransactionBodyValueAsNumber, - waitForTransactionTestCases -}; diff --git a/packages/network/tests/thor-client/transactions/helpers/delegation-handler.unit.test.ts b/packages/network/tests/thor-client/transactions/helpers/delegation-handler.unit.test.ts deleted file mode 100644 index 0e4c584e2..000000000 --- a/packages/network/tests/thor-client/transactions/helpers/delegation-handler.unit.test.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { Transaction } from '@vechain/sdk-core'; -import { NotDelegatedTransaction } from '@vechain/sdk-errors'; -import { DelegationHandler, TESTNET_URL, ThorClient } from '../../../../src'; -import { TransactionFixture } from '../../../../../core/tests/transaction/Transaction.unit.test'; -import { delegationHandlerFixture } from './fixture'; - -/** - * DelegationHandler helper function tests. - * Testing the DelegationHandler helper function. - * - * @group unit/thor-client/transactions/helpers/delegation-handler - */ -describe('Tests of DelegationHandler helper function', () => { - /** - * DelegateHandler tests. - * - * @note we don't test the getDelegationSignatureUsingUrl method here, because: - * - It's a method that uses the network. - * - It's already tested in the integration tests of transactions-module. - */ - delegationHandlerFixture.forEach(({ testName, delegator, expected }) => { - test(testName, () => { - const delegationHandler = DelegationHandler(delegator); - expect(delegationHandler.isDelegated()).toBe(expected.isDelegated); - expect(delegationHandler.delegatorOrUndefined()).toEqual( - expected.delegatorOrUndefined - ); - expect(delegationHandler.delegatorOrNull()).toEqual( - expected.delegatorOrNull - ); - }); - }); - - /** - * Negative tests cases - */ - describe('Negative tests cases', () => { - /** - *Should throw an error when get delegatorUrl if delegator url is not provided. - */ - test('Should throw an error when get delegatorUrl if delegator url is not provided', async () => { - await expect(async () => { - await DelegationHandler({ - delegatorPrivateKey: - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - }).getDelegationSignatureUsingUrl( - Transaction.of(TransactionFixture.delegated.body), - '0x', - ThorClient.at(TESTNET_URL).httpClient - ); - }).rejects.toThrowError(NotDelegatedTransaction); - }); - }); -}); diff --git a/packages/network/tests/thor-client/transactions/helpers/fixture.ts b/packages/network/tests/thor-client/transactions/helpers/fixture.ts deleted file mode 100644 index dc1a494c7..000000000 --- a/packages/network/tests/thor-client/transactions/helpers/fixture.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { type SignTransactionOptions } from '../../../../src'; - -/** - * Fixtures for delegation handler - */ -const delegationHandlerFixture = [ - // NOT Empty delegator - delegatorUrl - { - testName: - 'Should be able to use DelegationHandler with not empty delegator - delegatorUrl', - delegator: { - delegatorUrl: 'http://localhost:8669' - } satisfies SignTransactionOptions, - expected: { - isDelegated: true, - delegatorOrUndefined: { - delegatorUrl: 'http://localhost:8669' - } satisfies SignTransactionOptions, - delegatorOrNull: { - delegatorUrl: 'http://localhost:8669' - } satisfies SignTransactionOptions - } - }, - // NOT Empty delegator - delegatorPrivateKey - { - testName: - 'Should be able to use DelegationHandler with not empty delegator - delegatorPrivateKey', - delegator: { - delegatorPrivateKey: - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - } satisfies SignTransactionOptions, - expected: { - isDelegated: true, - delegatorOrUndefined: { - delegatorPrivateKey: - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - } satisfies SignTransactionOptions, - delegatorOrNull: { - delegatorPrivateKey: - '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - } satisfies SignTransactionOptions - } - }, - // NOT Empty delegator - delegatorPrivateKey (with 0x in front of the private key) - { - testName: - 'Should be able to use DelegationHandler with not empty delegator - delegatorPrivateKey', - delegator: { - delegatorPrivateKey: - '0x7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - } satisfies SignTransactionOptions, - expected: { - isDelegated: true, - delegatorOrUndefined: { - delegatorPrivateKey: - '0x7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - } satisfies SignTransactionOptions, - delegatorOrNull: { - delegatorPrivateKey: - '0x7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158' - } satisfies SignTransactionOptions - } - }, - // Empty delegator - undefined - { - testName: - 'Should be able to use DelegationHandler with empty delegator - undefined', - expected: { - isDelegated: false, - delegatorOrUndefined: undefined, - delegatorOrNull: null - } - }, - // Empty delegator - null - { - testName: - 'Should be able to use DelegationHandler with empty delegator - null', - delegator: null, - expected: { - isDelegated: false, - delegatorOrUndefined: undefined, - delegatorOrNull: null - } - } -]; - -export { delegationHandlerFixture }; diff --git a/packages/network/tests/thor-client/transactions/transactions-thorest.solo.test.ts b/packages/network/tests/thor-client/transactions/transactions-thorest.solo.test.ts deleted file mode 100644 index 0b3ede91f..000000000 --- a/packages/network/tests/thor-client/transactions/transactions-thorest.solo.test.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { TEST_ACCOUNTS } from '../../fixture'; -import { HexUInt, Transaction } from '@vechain/sdk-core'; -import { sendTransactionErrors, simulateTransaction } from './fixture-thorest'; -import { InvalidDataType, stringifyData } from '@vechain/sdk-errors'; -import { THOR_SOLO_URL, ThorClient } from '../../../src'; - -/** - * ThorClient class tests. - * - * @NOTE: This test suite run on solo network because it requires to send transactions. - * - * @group integration/clients/thor-client/transactions - */ -describe('ThorClient - Transactions Module', () => { - // ThorClient instance - let thorSoloClient: ThorClient; - - beforeEach(() => { - thorSoloClient = ThorClient.at(THOR_SOLO_URL); - }); - - /** - * sendTransaction tests - */ - describe('sendTransaction', () => { - /** - * SendTransaction - correct cases - */ - sendTransactionErrors.correct.forEach((testCase) => { - test(testCase.testName, async () => { - // 1- Init transaction - - // Get latest block - const latestBlock = - await thorSoloClient.blocks.getBestBlockCompressed(); - - // Estimate the gas required for the transfer transaction - const gasResult = await thorSoloClient.gas.estimateGas( - testCase.transaction.clauses, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - // Create transactions - const transactionBody = { - chainTag: 0xf6, - blockRef: - latestBlock !== null - ? latestBlock.id.slice(0, 18) - : '0x0', - expiration: 32, - clauses: testCase.transaction.clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678 - }; - - const delegatedTransactionBody = { - chainTag: 0xf6, - blockRef: - latestBlock !== null - ? latestBlock.id.slice(0, 18) - : '0x0', - expiration: 32, - clauses: testCase.transaction.clauses, - gasPriceCoef: 128, - gas: gasResult.totalGas, - dependsOn: null, - nonce: 12345678, - reserved: { - features: 1 - } - }; - - // Normal signature and delegation signature - const rawNormalSigned = Transaction.of(transactionBody).sign( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.privateKey - ).bytes - ).encoded; - - const rawDelegatedSigned = Transaction.of( - delegatedTransactionBody - ).signAsSenderAndGasPayer( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.privateKey - ).bytes, - HexUInt.of(TEST_ACCOUNTS.TRANSACTION.DELEGATOR.privateKey) - .bytes - ).encoded; - - // 2 - Send transaction - for (const raw of [rawNormalSigned, rawDelegatedSigned]) { - const send = - await thorSoloClient.transactions.sendRawTransaction( - HexUInt.of(raw).toString() - ); - expect(send).toBeDefined(); - expect(send).toHaveProperty('id'); - expect(HexUInt.isValid0x(send.id)).toBe(true); - - // 3 - Get transaction AND transaction receipt - const transaction = - await thorSoloClient.transactions.getTransaction( - send.id - ); - const transactionReceipt = - await thorSoloClient.transactions.getTransactionReceipt( - send.id - ); - - expect(transaction).toBeDefined(); - expect(transactionReceipt).toBeDefined(); - } - }); - }); - - /** - * SendTransaction - error cases - */ - sendTransactionErrors.errors.forEach((testCase) => { - test(testCase.testName, async () => { - await expect( - thorSoloClient.transactions.sendRawTransaction( - testCase.transaction.raw - ) - ).rejects.toThrow(testCase.expected); - }); - }); - }); - - /** - * Test suite for transaction simulations - */ - describe('simulateTransaction', () => { - /** - * Simulate transfer transactions - */ - simulateTransaction.correct.transfer.forEach( - ({ testName, transaction, expected }) => { - test(testName, async () => { - const simulatedTx = - await thorSoloClient.transactions.simulateTransaction( - transaction.clauses, - { - ...transaction.simulateTransactionOptions - } - ); - - expect(simulatedTx).toBeDefined(); - /** - * The result of the simulation tx is an array of simulation results. - * Each result represents the simulation of transaction clause. - */ - expect(simulatedTx).toHaveLength( - transaction.clauses.length - ); - - /** - * Compare each simulation result with the expected result. - */ - for (let i = 0; i < simulatedTx.length; i++) { - expect(stringifyData(simulatedTx[i])).toStrictEqual( - stringifyData(expected.simulationResults[i]) - ); - } - }); - } - ); - - /** - * Simulate smart contract call transactions - */ - simulateTransaction.correct.smartContractCall.forEach( - ({ testName, transaction, expected }) => { - test(testName, async () => { - const simulatedTx = - await thorSoloClient.transactions.simulateTransaction( - transaction.clauses, - { - ...transaction.simulateTransactionOptions - } - ); - - expect(simulatedTx).toBeDefined(); - - expect(simulatedTx).toHaveLength(1); - - expect(stringifyData(simulatedTx[0])).toStrictEqual( - stringifyData(expected.simulationResults[0]) - ); - }); - } - ); - - /** - * Simulate smart contract deploy transactions - */ - simulateTransaction.correct.deployContract.forEach( - ({ testName, transaction, expected }) => { - test(testName, async () => { - const simulatedTx = - await thorSoloClient.transactions.simulateTransaction( - transaction.clauses - ); - - expect(simulatedTx).toBeDefined(); - - expect(simulatedTx).toHaveLength(1); - - expect(stringifyData(simulatedTx[0])).toStrictEqual( - stringifyData(expected.simulationResults[0]) - ); - }); - } - ); - - /** - * Simulate transactions where an error is expected - */ - simulateTransaction.errors.forEach( - ({ testName, transaction, vmError }) => { - test(testName, async () => { - const simulatedTx = - await thorSoloClient.transactions.simulateTransaction( - transaction.clauses, - { - ...transaction.simulateTransactionOptions - } - ); - - expect(simulatedTx).toBeDefined(); - expect(simulatedTx).toHaveLength(1); - expect(simulatedTx[0].vmError).toStrictEqual(vmError); - expect(simulatedTx[0].reverted).toBe(true); - expect(simulatedTx[0].transfers).toHaveLength(0); - expect(simulatedTx[0].events).toHaveLength(0); - expect(simulatedTx[0].data).toStrictEqual('0x'); - }); - } - ); - - /** - * Simulate transaction with invalid revision - */ - test('simulateTransaction with invalid revision', async () => { - await expect( - thorSoloClient.transactions.simulateTransaction( - [ - { - to: '0x', - data: '0x', - value: '0x0' - } - ], - { revision: 'invalid-revision' } - ) - ).rejects.toThrow(InvalidDataType); - }); - }); -}); diff --git a/packages/network/tests/thor-client/transactions/transactions-thorest.testnet.test.ts b/packages/network/tests/thor-client/transactions/transactions-thorest.testnet.test.ts deleted file mode 100644 index e9978448c..000000000 --- a/packages/network/tests/thor-client/transactions/transactions-thorest.testnet.test.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { beforeEach, describe, expect, test } from '@jest/globals'; -import { transactionDetails, transactionReceipts } from './fixture-thorest'; -import { TESTNET_URL, ThorClient } from '../../../src'; - -/** - * ThorClient class tests - * - * @NOTE: This test suite run on testnet network because it contains read only tests. - * - * @group integration/clients/thor-client/transactions - */ -describe('ThorClient - Transactions Module', () => { - // ThorClient instance - let thorClient: ThorClient; - - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * getTransaction tests - */ - describe('getTransaction', () => { - /** - * getTransaction - correct cases - */ - transactionDetails.correct.forEach((testCase) => { - test(testCase.testName, async () => { - // Check block number - const latestBlock = - await thorClient.blocks.getFinalBlockCompressed(); - - // Check transaction block. If undefined, it is the 'best' block. - for (const blockNumber of [latestBlock, undefined]) { - const transaction = testCase.transaction.raw - ? await thorClient.transactions.getTransactionRaw( - testCase.transaction.id, - { - head: blockNumber?.id, - pending: testCase.transaction.pending - } - ) - : await thorClient.transactions.getTransaction( - testCase.transaction.id, - { - head: blockNumber?.id, - pending: testCase.transaction.pending - } - ); - expect(transaction).toEqual(testCase.expected); - } - }); - }); - - /** - * getTransaction - error cases - */ - transactionDetails.errors.forEach((testCase) => { - test(testCase.testName, async () => { - await expect( - thorClient.transactions.getTransaction( - testCase.transaction.id, - { - head: testCase.transaction.head - } - ) - ).rejects.toThrow(testCase.expected); - }); - }); - }); - - /** - * getTransactionReceipt tests - */ - describe('getTransactionReceipt', () => { - /** - * getTransactionReceipt - correct cases - */ - transactionReceipts.correct.forEach((testCase) => { - test(testCase.testName, async () => { - // Check block number - const latestBlock = - await thorClient.blocks.getFinalBlockCompressed(); - - // Check transaction block. If undefined, it is the 'best' block. - for (const blockNumber of [latestBlock, undefined]) { - const transaction = - await thorClient.transactions.getTransactionReceipt( - testCase.transaction.id, - { head: blockNumber?.id } - ); - expect(transaction).toEqual(testCase.expected); - } - }); - }); - - /** - * getTransactionReceipt - error cases - */ - transactionReceipts.errors.forEach((testCase) => { - test(testCase.testName, async () => { - await expect( - thorClient.transactions.getTransactionReceipt( - testCase.transaction.id, - { head: testCase.transaction.head } - ) - ).rejects.toThrow(testCase.expected); - }); - }); - }); -}); diff --git a/packages/network/tests/thor-client/transactions/transactions.mocks.solo.test.ts b/packages/network/tests/thor-client/transactions/transactions.mocks.solo.test.ts deleted file mode 100644 index ef443f270..000000000 --- a/packages/network/tests/thor-client/transactions/transactions.mocks.solo.test.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { describe, expect, jest, test } from '@jest/globals'; -import { THOR_SOLO_URL, ThorClient } from '../../../src'; -import { transactionNonces, transferTransactionBody } from './fixture'; -import { TEST_ACCOUNTS } from '../../fixture'; -import { InvalidTransactionField } from '@vechain/sdk-errors'; - -/** - * Transactions module tests with mocks. - * - * @group integration/clients/thor-client/transactions - */ -describe('buildTransactionBody with mocks', () => { - test('Should throw error when genesis block is not found', async () => { - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - - // Mock the getBlock method to return null - jest.spyOn( - thorSoloClient.blocks, - 'getBlockCompressed' - ).mockResolvedValue(null); - - const gas = await thorSoloClient.gas.estimateGas( - [transferTransactionBody.clauses[0]], - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - await expect( - thorSoloClient.transactions.buildTransactionBody( - [transferTransactionBody.clauses[0]], - gas.totalGas - ) - ).rejects.toThrowError(InvalidTransactionField); - }); - - test('Should throw error when get block is not found', async () => { - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - - // Mock the getBestBlock method to return null - jest.spyOn( - thorSoloClient.blocks, - 'getBestBlockCompressed' - ).mockResolvedValue(null); - - const gas = await thorSoloClient.gas.estimateGas( - [transferTransactionBody.clauses[0]], - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - await expect( - thorSoloClient.transactions.buildTransactionBody( - [transferTransactionBody.clauses[0]], - gas.totalGas - ) - ).rejects.toThrowError(InvalidTransactionField); - }); - - test('Should succeed when options are set', async () => { - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - - const blockRef = - (await thorSoloClient.blocks.getBestBlockRef()) as string; - - const gas = await thorSoloClient.gas.estimateGas( - [transferTransactionBody.clauses[0]], - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - const options = { - blockRef, - chainTag: 256, - dependsOn: - '0x9140e36f05000508465fd55d70947b99a78c84b3afa5e068b955e366b560935f', // Any valid tx id - expiration: 1000, - gasPriceCoef: 255, - isDelegated: true, - nonce: transactionNonces - .sendTransactionWithANumberAsValueInTransactionBody[0] - }; - - const transactionBody = - await thorSoloClient.transactions.buildTransactionBody( - [transferTransactionBody.clauses[0]], - gas.totalGas, - options - ); - expect(transactionBody.blockRef).toStrictEqual(options.blockRef); - expect(transactionBody.chainTag).toStrictEqual(options.chainTag); - expect(transactionBody.dependsOn).toStrictEqual(options.dependsOn); - expect(transactionBody.expiration).toStrictEqual(options.expiration); - expect(transactionBody.gasPriceCoef).toStrictEqual( - options.gasPriceCoef - ); - expect(transactionBody.nonce).toStrictEqual(options.nonce); - expect(transactionBody.reserved).toStrictEqual({ features: 1 }); - }); -}); diff --git a/packages/network/tests/thor-client/transactions/transactions.solo.test.ts b/packages/network/tests/thor-client/transactions/transactions.solo.test.ts deleted file mode 100644 index 864192a48..000000000 --- a/packages/network/tests/thor-client/transactions/transactions.solo.test.ts +++ /dev/null @@ -1,229 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { - buildTransactionBodyClausesTestCases, - expectedReceipt, - invalidWaitForTransactionTestCases, - transactionNonces, - transfer1VTHOClause, - transferTransactionBody, - transferTransactionBodyValueAsNumber, - waitForTransactionTestCases -} from './fixture'; -import { TEST_ACCOUNTS } from '../../fixture'; -import { HexUInt, Transaction } from '@vechain/sdk-core'; -import { InvalidDataType } from '@vechain/sdk-errors'; -import { THOR_SOLO_URL, ThorClient } from '../../../src'; - -/** - * Transactions module tests. - * - * @group integration/clients/thor-client/transactions - */ -describe('ThorClient - Transactions Module', () => { - // ThorClient instance for the Solo network - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - - /** - * Test suite for sendTransaction method - * For further testing examples see tests/clients/thorest-client/transactions/* - */ - describe('sendTransaction', () => { - test("Should throw error if transaction isn't signed", async () => { - // Estimate the gas required for the transfer transaction - const gasResult = await thorSoloClient.gas.estimateGas( - [transfer1VTHOClause], - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - // Create the unsigned transfer transaction - const tx = Transaction.of({ - ...transferTransactionBody, - gas: gasResult.totalGas, - nonce: transactionNonces - .shouldThrowErrorIfTransactionIsntSigned[0] - }); - - await expect( - thorSoloClient.transactions.sendTransaction(tx) - ).rejects.toThrow(InvalidDataType); - }); - }); - - /** - * Test suite for waitForTransaction method - */ - describe('waitForTransaction', () => { - /** - * waitForTransaction test cases with different options - */ - waitForTransactionTestCases.forEach(({ description, options }) => { - test( - description, - async () => { - // Estimate the gas required for the transfer transaction - const gasResult = await thorSoloClient.gas.estimateGas( - [transfer1VTHOClause], - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - // Create the signed transfer transaction - const tx = Transaction.of({ - ...transferTransactionBody, - gas: gasResult.totalGas, - nonce: options.nonce - }).sign( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER - .privateKey - ).bytes - ); - - // Send the transaction and obtain the transaction ID - const sendTransactionResult = - await thorSoloClient.transactions.sendTransaction(tx); - - expect(sendTransactionResult).toBeDefined(); - expect(sendTransactionResult.id).toBeDefined(); - - // Wait for the transaction to be included in a block - const txReceipt = - await thorSoloClient.transactions.waitForTransaction( - sendTransactionResult.id, - options - ); - - expect(txReceipt).toBeDefined(); - expect(txReceipt?.reverted).toBe(expectedReceipt.reverted); - expect(txReceipt?.outputs).toEqual(expectedReceipt.outputs); - expect(txReceipt?.gasUsed).toBe(expectedReceipt.gasUsed); - expect(txReceipt?.gasPayer).toBe(expectedReceipt.gasPayer); - expect(sendTransactionResult.id).toBe(txReceipt?.meta.txID); - }, - 10000 - ); - }); - - /** - * test that send transaction with a number as value in transaction body - */ - test('test a send transaction with a number as value in transaction body ', async () => { - // Estimate the gas required for the transfer transaction - const gasResult = await thorSoloClient.gas.estimateGas( - [transfer1VTHOClause], - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - // Create the signed transfer transaction - const tx = Transaction.of({ - ...transferTransactionBodyValueAsNumber, - gas: gasResult.totalGas, - nonce: transactionNonces - .sendTransactionWithANumberAsValueInTransactionBody[0] - }).sign( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.privateKey - ).bytes - ); - - // Send the transaction and obtain the transaction ID - const sendTransactionResult = - await thorSoloClient.transactions.sendTransaction(tx); - - expect(sendTransactionResult).toBeDefined(); - expect(sendTransactionResult.id).toBeDefined(); - - // Wait for the transaction to be included in a block - const txReceipt = await sendTransactionResult.wait(); - - expect(txReceipt).toBeDefined(); - expect(txReceipt?.reverted).toBe(expectedReceipt.reverted); - }); - - /** - * waitForTransaction test cases that should not return a transaction receipt - */ - invalidWaitForTransactionTestCases.forEach( - ({ description, options }) => { - test( - description, - async () => { - // Estimate the gas required for the transfer transaction - const gasResult = await thorSoloClient.gas.estimateGas( - [transfer1VTHOClause], - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - // Create the signed transfer transaction - const tx = Transaction.of({ - ...transferTransactionBody, - gas: gasResult.totalGas, - nonce: options.nonce - }).sign( - HexUInt.of( - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER - .privateKey - ).bytes - ); - - const sendTransactionResult = - await thorSoloClient.transactions.sendTransaction( - tx - ); - - expect(sendTransactionResult.id).toBeDefined(); - - const txReceipt = - await thorSoloClient.transactions.waitForTransaction( - sendTransactionResult.id, - options - ); - - expect(txReceipt).toBeNull(); - }, - 5000 - ); - } - ); - }); - - /** - * Test suite for buildTransactionBody method - */ - describe('buildTransactionBody', () => { - /** - * buildTransactionBody test cases with different options - */ - buildTransactionBodyClausesTestCases.forEach( - ({ description, clauses, options, expected }) => { - test(description, async () => { - const gasResult = await thorSoloClient.gas.estimateGas( - clauses, - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - - expect(gasResult.totalGas).toBe(expected.solo.gas); - - const txBody = - await thorSoloClient.transactions.buildTransactionBody( - clauses, - gasResult.totalGas, - options - ); - - expect(txBody).toBeDefined(); - expect(txBody.clauses).toStrictEqual(expected.solo.clauses); - expect(txBody.expiration).toBe(expected.solo.expiration); - expect(txBody.gas).toBe(gasResult.totalGas); - expect(txBody.dependsOn).toBe(expected.solo.dependsOn); - expect(txBody.gasPriceCoef).toBe( - expected.solo.gasPriceCoef - ); - expect(txBody.reserved).toStrictEqual( - expected.solo.reserved - ); - expect(txBody.chainTag).toBe(expected.solo.chainTag); - }); - } - ); - }); -}); diff --git a/packages/network/tests/thor-client/transactions/transactions.testnet.test.ts b/packages/network/tests/thor-client/transactions/transactions.testnet.test.ts deleted file mode 100644 index 42ace6aed..000000000 --- a/packages/network/tests/thor-client/transactions/transactions.testnet.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { - buildTransactionBodyClausesTestCases, - getRevertReasonTestCasesFixture -} from './fixture'; -import { THOR_SOLO_ACCOUNTS_BASE_WALLET } from '../../fixture'; -import { TESTNET_URL, ThorClient, VeChainProvider } from '../../../src'; -import { InvalidDataType } from '@vechain/sdk-errors'; - -/** - * Transactions module tests suite. - * - * @group integration/clients/thor-client/transactions - */ -describe('Transactions module Testnet tests suite', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - provider = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET, - false - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - /** - * Test suite for buildTransactionBody method - */ - describe('buildTransactionBody', () => { - /** - * buildTransactionBody test cases with different options - */ - buildTransactionBodyClausesTestCases.forEach( - ({ description, clauses, options, expected }) => { - test( - description, - async () => { - const thorClient = ThorClient.at(TESTNET_URL); - const gasResult = await thorClient.gas.estimateGas( - clauses, - '0x000000000000000000000000004d000000000000' // This address might not exist on testnet, thus the gasResult.reverted might be true - ); - - expect(gasResult.totalGas).toBe(expected.testnet.gas); - - const txBody = - await thorClient.transactions.buildTransactionBody( - clauses, - gasResult.totalGas, - options - ); - - expect(txBody).toBeDefined(); - expect(txBody.clauses).toStrictEqual( - expected.testnet.clauses - ); - expect(txBody.expiration).toBe( - expected.testnet.expiration - ); - expect(txBody.gas).toBe(gasResult.totalGas); - expect(txBody.dependsOn).toBe( - expected.testnet.dependsOn - ); - expect(txBody.gasPriceCoef).toBe( - expected.testnet.gasPriceCoef - ); - expect(txBody.reserved).toStrictEqual( - expected.testnet.reserved - ); - expect(txBody.chainTag).toBe(expected.testnet.chainTag); - }, - 8000 - ); - } - ); - }); - - /** - * Test suite for getRevertReason method - */ - describe('getRevertReason', () => { - /** - * Get revert info test case - */ - getRevertReasonTestCasesFixture.forEach((testCase) => { - test(testCase.description, async () => { - const revertReason = - await thorClient.transactions.getRevertReason( - testCase.revertedTransactionHash, - testCase.errorFragment - ); - expect(revertReason).toStrictEqual(testCase.expected); - }); - }, 10000); - }); - - /** - * Test negative cases - */ - describe('Negative cases', () => { - /** - * waitForTransaction() with invalid transaction id - */ - test('waitForTransaction with invalid transaction id', async () => { - await expect(async () => { - await thorClient.transactions.waitForTransaction('0xINVALID'); - }).rejects.toThrow(InvalidDataType); - }); - - /** - * getTransactionRaw() with invalid input data - */ - test('getTransactionRaw with invalid input data', async () => { - // Invalid transaction id - await expect(async () => { - await thorClient.transactions.getTransactionRaw('0xINVALID'); - }).rejects.toThrow(InvalidDataType); - - // Invalid block id - await expect(async () => { - await thorClient.transactions.getTransactionRaw( - getRevertReasonTestCasesFixture[0].revertedTransactionHash, - { head: '0xINVALID' } - ); - }).rejects.toThrow(InvalidDataType); - }); - }); -}); diff --git a/packages/network/tests/utils/poll/event/event-poll.unit.test.ts b/packages/network/tests/utils/poll/event/event-poll.unit.test.ts deleted file mode 100644 index 617b4995e..000000000 --- a/packages/network/tests/utils/poll/event/event-poll.unit.test.ts +++ /dev/null @@ -1,184 +0,0 @@ -import { afterEach, describe, expect, jest, test } from '@jest/globals'; -import { - invalidOptionsParametersForPollTests, - simpleIncrementFunction, - simpleThrowErrorFunctionIfInputIs10 -} from '../fixture'; -import { PollExecution } from '@vechain/sdk-errors'; -import { advanceTimersByTimeAndTick } from '../../../test-utils'; -import { Poll } from '../../../../src'; - -/** - * Test the Asynchronous Event poll functionalities side - * @group unit/utils/event-poll - */ -describe('Events poll unit tests', () => { - /** - * Correct cases - */ - describe('Correct cases', () => { - /** - * Restore to the real timers - */ - afterEach(() => { - jest.useRealTimers(); - }); - - /** - * Simple start and stop of an event poll - */ - test('Simple start and stop', async () => { - // To mock setTimeouts we need to use jest fake timers which allow to manipulate time and test asynchronicity - jest.useFakeTimers({ - legacyFakeTimers: true - }); - - // Create event poll - const eventPoll = Poll.createEventPoll( - async () => await simpleIncrementFunction(0, 10), - 1000 - ) - .onData((data, eventPoll) => { - expect(data).toBe(10); - expect(eventPoll).toBeDefined(); - }) - .onStart((eventPoll) => { - expect(eventPoll).toBeDefined(); - }) - .onStop((eventPoll) => { - expect(eventPoll).toBeDefined(); - }); - - // Start listening and continue the execution flow - eventPoll.startListen(); - - // Advance timers by the specified interval & tick - await advanceTimersByTimeAndTick(1000); - - // Stop listening - eventPoll.stopListen(); - }); - - /** - * Simple start and stop of an event poll and test asynchronicity - */ - test('Create event poll and test asynchronicity', async () => { - jest.useFakeTimers({ - legacyFakeTimers: true - }); - - // Create event poll - const eventPoll = Poll.createEventPoll( - async () => await simpleIncrementFunction(0, 10), - 1000 - ) - .onData((data, eventPoll) => { - expect(data).toBe(10); - if (eventPoll.getCurrentIteration === 3) - eventPoll.stopListen(); - }) - .onStop((eventPoll) => { - expect(eventPoll.getCurrentIteration).toBe(3); - }); - - // Start listening and continue the execution flow - eventPoll.startListen(); - - // It seems to be strange, BUT onData is called only after 1 second of the eventPoll.startListen() call. - expect(eventPoll.getCurrentIteration).toBe(0); - - // Advance timers by the specified interval & tick - await advanceTimersByTimeAndTick(1000); - - expect(eventPoll.getCurrentIteration).toBe(1); - - await advanceTimersByTimeAndTick(1000); - - expect(eventPoll.getCurrentIteration).toBe(2); - - await advanceTimersByTimeAndTick(1000); - - expect(eventPoll.getCurrentIteration).toBe(3); - }, 5000); - }); - - /** - * Error cases - */ - describe('Error cases', () => { - /** - * Restore to the real timers - */ - afterEach(() => { - jest.useRealTimers(); - }); - /** - * Test the error event - */ - test('Test the error event - polling loop stop', async () => { - jest.useFakeTimers({ - legacyFakeTimers: true - }); - - // Create event poll - const eventPoll = Poll.createEventPoll( - async () => await simpleThrowErrorFunctionIfInputIs10(10), - 1000 - ).onError((error) => { - expect(error).toBeDefined(); - expect(error).toBeInstanceOf(PollExecution); - }); - - eventPoll.startListen(); - - await advanceTimersByTimeAndTick(1000); - }); - - /** - * Test the error event without stopping the poll loop. - */ - test('Test the error event - polling loop no-stop', async () => { - jest.useFakeTimers({ - legacyFakeTimers: true - }); - - // Create event poll - const eventPoll = Poll.createEventPoll( - async () => await simpleThrowErrorFunctionIfInputIs10(10), - 1000 - ).onError((error) => { - expect(error).toBeDefined(); - expect(error).toBeInstanceOf(PollExecution); - }); - - eventPoll.startListen(); - - await advanceTimersByTimeAndTick(1000); - - expect(eventPoll.getCurrentIteration).toBe(1); - // Advance timers by the specified interval & tick - await advanceTimersByTimeAndTick(1000); - expect(eventPoll.getCurrentIteration).toBe(2); - }); - - /** - * Invalid request interval - */ - test('Invalid request interval', () => { - for (const invalidParameter of invalidOptionsParametersForPollTests.filter( - // Remove cases that are valid for sync poll - (value) => - !Number.isInteger(value.requestIntervalInMilliseconds) || - value.requestIntervalInMilliseconds <= 0 - )) { - expect(() => { - Poll.createEventPoll( - async () => - await simpleThrowErrorFunctionIfInputIs10(9), - invalidParameter.requestIntervalInMilliseconds - ); - }).toThrowError(invalidParameter.expectedError); - } - }); - }); -}); diff --git a/packages/network/tests/utils/poll/fixture.ts b/packages/network/tests/utils/poll/fixture.ts deleted file mode 100644 index 1c332e620..000000000 --- a/packages/network/tests/utils/poll/fixture.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; - -/** - * Simple increment function fixture - */ -const simpleIncrementFunction = async ( - initialValue: number, - max: number -): Promise => { - if (initialValue < max) - return await simpleIncrementFunction(initialValue + 1, max); - return initialValue; -}; - -/** - * Simple throw error function fixture - * It throws an error if the input is 10 - */ -const simpleThrowErrorFunctionIfInputIs10 = async ( - a: number -): Promise => { - if (a === 10) - throw new InvalidDataType( - 'simpleThrowErrorFunctionIfInputIs10()', - "Input value error: 'a' must not be 10.", - { input: a } - ); - - return await simpleIncrementFunction(a, a + 1); -}; - -/** - * Simple invalid parameters fixture - */ -const invalidOptionsParametersForPollTests = [ - { - requestIntervalInMilliseconds: -1, - maximumIterations: 3, - expectedError: InvalidDataType - }, - { - requestIntervalInMilliseconds: 0, - maximumIterations: 3, - expectedError: InvalidDataType - }, - { - requestIntervalInMilliseconds: 3, - maximumIterations: 0, - expectedError: InvalidDataType - }, - { - requestIntervalInMilliseconds: 1, - maximumIterations: -3, - expectedError: InvalidDataType - }, - { - requestIntervalInMilliseconds: 0.5, - maximumIterations: 1, - expectedError: InvalidDataType - }, - { - requestIntervalInMilliseconds: 5, - maximumIterations: 1.7, - expectedError: InvalidDataType - }, - { - requestIntervalInMilliseconds: 1, - maximumIterations: 1, - maximumWaitingTimeInMilliseconds: -1, - expectedError: InvalidDataType - } -]; -export { - simpleIncrementFunction, - invalidOptionsParametersForPollTests, - simpleThrowErrorFunctionIfInputIs10 -}; diff --git a/packages/network/tests/utils/poll/sync/sync-poll.unit.test.ts b/packages/network/tests/utils/poll/sync/sync-poll.unit.test.ts deleted file mode 100644 index f8e973f7e..000000000 --- a/packages/network/tests/utils/poll/sync/sync-poll.unit.test.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { Poll } from '../../../../src'; -import { PollExecution } from '@vechain/sdk-errors'; -import { - invalidOptionsParametersForPollTests, - simpleIncrementFunction, - simpleThrowErrorFunctionIfInputIs10 -} from '../fixture'; - -/** - * Test the Synchronous poll functionalities side - * @group unit/utils/sync-poll - */ -describe('Synchronous poll unit tests', () => { - /** - * Correct cases without force stopping - */ - describe('No force stopping', () => { - /** - * Test without blocking execution on steps - */ - test('Sync poll without blocking execution on steps', async () => { - for (const requestInterval of [undefined, 100, 1000]) { - const result = await Poll.SyncPoll( - async () => await simpleIncrementFunction(0, 10), - { - requestIntervalInMilliseconds: requestInterval - } - ).waitUntil((result) => { - return result === 10; - }); - expect(result).toBe(10); - } - }); - }); - - describe('Force stopping', () => { - /** - * Test with blocking execution on steps - */ - test('Sync poll with blocking execution on steps', async () => { - // Sync poll - Set or not the request interval - for (const requestInterval of [undefined, 100]) { - const result = await Poll.SyncPoll( - async () => await simpleIncrementFunction(0, 10), - { - requestIntervalInMilliseconds: requestInterval, - // Stop after 3 iterations - maximumIterations: 3 - } - ).waitUntil((result) => { - // @IMPORTANT: Here this simple function will never reach 11. This is a case where the maximum iterations is useful. - return result === 11; - }); - expect(result).toBe(10); - } - }); - - /** - * Test with maximum waiting time - */ - test('Sync poll with blocking execution on maximum waiting time', async () => { - const startTime = Date.now(); - - await Poll.SyncPoll( - async () => await simpleIncrementFunction(0, 10), - { - requestIntervalInMilliseconds: 100, - maximumWaitingTimeInMilliseconds: 1000 // Stop after 1000ms - } - ).waitUntil((result) => { - return result === 20; // Condition that will never be true because we will stop the poll before (after 1000ms) - }); - - const endTime = Date.now(); - - // We expect that the poll will stop after 1000ms - expect(endTime - startTime).toBeLessThan(2000); - }); - }); - - describe('Invalid parameters', () => { - /** - * Test with blocking execution on steps - */ - test('Invalid parameters given as input', async () => { - for (const invalidParameter of invalidOptionsParametersForPollTests) { - await expect(async () => { - await Poll.SyncPoll( - async () => await simpleIncrementFunction(0, 10), - { - // Invalids - requestIntervalInMilliseconds: - invalidParameter.requestIntervalInMilliseconds, - maximumIterations: - invalidParameter.maximumIterations, - maximumWaitingTimeInMilliseconds: - invalidParameter.maximumWaitingTimeInMilliseconds - } - ).waitUntil((result) => { - return result === 10; - }); - }).rejects.toThrowError(invalidParameter.expectedError); - } - }); - }); - - /** - * Tests when errors are thrown - */ - describe('Throw error', () => { - /** - * Test with blocking execution on steps - */ - test('Throw error', async () => { - // Sync poll - Set or not the request interval - for (const requestInterval of [undefined, 100]) { - await expect(async () => { - await Poll.SyncPoll( - async () => - await simpleThrowErrorFunctionIfInputIs10(10), - { - requestIntervalInMilliseconds: requestInterval, - // Stop after 3 iterations - maximumIterations: 3 - } - ).waitUntil((result) => { - // @IMPORTANT: Here this simple function will never reach 11. But who cares, we know that it will throw an error. And after throwing an error, it will stop. - return result === 11; - }); - }).rejects.toThrowError(PollExecution); - } - }); - - test('Test simpleThrowErrorFunctionIfInputIs10', () => { - const poll = Poll.SyncPoll( - async () => await simpleThrowErrorFunctionIfInputIs10(7), - { - requestIntervalInMilliseconds: 100, - // Stop after 2 iterations - maximumIterations: 2 - } - ).waitUntil((result) => { - return result === 9; - }); - expect(poll).toBeDefined(); - }); - }); -}); diff --git a/packages/network/tests/utils/subscriptions/fixture.ts b/packages/network/tests/utils/subscriptions/fixture.ts deleted file mode 100644 index 7c8eaf3b3..000000000 --- a/packages/network/tests/utils/subscriptions/fixture.ts +++ /dev/null @@ -1,292 +0,0 @@ -import { Hex } from '@vechain/sdk-core'; -import { EventFragment, hexlify, toBeHex, zeroPadValue } from 'ethers'; -import { TESTING_CONTRACT_ADDRESS } from '../../fixture'; -// eslint-disable-next-line import/no-named-default -import { default as NodeWebSocket } from 'isomorphic-ws'; - -/** - * random address for `from` parameter - */ -const fromRandomAddress = Hex.random(20).toString(); - -/** - * random address for `to` parameter - */ -const toRandomAddress = Hex.random(20).toString(); - -/** - * `value` random BigInt - */ -// eslint-disable-next-line sonarjs/pseudo-random -const randomBigInt = BigInt(Math.floor(Math.random() * 1000)); - -/** - * Test cases for the getEventSubscriptionUrl function - */ -const getEventSubscriptionUrlTestCases = [ - { - event: { - anonymous: false, - inputs: [ - { - indexed: true, - name: 'from', - type: 'address' - }, - { - indexed: true, - name: 'to', - type: 'address' - }, - { - indexed: false, - name: 'value', - type: 'uint256' - } - ], - name: 'Transfer', - type: 'event' - }, - valuesToEncode: [fromRandomAddress, toRandomAddress], - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}&t2=0x000000000000000000000000${toRandomAddress.slice(2)}` - }, - { - event: EventFragment.from({ - anonymous: false, - inputs: [ - { - indexed: true, - name: 'from', - type: 'address' - }, - { - indexed: true, - name: 'to', - type: 'address' - }, - { - indexed: false, - name: 'value', - type: 'uint256' - } - ], - name: 'Transfer', - type: 'event' - }), - valuesToEncode: [fromRandomAddress, toRandomAddress], - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}&t2=0x000000000000000000000000${toRandomAddress.slice(2)}` - }, - { - event: 'event Transfer(address indexed, address indexed, uint256)', - valuesToEncode: [fromRandomAddress, toRandomAddress], - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}&t2=0x000000000000000000000000${toRandomAddress.slice(2)}` - }, - { - event: 'event Transfer(address indexed from, address indexed to, uint256 value)', - valuesToEncode: [fromRandomAddress, toRandomAddress], - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}&t2=0x000000000000000000000000${toRandomAddress.slice(2)}` - }, - { - event: 'event Transfer(address indexed from, address indexed to, uint256 value)', - valuesToEncode: [fromRandomAddress], // Missing `to` parameter - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}` - }, - { - event: 'event Transfer(address indexed from, address indexed to, uint256 value)', - valuesToEncode: [null, toRandomAddress], // Missing `from` parameter - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t2=0x000000000000000000000000${toRandomAddress.slice( - 2 - )}` - }, - { - event: 'event Transfer(address indexed from, address indexed to, uint256 value)', - valuesToEncode: [], // Missing `from` and `to` parameters - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` - }, - { - event: 'event Transfer(address indexed from, address indexed to, uint256 value)', - valuesToEncode: undefined, - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` - }, - { - event: 'event Approval(address indexed owner, address indexed spender, uint256 value)', - valuesToEncode: [fromRandomAddress, toRandomAddress], - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}&t2=0x000000000000000000000000${toRandomAddress.slice(2)}` - }, - { - event: 'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)', - valuesToEncode: [fromRandomAddress, toRandomAddress, randomBigInt], - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}&t2=0x000000000000000000000000${toRandomAddress.slice( - 2 - )}&t3=${zeroPadValue(hexlify(toBeHex(randomBigInt)), 32)}` - }, - // WITH OPTIONS - { - event: 'event Transfer(address indexed from, address indexed to, uint256 value)', - valuesToEncode: [null, toRandomAddress], // Missing `from` parameter - options: { - address: TESTING_CONTRACT_ADDRESS - }, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?addr=${TESTING_CONTRACT_ADDRESS}&t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t2=0x000000000000000000000000${toRandomAddress.slice( - 2 - )}` - }, - { - event: 'event Transfer(address indexed from, address indexed to, uint256 indexed value)', - valuesToEncode: [fromRandomAddress, null, randomBigInt], // Missing `to` parameter - options: { - address: TESTING_CONTRACT_ADDRESS - }, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?addr=${TESTING_CONTRACT_ADDRESS}&t0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}&t3=${zeroPadValue(hexlify(toBeHex(randomBigInt)), 32)}` - }, - { - event: 'event Swap(address indexed sender,uint amount0In,uint amount1In,uint amount0Out,uint amount1Out,address indexed to)', - valuesToEncode: [fromRandomAddress, toRandomAddress], - options: { - address: TESTING_CONTRACT_ADDRESS - }, - expectedURL: `wss://testnet.vechain.org/subscriptions/event?addr=${TESTING_CONTRACT_ADDRESS}&t0=0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822&t1=0x000000000000000000000000${fromRandomAddress.slice( - 2 - )}&t2=0x000000000000000000000000${toRandomAddress.slice(2)}` - } -]; - -/** - * Test cases for the getBlockSubscriptionUrl function - */ -const getBlockSubscriptionUrlTestCases = [ - { - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/block` - } -]; - -/** - * Test cases for the getLegacyBeatSubscriptionUrl function - */ -const getLegacyBeatSubscriptionUrlTestCases = [ - { - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/beat` - } -]; - -/** - * Test cases for the getBeatSubscriptionUrl function - */ -const getBeatSubscriptionUrlTestCases = [ - { - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/beat2` - } -]; - -/** - * Test cases for the getNewTransactionsSubscriptionUrl function - */ -const getNewTransactionsSubscriptionUrlTestCases = [ - { - expectedURL: `wss://testnet.vechain.org/subscriptions/txpool` - } -]; - -const getVETtransfersSubscriptionUrlTestCases = [ - { - options: {}, - expectedURL: `wss://testnet.vechain.org/subscriptions/transfer` - }, - { - options: { - signerAddress: fromRandomAddress - }, - expectedURL: `wss://testnet.vechain.org/subscriptions/transfer?txOrigin=${fromRandomAddress}` - }, - - { - options: { - signerAddress: fromRandomAddress, - sender: fromRandomAddress - }, - expectedURL: `wss://testnet.vechain.org/subscriptions/transfer?txOrigin=${fromRandomAddress}&sender=${fromRandomAddress}` - }, - { - options: { - recipient: toRandomAddress - }, - expectedURL: `wss://testnet.vechain.org/subscriptions/transfer?recipient=${toRandomAddress}` - } -]; - -/** - * Test if the websocket connection is valid - * - * @param url - The websocket URL to test - * - * @returns A promise that resolves to true if the connection is valid, false otherwise. - */ -async function testWebSocketConnection(url: string): Promise { - return await new Promise((resolve, reject) => { - let ws: WebSocket | NodeWebSocket; - if (typeof WebSocket !== 'undefined') { - ws = new WebSocket(url); - } else { - ws = new NodeWebSocket(url); - } - - ws.onopen = () => { - ws.close(); - resolve(true); - }; - - ws.onerror = () => { - reject(new Error('WebSocket connection error: ')); - }; - - ws.onclose = (event: CloseEvent) => { - if (event.wasClean) { - console.log( - `Closed cleanly, code=${event.code} reason=${event.reason}` - ); - } else { - console.log('Connection died'); - reject(new Error('Connection closed unexpectedly')); - } - }; - }); -} - -export { - getBeatSubscriptionUrlTestCases, - getBlockSubscriptionUrlTestCases, - getEventSubscriptionUrlTestCases, - getLegacyBeatSubscriptionUrlTestCases, - getNewTransactionsSubscriptionUrlTestCases, - getVETtransfersSubscriptionUrlTestCases, - testWebSocketConnection -}; diff --git a/packages/network/tests/utils/subscriptions/subscriptions.solo.test.ts b/packages/network/tests/utils/subscriptions/subscriptions.solo.test.ts deleted file mode 100644 index 488eb57a5..000000000 --- a/packages/network/tests/utils/subscriptions/subscriptions.solo.test.ts +++ /dev/null @@ -1,339 +0,0 @@ -import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'; -import { - ABIContract, - Address, - Clause, - Hex, - HexUInt, - Transaction, - type TransactionClause, - Units -} from '@vechain/sdk-core'; -import { type AbiEvent } from 'abitype'; -import { - type CompressedBlockDetail, - type EventLogs, - signerUtils, - subscriptions, - THOR_SOLO_URL, - ThorClient, - type TransferLogs, - type VeChainPrivateKeySigner, - VeChainProvider -} from '../../../src'; -import { - TEST_ACCOUNTS, - TESTING_CONTRACT_ABI, - TESTING_CONTRACT_ADDRESS, - THOR_SOLO_ACCOUNTS_BASE_WALLET -} from '../../fixture'; -// eslint-disable-next-line import/no-named-default -import { default as NodeWebSocket } from 'isomorphic-ws'; -import { expectType } from 'tsd'; - -const TIMEOUT = 15000; // 15-second timeout - -/** - * Test suite for the Subscriptions utility methods for listening to events obtained through a websocket connection. - * - * @group integration/utils/subscriptions - */ -describe('Subscriptions Solo network tests', () => { - /** - * ThorClient and provider instances - */ - let thorClient: ThorClient; - let provider: VeChainProvider; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(THOR_SOLO_URL); - provider = new VeChainProvider( - thorClient, - THOR_SOLO_ACCOUNTS_BASE_WALLET, - false - ); - }); - - /** - * Destroy thor client and provider after each test - */ - afterEach(() => { - provider.destroy(); - }); - - test( - 'Should receive new blocks from the block subscription', - async () => { - const wsURL = subscriptions.getBlockSubscriptionUrl(THOR_SOLO_URL); - - let ws: WebSocket | NodeWebSocket; - if (typeof WebSocket !== 'undefined') { - ws = new WebSocket(wsURL); - } else { - ws = new NodeWebSocket(wsURL); - } - - await new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - ws.close(); - reject(new Error('Timeout: No block received')); - }, TIMEOUT); // 15-second timeout - - ws.onopen = () => { - console.log('WebSocket connection opened.'); - }; - - ws.onmessage = (event: MessageEvent) => { - clearTimeout(timeout); // Clear the timeout on receiving a message - ws.close(); // Close the WebSocket connection - - const data: string = - typeof event.data === 'string' - ? event.data - : JSON.stringify(event.data); - expect(data).toBeDefined(); // Basic assertion to ensure data is received - expect(data).not.toBeNull(); // Basic assertion to ensure data is received - - const block = JSON.parse( - data.toString() - ) as CompressedBlockDetail; - - expect(block.number).toBeGreaterThan(0); // Basic assertion to ensure the block number is valid - - resolve(true); - }; - - ws.onerror = (error: Event) => { - clearTimeout(timeout); // Clear the timeout in case of an error - reject(error); // Reject the promise with the error - }; - }); - }, - TIMEOUT - ); - - /** - * Test the getEventSubscriptionUrl function - */ - test( - 'Should receive smart contract event logs from the event subscription', - async () => { - // Create an interface for the smart contract ABI - const testingContractInterface = - ABIContract.ofAbi(TESTING_CONTRACT_ABI); - - // Get the event ABI for the StateChanged event - const eventAbi = testingContractInterface.getEvent('StateChanged'); - - // Get the URL for the event subscription - const wsURL = subscriptions.getEventSubscriptionUrl( - THOR_SOLO_URL, - eventAbi.signature as AbiEvent, - // Receive only events emitted that involve the EVENT_SUBSCRIPTION account address as the third indexed parameter of `event StateChanged(uint indexed newValue, uint indexed oldValue, address indexed sender, uint timestamp);` - [ - null, - null, - TEST_ACCOUNTS.SUBSCRIPTION.EVENT_SUBSCRIPTION.address - ] - ); - - // Create a WebSocket connection - let ws: WebSocket | NodeWebSocket; - if (typeof WebSocket !== 'undefined') { - ws = new WebSocket(wsURL); - } else { - ws = new NodeWebSocket(wsURL); - } - - // Set up a promise to handle WebSocket messages - const waitForMessage = new Promise((resolve, reject) => { - ws.onopen = () => { - console.log('WebSocket connection opened.'); - }; - - ws.onmessage = (event: MessageEvent) => { - const data: string = - typeof event.data === 'string' - ? event.data - : JSON.stringify(event.data); - try { - const log = JSON.parse(data) as EventLogs; - expect(log).toBeDefined(); // Your assertion here - - const decodedLog = - testingContractInterface.decodeEventLog( - 'StateChanged', - { - data: Hex.of(log.data), - topics: log.topics.map((topic) => - Hex.of(topic) - ) - } - ); - - expectType<{ - eventName: 'StateChanged'; - args: { - newValue: bigint; - oldValue: bigint; - sender: string; - timestamp: bigint; - }; - }>(decodedLog); - expect(Object.keys(decodedLog.args).length).toBe(4); - expect(decodedLog.args.sender).toBe( - Address.checksum( - HexUInt.of( - TEST_ACCOUNTS.SUBSCRIPTION - .EVENT_SUBSCRIPTION.address - ) - ) - ); - - resolve(true); // Resolve the promise when a message is received - } catch (error) { - reject(error); // Reject the promise on error - } finally { - ws.close(); // Ensure WebSocket is closed - } - }; - - ws.onerror = (error: Event) => { - reject(error); // Reject the promise on WebSocket error - }; - }); - const clause = Clause.callFunction( - Address.of(TESTING_CONTRACT_ADDRESS), - ABIContract.ofAbi(TESTING_CONTRACT_ABI).getFunction( - 'setStateVariable' - ), - [1] - ) as TransactionClause; - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - const gasResult = await thorSoloClient.gas.estimateGas( - [clause], - TEST_ACCOUNTS.SUBSCRIPTION.EVENT_SUBSCRIPTION.address - ); - const txBody = - await thorSoloClient.transactions.buildTransactionBody( - [clause], - gasResult.totalGas - ); - - // Create a signer to sign the transaction - const signer = (await provider.getSigner( - TEST_ACCOUNTS.SUBSCRIPTION.EVENT_SUBSCRIPTION.address - )) as VeChainPrivateKeySigner; - - // Get the raw transaction - const raw = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - TEST_ACCOUNTS.SUBSCRIPTION.EVENT_SUBSCRIPTION.address - ) - ); - - // Send the signed transaction to the blockchain - await thorSoloClient.transactions.sendTransaction( - Transaction.decode(HexUInt.of(raw.slice(2)).bytes, true) - ); - - // Wait for the WebSocket message or a timeout - await expect(waitForMessage).resolves.toBe(true); - }, - TIMEOUT - ); - - /** - * Test the getVETtransfersSubscriptionUrl function - */ - test('Should receive VET transfers from the VET transfers subscription', async () => { - const wsURL = subscriptions.getVETtransfersSubscriptionUrl( - THOR_SOLO_URL, - { - sender: TEST_ACCOUNTS.SUBSCRIPTION.VET_TRANSFERS_SUBSCRIPTION - .address - } - ); - - let ws: WebSocket | NodeWebSocket; - if (typeof WebSocket !== 'undefined') { - ws = new WebSocket(wsURL); - } else { - ws = new NodeWebSocket(wsURL); - } - - const waitForMessage = new Promise((resolve, reject) => { - ws.onopen = () => { - console.log('WebSocket connection opened.'); - }; - - ws.onmessage = (event: MessageEvent) => { - const data: string = - typeof event.data === 'string' - ? event.data - : JSON.stringify(event.data); - try { - const log = JSON.parse(data) as TransferLogs; - - expect(log).toBeDefined(); // Your assertion here - - expect(log.sender).toBe( - TEST_ACCOUNTS.SUBSCRIPTION.VET_TRANSFERS_SUBSCRIPTION - .address - ); - - resolve(true); // Resolve the promise when a message is received - } catch (error) { - reject(error); // Reject the promise on error - } finally { - ws.close(); // Ensure WebSocket is closed - } - }; - - ws.onerror = (error: Event) => { - reject(error); // Reject the promise on WebSocket error - }; - }); - - // Trigger the smart contract function that emits the event - const clause: TransactionClause = { - to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address, - value: Units.parseEther('1').toString(), - data: '0x' - }; - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - const gasResult = await thorSoloClient.gas.estimateGas( - [clause], - TEST_ACCOUNTS.SUBSCRIPTION.VET_TRANSFERS_SUBSCRIPTION.address - ); - const txBody = await thorSoloClient.transactions.buildTransactionBody( - [clause], - gasResult.totalGas - ); - - // Create a signer to sign the transaction - const signer = (await provider.getSigner( - TEST_ACCOUNTS.SUBSCRIPTION.VET_TRANSFERS_SUBSCRIPTION.address - )) as VeChainPrivateKeySigner; - - // Get the raw transaction - const raw = await signer.signTransaction( - signerUtils.transactionBodyToTransactionRequestInput( - txBody, - TEST_ACCOUNTS.SUBSCRIPTION.VET_TRANSFERS_SUBSCRIPTION.address - ) - ); - - // Send the signed transaction to the blockchain - await thorSoloClient.transactions.sendTransaction( - Transaction.decode(HexUInt.of(raw.slice(2)).bytes, true) - ); - - // Wait for the WebSocket message or a timeout - await expect(waitForMessage).resolves.toBe(true); - }); -}); diff --git a/packages/network/tests/utils/subscriptions/subscriptions.testnet.test.ts b/packages/network/tests/utils/subscriptions/subscriptions.testnet.test.ts deleted file mode 100644 index 2fedd3168..000000000 --- a/packages/network/tests/utils/subscriptions/subscriptions.testnet.test.ts +++ /dev/null @@ -1,173 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { stringifyData } from '@vechain/sdk-errors'; -import { type AbiEvent } from 'abitype'; -import { subscriptions, TESTNET_URL } from '../../../src'; -import { - getBeatSubscriptionUrlTestCases, - getBlockSubscriptionUrlTestCases, - getEventSubscriptionUrlTestCases, - getLegacyBeatSubscriptionUrlTestCases, - getNewTransactionsSubscriptionUrlTestCases, - getVETtransfersSubscriptionUrlTestCases, - testWebSocketConnection -} from './fixture'; - -/** - * Test suite for the Subscriptions utility methods for getting the subscription URLs - * - * @group integration/utils/subscriptions - */ -describe('Subscriptions Testnet', () => { - /** - * Test the Event Subscription URLs functionalities - * - */ - describe('Event Subscription URLs', () => { - /** - * Test the getEventSubscriptionUrl function - */ - getEventSubscriptionUrlTestCases.forEach( - ({ event, valuesToEncode, options, expectedURL }) => { - test(`getEventSubscriptionUrl: ${ - typeof event === 'string' ? event : stringifyData(event) - } with ${valuesToEncode?.toString()}`, async () => { - expect( - subscriptions.getEventSubscriptionUrl( - TESTNET_URL, - event as AbiEvent, - valuesToEncode, - options - ) - ).toEqual(expectedURL); - - // Test the connection to the websocket - await testWebSocketConnection(expectedURL); - }, 10000); - } - ); - }); - - /** - * Test the Block Subscription URLs functionalities - */ - describe('Block Subscription URLs', () => { - /** - * Test the getBlockSubscriptionUrl function - */ - getBlockSubscriptionUrlTestCases.forEach(({ options, expectedURL }) => { - test(`getBlockSubscriptionUrl: ${stringifyData( - options - )}`, async () => { - expect( - subscriptions.getBlockSubscriptionUrl(TESTNET_URL, options) - ).toEqual(expectedURL); - - // Test the connection to the websocket - await testWebSocketConnection(expectedURL); - }); - }); - }); - - /** - * Test the Beat Subscription URLs functionalities - */ - describe('Beat Subscription URLs', () => { - /** - * Test the getLegacyBeatSubscriptionUrl function - */ - getLegacyBeatSubscriptionUrlTestCases.forEach( - ({ options, expectedURL }) => { - test(`getLegacyBeatSubscriptionUrl: ${stringifyData( - options - )}`, async () => { - expect( - subscriptions.getLegacyBeatSubscriptionUrl( - TESTNET_URL, - options - ) - ).toEqual(expectedURL); - - // Test the connection to the websocket - await testWebSocketConnection(expectedURL); - }); - } - ); - - /** - * Test the getBeatSubscriptionUrl function - */ - getBeatSubscriptionUrlTestCases.forEach(({ options, expectedURL }) => { - test(`getBeatSubscriptionUrl: ${stringifyData( - options - )}`, async () => { - expect( - subscriptions.getBeatSubscriptionUrl(TESTNET_URL, options) - ).toEqual(expectedURL); - - // Test the connection to the websocket - await testWebSocketConnection(expectedURL); - }); - }); - }); - - /** - * Test the New Transactions Subscription URLs functionalities - */ - describe('New Transactions Subscription URLs', () => { - /** - * Test the getNewTransactionsSubscriptionUrl function - */ - getNewTransactionsSubscriptionUrlTestCases.forEach( - ({ expectedURL }) => { - test(`getNewTransactionsSubscriptionUrl`, async () => { - expect( - subscriptions.getNewTransactionsSubscriptionUrl( - TESTNET_URL - ) - ).toEqual(expectedURL); - - // Test the connection to the websocket - await testWebSocketConnection(expectedURL); - }); - } - ); - }); - - /** - * Test the VET Transfers Subscription URLs functionalities - */ - describe('VET Transfers Subscription URLs', () => { - /** - * Test the getVETtransfersSubscriptionUrl function - */ - getVETtransfersSubscriptionUrlTestCases.forEach( - ({ options, expectedURL }) => { - test(`getVETtransfersSubscriptionUrl: ${stringifyData( - options - )}`, async () => { - expect( - subscriptions.getVETtransfersSubscriptionUrl( - TESTNET_URL, - options - ) - ).toEqual(expectedURL); - - // Test the connection to the websocket - await testWebSocketConnection(expectedURL); - }); - } - ); - }); - - /** - * Test if the websocket connection is valid - */ - describe('testWebSocketConnection Errors', () => { - test('Wrong subscription URL', async () => { - const wrongUrl = 'ws://wrong.url'; - await expect( - testWebSocketConnection(wrongUrl) - ).rejects.toThrowError('WebSocket connection error'); - }); - }); -}); diff --git a/packages/network/tests/utils/thorest/fixture.ts b/packages/network/tests/utils/thorest/fixture.ts deleted file mode 100644 index 1b37e87b2..000000000 --- a/packages/network/tests/utils/thorest/fixture.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { InvalidDataType } from '@vechain/sdk-errors'; - -/** - * toQueryString test cases fixture - */ -const toQueryStringTestCases = [ - { - records: { - a: 1, - b: 2, - c: 3 - }, - expected: '?a=1&b=2&c=3' - }, - { - records: { - a: 1, - b: 2, - c: 3, - d: undefined - }, - expected: '?a=1&b=2&c=3' - }, - { - records: { - a: undefined, - b: 2, - c: 3, - d: undefined - }, - expected: '?b=2&c=3' - }, - { - records: {}, - expected: '' - } -]; - -/** - * sanitizeWebsocketBaseURL test cases fixture - */ -const sanitizeWebsocketBaseURLTestCases = [ - { - url: 'http://localhost:8669', - expected: 'ws://localhost:8669' - }, - { - url: 'https://localhost:8669', - expected: 'wss://localhost:8669' - }, - { - url: 'https://localhost:8669/', - expected: 'wss://localhost:8669' - }, - { - url: 'https://mainnet.vechain.org/', - expected: 'wss://mainnet.vechain.org' - }, - { - url: 'https://testnet.vechain.org:8669/', - expected: 'wss://testnet.vechain.org:8669' - } -]; - -/** - * invalid sanitizeWebsocketBaseURL test cases fixture - */ -const invalidSanitizeWebsocketBaseURLTestCases = [ - { - url: 'www.test', - expectedError: InvalidDataType - }, - { - url: 'http://www..test.com', - expectedError: InvalidDataType - }, - { - url: 'https://www.test..com', - expectedError: InvalidDataType - }, - { - url: 'localhost:8669', - expectedError: InvalidDataType - } -]; - -export { - toQueryStringTestCases, - sanitizeWebsocketBaseURLTestCases, - invalidSanitizeWebsocketBaseURLTestCases -}; diff --git a/packages/network/tests/utils/thorest/helpers.unit.test.ts b/packages/network/tests/utils/thorest/helpers.unit.test.ts deleted file mode 100644 index fcd78bd7f..000000000 --- a/packages/network/tests/utils/thorest/helpers.unit.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { describe, expect, test } from '@jest/globals'; -import { - invalidSanitizeWebsocketBaseURLTestCases, - sanitizeWebsocketBaseURLTestCases, - toQueryStringTestCases -} from './fixture'; -import { sanitizeWebsocketBaseURL, toQueryString } from '../../../src'; -import { stringifyData } from '@vechain/sdk-errors'; - -/** - * Thorest Helpers test suite - * - * @group unit/utils/thorest - */ -describe('Thorest Helpers', () => { - /** - * Test the toQueryString function - */ - toQueryStringTestCases.forEach(({ records, expected }) => { - test(`toQueryString: ${stringifyData(records)}`, () => { - expect(toQueryString(records)).toEqual(expected); - }); - }); - - /** - * Test the sanitizeWebsocketBaseURL function - */ - sanitizeWebsocketBaseURLTestCases.forEach(({ url, expected }) => { - test(`sanitizeWebsocketBaseURL: ${url}`, () => { - expect(sanitizeWebsocketBaseURL(url)).toEqual(expected); - }); - }); - - /** - * Test the sanitizeWebsocketBaseURL function with invalid URLs - */ - invalidSanitizeWebsocketBaseURLTestCases.forEach( - ({ url, expectedError }) => { - test(`sanitizeWebsocketBaseURL: ${url}`, () => { - expect(() => sanitizeWebsocketBaseURL(url)).toThrow( - expectedError - ); - }); - } - ); -}); diff --git a/packages/network/tests/utils/vns/lookups.mock.testnet.test.ts b/packages/network/tests/utils/vns/lookups.mock.testnet.test.ts deleted file mode 100644 index ae83444ad..000000000 --- a/packages/network/tests/utils/vns/lookups.mock.testnet.test.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { - afterEach, - beforeEach, - describe, - expect, - jest, - test -} from '@jest/globals'; -import { TESTNET_URL, ThorClient, vnsUtils } from '../../../src'; -import { ABIFunction, ABIItem } from '@vechain/sdk-core'; - -/** - * vnsUtils vet.domains tests - * - * @group unit/utils/vnsUtils - */ -describe('vnsUtils', () => { - /** - * ThorClient instances - */ - let thorClient: ThorClient; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * Destroy thor client after each test - */ - afterEach(() => { - thorClient.destroy(); - }); - - describe('resolveNames(string[])', () => { - test('Should use the correct resolveUtils based on the passed thor client', async () => { - const names = ['test-sdk-1.vet', 'test-sdk-2.vet']; - const executeCall = jest.fn(async () => { - return await Promise.reject(new Error('error')); - }); - jest.spyOn( - thorClient.transactions, - 'executeCall' - ).mockImplementationOnce(executeCall); - - await expect( - vnsUtils.resolveNames( - thorClient.blocks, - thorClient.transactions, - names - ) - ).rejects.toThrow(); - expect(executeCall).toHaveBeenCalledWith( - '0xc403b8EA53F707d7d4de095f0A20bC491Cf2bc94', - ABIItem.ofSignature( - ABIFunction, - 'function getAddresses(string[] names) returns (address[] addresses)' - ), - [names] - ); - }); - - test('Should return null if genesisBlock can not be loaded', async () => { - // Mock the getGenesisBlock method to return null - jest.spyOn( - thorClient.blocks, - 'getGenesisBlock' - ).mockResolvedValueOnce(null); - - const addresses = await vnsUtils.resolveNames( - thorClient.blocks, - thorClient.transactions, - ['test-sdk.vet'] - ); - expect(addresses).toEqual([null]); - }); - - test('Should return null if genesis has no matching configuration unknown', async () => { - jest.spyOn( - thorClient.blocks, - 'getGenesisBlock' - ).mockResolvedValueOnce({ - number: 0, - id: '0x00000000c05a20fbca2bf6ae3affba6af4a74b800b585bf7a4988aba7aea0000', // different genesis id - size: 170, - parentID: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - timestamp: 1526400000, - gasLimit: 10000000, - beneficiary: '0x0000000000000000000000000000000000000000', - gasUsed: 0, - totalScore: 0, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x93de0ffb1f33bc0af053abc2a87c4af44594f5dcb1cb879dd823686a15d68550', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - signer: '0x0000000000000000000000000000000000000000', - isTrunk: true, - transactions: [] - }); - - const addresses = await vnsUtils.resolveNames( - thorClient.blocks, - thorClient.transactions, - ['test-sdk.vet'] - ); - expect(addresses).toEqual([null]); - }); - }); - - describe('lookupAddresses(string[])', () => { - test('Should throw an error and call executeCall', async () => { - const addresses = [ - '0x0000000000000000000000000000456E65726779', - '0x625fCe8dd8E2C05e82e77847F3da06AF6e55A7AF' - ]; - const executeCall = jest.fn(async () => { - return await Promise.reject(new Error('error')); - }); - jest.spyOn( - thorClient.contracts, - 'executeCall' - ).mockImplementationOnce(executeCall); - - await expect( - vnsUtils.lookupAddresses(thorClient, addresses) - ).rejects.toThrow(); - expect(executeCall).toHaveBeenCalledWith( - '0xc403b8EA53F707d7d4de095f0A20bC491Cf2bc94', - ABIItem.ofSignature( - ABIFunction, - 'function getNames(address[] addresses) returns (string[] names)' - ), - [addresses] - ); - }); - - test('Should return null if genesisBlock can not be loaded', async () => { - // Mock the method to return null - jest.spyOn( - thorClient.blocks, - 'getGenesisBlock' - ).mockResolvedValueOnce(null); - - const names = await vnsUtils.lookupAddresses(thorClient, [ - '0x0000000000000000000000000000000000000000' - ]); - expect(names).toEqual([null]); - }); - - test('Should return null if genesis has no matching configuration unknown', async () => { - jest.spyOn( - thorClient.blocks, - 'getGenesisBlock' - ).mockResolvedValueOnce({ - number: 0, - id: '0x00000000c05a20fbca2bf6ae3affba6af4a74b800b585bf7a4988aba7aea0000', // different genesis id - size: 170, - parentID: - '0xffffffff00000000000000000000000000000000000000000000000000000000', - timestamp: 1526400000, - gasLimit: 10000000, - beneficiary: '0x0000000000000000000000000000000000000000', - gasUsed: 0, - totalScore: 0, - txsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - txsFeatures: 0, - stateRoot: - '0x93de0ffb1f33bc0af053abc2a87c4af44594f5dcb1cb879dd823686a15d68550', - receiptsRoot: - '0x45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0', - signer: '0x0000000000000000000000000000000000000000', - isTrunk: true, - transactions: [] - }); - - const names = await vnsUtils.lookupAddresses(thorClient, [ - '0x0000000000000000000000000000000000000000' - ]); - expect(names).toEqual([null]); - }); - }); -}); diff --git a/packages/network/tests/utils/vns/lookups.unit.test.ts b/packages/network/tests/utils/vns/lookups.unit.test.ts deleted file mode 100644 index 9d10bacbe..000000000 --- a/packages/network/tests/utils/vns/lookups.unit.test.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { - afterEach, - beforeEach, - describe, - expect, - jest, - test -} from '@jest/globals'; -import { TESTNET_URL, ThorClient, vnsUtils } from '../../../src'; - -/** - * vnsUtils vet.domains tests - * - * @group unit/utils/vnsUtils - */ -describe('vnsUtils', () => { - /** - * ThorClient instances - */ - let thorClient: ThorClient; - - /** - * Init thor client and provider before each test - */ - beforeEach(() => { - thorClient = ThorClient.at(TESTNET_URL); - }); - - /** - * Destroy thor client after each test - */ - afterEach(() => { - thorClient.destroy(); - }); - - describe('resolveName(name)', () => { - test('Should use resolveNames() to resolve an address by name', async () => { - jest.spyOn(vnsUtils, 'resolveNames'); - const name = 'test-sdk.vet'; - await vnsUtils.resolveName(thorClient, name); - expect(vnsUtils.resolveNames).toHaveBeenCalledWith( - thorClient.blocks, - thorClient.transactions, - [name] - ); - }); - - test('Should return null if resolveNames() has invalid result', async () => { - const name = 'error.vet'; - jest.spyOn(vnsUtils, 'resolveNames').mockImplementation( - async () => { - return await Promise.resolve([]); - } - ); - const address = await vnsUtils.resolveName(thorClient, name); - expect(address).toEqual(null); - }); - - test('Should pass address provided by resolveNames()', async () => { - const name = 'address1.vet'; - jest.spyOn(vnsUtils, 'resolveNames').mockImplementation( - async () => { - return await Promise.resolve([ - '0x0000000000000000000000000000000000000001' - ]); - } - ); - const address = await vnsUtils.resolveName(thorClient, name); - expect(address).toEqual( - '0x0000000000000000000000000000000000000001' - ); - }); - }); - - describe('lookupAddress(address)', () => { - test('Should use lookupAddresses() to lookup the single address', async () => { - jest.spyOn(vnsUtils, 'lookupAddresses'); - const address = '0x0000000000000000000000000000000000000001'; - await vnsUtils.lookupAddress(thorClient, address); - expect(vnsUtils.lookupAddresses).toHaveBeenCalledWith(thorClient, [ - address - ]); - }); - - test('Should return null if lookupAddresses() has invalid result', async () => { - const address = '0x0000000000000000000000000000000000000001'; - jest.spyOn(vnsUtils, 'lookupAddresses').mockImplementation( - async () => { - return await Promise.resolve([]); - } - ); - const name = await vnsUtils.lookupAddress(thorClient, address); - expect(name).toEqual(null); - }); - - test('Should pass name provided by lookupAddresses()', async () => { - const address = '0x0000000000000000000000000000000000000001'; - jest.spyOn(vnsUtils, 'lookupAddresses').mockImplementation( - async () => { - return await Promise.resolve(['test.vet']); - } - ); - const name = await vnsUtils.lookupAddress(thorClient, address); - expect(name).toEqual('test.vet'); - }); - }); -}); diff --git a/packages/network/tsconfig.json b/packages/network/tsconfig.json deleted file mode 100644 index b523f6a50..000000000 --- a/packages/network/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - }, - "include": [ - "./src/**/*.ts", - "./tests/**/*.ts" - ] -} \ No newline at end of file diff --git a/packages/network/typedoc.json b/packages/network/typedoc.json deleted file mode 100644 index 664b688e4..000000000 --- a/packages/network/typedoc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": ["../../typedoc.base.json"], - "entryPoints": ["src/network.ts"] -} \ No newline at end of file diff --git a/packages/thorest/tests/thor/blocks/RetrieveBlock.testnet.test.ts b/packages/thorest/tests/thor/blocks/RetrieveBlock.testnet.test.ts index 72f23683c..7d8264b6a 100644 --- a/packages/thorest/tests/thor/blocks/RetrieveBlock.testnet.test.ts +++ b/packages/thorest/tests/thor/blocks/RetrieveBlock.testnet.test.ts @@ -1,4 +1,4 @@ -import { describe, test } from '@jest/globals'; +import { describe, expect, test } from '@jest/globals'; import { FetchHttpClient, RetrieveRawBlock, diff --git a/packages/thorest/tests/thor/blocks/RetrieveExpandedBlock.unit.test.ts b/packages/thorest/tests/thor/blocks/RetrieveExpandedBlock.unit.test.ts index 31ec327b5..62e6148f1 100644 --- a/packages/thorest/tests/thor/blocks/RetrieveExpandedBlock.unit.test.ts +++ b/packages/thorest/tests/thor/blocks/RetrieveExpandedBlock.unit.test.ts @@ -1,4 +1,4 @@ -import { describe, test, expect } from '@jest/globals'; +import { describe, jest, test, expect } from '@jest/globals'; import { type FetchHttpClient } from '../../../src/http'; import { ExpandedBlockResponse, diff --git a/packages/thorest/tests/thor/blocks/RetrieveRawBlock.unit.test.ts b/packages/thorest/tests/thor/blocks/RetrieveRawBlock.unit.test.ts index aed60d5b9..1ff913b65 100644 --- a/packages/thorest/tests/thor/blocks/RetrieveRawBlock.unit.test.ts +++ b/packages/thorest/tests/thor/blocks/RetrieveRawBlock.unit.test.ts @@ -1,4 +1,4 @@ -import { describe, test, expect } from '@jest/globals'; +import { describe, test, expect, jest } from '@jest/globals'; import { type FetchHttpClient } from '../../../src/http'; import { type RawBlockResponseJSON, diff --git a/packages/thorest/tests/thor/blocks/RetrieveRegularBlock.unit.test.ts b/packages/thorest/tests/thor/blocks/RetrieveRegularBlock.unit.test.ts index e05956b40..067257f6c 100644 --- a/packages/thorest/tests/thor/blocks/RetrieveRegularBlock.unit.test.ts +++ b/packages/thorest/tests/thor/blocks/RetrieveRegularBlock.unit.test.ts @@ -1,4 +1,4 @@ -import { describe, test, expect } from '@jest/globals'; +import { describe, test, expect, jest } from '@jest/globals'; import { type FetchHttpClient } from '../../../src/http'; import { RetrieveRegularBlock, diff --git a/packages/thorest/tests/thor/logs/QuerySmartContractEvents.unit.test.ts b/packages/thorest/tests/thor/logs/QuerySmartContractEvents.unit.test.ts index d36214aa9..5a693f4b2 100644 --- a/packages/thorest/tests/thor/logs/QuerySmartContractEvents.unit.test.ts +++ b/packages/thorest/tests/thor/logs/QuerySmartContractEvents.unit.test.ts @@ -1,4 +1,4 @@ -import { describe, test } from '@jest/globals'; +import { describe, test, jest, expect } from '@jest/globals'; import { QuerySmartContractEvents } from '../../../src/thor/logs/QuerySmartContractEvents'; import { type EventLogFilterRequestJSON } from '../../../src/thor/logs/EventLogFilterRequest'; import { type FetchHttpClient } from '../../../src'; @@ -64,7 +64,7 @@ describe('QuerySmartContractEvents unit tests', () => { txIndex: 10 } } - ] satisfies EventLogsResponseJSON; + ] as unknown as EventLogsResponseJSON; const mockClient = mockHttpClient(mockResponse); diff --git a/packages/thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts b/packages/thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts index d7c61e9e1..73ce5ad36 100644 --- a/packages/thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts +++ b/packages/thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts @@ -1,4 +1,4 @@ -import { describe, test } from '@jest/globals'; +import { describe, expect, test, jest } from '@jest/globals'; import { QueryVETTransferEvents } from '../../../src/thor/logs/QueryVETTransferEvents'; import { type TransferLogFilterRequestJSON } from '../../../src/thor/logs/TransferLogFilterRequest'; import { type FetchHttpClient } from '../../../src'; diff --git a/packages/thorest/tests/thor/node/RetrieveConnectedPeers.unit.test.ts b/packages/thorest/tests/thor/node/RetrieveConnectedPeers.unit.test.ts index e260cc387..26bedc1fe 100644 --- a/packages/thorest/tests/thor/node/RetrieveConnectedPeers.unit.test.ts +++ b/packages/thorest/tests/thor/node/RetrieveConnectedPeers.unit.test.ts @@ -1,4 +1,4 @@ -import { describe, test } from '@jest/globals'; +import { describe, test, jest, expect } from '@jest/globals'; import { type FetchHttpClient, type PeerStatJSON, diff --git a/packages/thorest/tests/thor/subscriptions/BeatsSubscription.solo.test.ts b/packages/thorest/tests/thor/subscriptions/BeatsSubscription.solo.test.ts index 28572b9ad..443c89c07 100644 --- a/packages/thorest/tests/thor/subscriptions/BeatsSubscription.solo.test.ts +++ b/packages/thorest/tests/thor/subscriptions/BeatsSubscription.solo.test.ts @@ -1,4 +1,4 @@ -import { afterEach, beforeEach, describe } from '@jest/globals'; +import { afterEach, beforeEach, describe, test } from '@jest/globals'; import { MozillaWebSocketClient, type WebSocketListener diff --git a/packages/thorest/tests/thor/subscriptions/BlocksSubscription.solo.test.ts b/packages/thorest/tests/thor/subscriptions/BlocksSubscription.solo.test.ts index da30ba968..1be15b628 100644 --- a/packages/thorest/tests/thor/subscriptions/BlocksSubscription.solo.test.ts +++ b/packages/thorest/tests/thor/subscriptions/BlocksSubscription.solo.test.ts @@ -1,4 +1,4 @@ -import { afterEach, beforeEach, describe } from '@jest/globals'; +import { afterEach, beforeEach, describe, test } from '@jest/globals'; import { MozillaWebSocketClient, type WebSocketListener diff --git a/packages/thorest/tests/thor/subscriptions/NewTransactionSubscription.solo.test.ts b/packages/thorest/tests/thor/subscriptions/NewTransactionSubscription.solo.test.ts index d70ef1978..6a2aa372c 100644 --- a/packages/thorest/tests/thor/subscriptions/NewTransactionSubscription.solo.test.ts +++ b/packages/thorest/tests/thor/subscriptions/NewTransactionSubscription.solo.test.ts @@ -1,4 +1,4 @@ -import { afterEach, beforeEach, describe } from '@jest/globals'; +import { afterEach, beforeEach, describe, test } from '@jest/globals'; import { MozillaWebSocketClient, type WebSocketListener diff --git a/packages/thorest/tests/thor/transactions/EXP.solo.test.ts b/packages/thorest/tests/thor/transactions/EXP.solo.test.ts deleted file mode 100644 index 5e53a30d0..000000000 --- a/packages/thorest/tests/thor/transactions/EXP.solo.test.ts +++ /dev/null @@ -1,205 +0,0 @@ -import { describe, test } from '@jest/globals'; -import { - Address, - Clause, - HexUInt, - networkInfo, - Transaction, - type TransactionBody, - VET -} from '../../../../core/src'; -import { THOR_SOLO_URL, ThorClient } from '../../../../network/src'; - -import { secp256k1 as nc_secp256k1 } from '@noble/curves/secp256k1'; -import { Secp256k1 } from '@vechain/sdk-core'; - -describe('Solo Experiments', () => { - const thorClient = ThorClient.at(THOR_SOLO_URL + '/', { - isPollingEnabled: false - }); - const sender = { - privateKey: HexUInt.of( - 'ea5383ac1f9e625220039a4afac6a7f868bf1ad4f48ce3a1dd78bd214ee4ace5' - ), - address: Address.of('0x2669514f9fe96bc7301177ba774d3da8a06cace4') - }; - const receiver = { - address: Address.of('0x9e7911de289c3c856ce7f421034f66b6cde49c39') - }; - const gasPayer = { - privateKey: HexUInt.of( - '432f38bcf338c374523e83fdb2ebe1030aba63c7f1e81f7d76c5f53f4d42e766' - ), - address: Address.of('0x88b2551c3ed42ca663796c10ce68c88a65f73fe2') - }; - const OneVET = VET.of(1); - const clauses = [Clause.transferVET(receiver.address, OneVET)]; - - test('Delegated Tx', async () => { - const latestBlock = await thorClient.blocks.getBestBlockCompressed(); - console.log(latestBlock); - const gasToPay = await thorClient.gas.estimateGas( - clauses, - sender.address.toString() - ); - console.log(gasToPay); - const body: TransactionBody = { - chainTag: networkInfo.solo.chainTag, - blockRef: latestBlock?.id.slice(0, 18) ?? '0x0', - expiration: 0, - clauses, - gasPriceCoef: 0, - gas: gasToPay.totalGas, - dependsOn: null, - nonce: 2, - reserved: { - features: 1 // set the transaction to be delegated - } - }; - const tx = Transaction.of(body).signAsSenderAndGasPayer( - sender.privateKey.bytes, - gasPayer.privateKey.bytes - ); - console.log(tx.signature?.length); - const txResult = await thorClient.transactions.sendRawTransaction( - HexUInt.of(tx.encoded).toString() - ); - console.log(txResult); - const txReceipt = await thorClient.transactions.waitForTransaction( - tx.id.toString() - ); - console.log(txReceipt); - const txr = await thorClient.transactions.getTransaction( - tx.id.toString() - ); - console.log(txr); - }, 60000); - - test('NCC Tx', async () => { - const latestBlock = await thorClient.blocks.getBestBlockCompressed(); - const gasToPay = await thorClient.gas.estimateGas( - clauses, - sender.address.toString() - ); - const body: TransactionBody = { - chainTag: networkInfo.solo.chainTag, - blockRef: latestBlock?.id.slice(0, 18) ?? '0x0', - expiration: 0, - clauses, - gasPriceCoef: 0, - gas: gasToPay.totalGas, - dependsOn: null, - nonce: 1, - reserved: { - features: 1 // set the transaction to be delegated - } - }; - const tx = Transaction.of(body).signAsSenderAndGasPayer( - sender.privateKey.bytes, - gasPayer.privateKey.bytes - ); - // KEEP IT - // console.log(tx.signature?.length); - // const txResult = await thorClient.transactions.sendRawTransaction( - // HexUInt.of(tx.encoded).toString() - // ); - // console.log(txResult); - const aBody: TransactionBody = { - chainTag: networkInfo.solo.chainTag, - blockRef: latestBlock?.id.slice(0, 18) ?? '0x0', - expiration: 0, - clauses, - gasPriceCoef: 0, - gas: gasToPay.totalGas, - dependsOn: null, - nonce: 2, - reserved: { - features: 1 // set the transaction to be delegated - } - }; - const aTx = Transaction.of(aBody).signAsSender(sender.privateKey.bytes); - // KEEP IT - // const sig = nc_utils.concatBytes( - // aTx.signature as Uint8Array, - // (tx.signature as Uint8Array).slice(65) - // ); - const fTx = Transaction.of(aTx.body, tx.signature); - const fTxResult = await thorClient.transactions.sendRawTransaction( - HexUInt.of(fTx.encoded).toString() - ); - console.log(fTxResult); - }, 60000); - - test('verify', async () => { - const latestBlock = await thorClient.blocks.getBestBlockCompressed(); - const gasToPay = await thorClient.gas.estimateGas( - clauses, - sender.address.toString() - ); - // KEEP IT - // const senderPublicKey = Secp256k1.derivePublicKey( - // sender.privateKey.bytes, - // false - // ); - const gasPayerPublicKey = Secp256k1.derivePublicKey( - gasPayer.privateKey.bytes, - false - ); - const txA = Transaction.of({ - chainTag: networkInfo.solo.chainTag, - blockRef: latestBlock?.id.slice(0, 18) ?? '0x0', - expiration: 0, - clauses, - gasPriceCoef: 0, - gas: gasToPay.totalGas, - dependsOn: null, - nonce: 1, - reserved: { - features: 1 // set the transaction to be delegated - } - }); - const as = txA.signAsSender(sender.privateKey.bytes); - const ap = as.signAsGasPayer(sender.address, gasPayer.privateKey.bytes); - const sigmaA = nc_secp256k1.Signature.fromCompact( - ap.signature?.slice(-65).slice(0, 64) as Uint8Array - ); - const hashA = ap.getTransactionHash(sender.address).bytes; - const isVerifiedA = nc_secp256k1.verify( - sigmaA, - hashA, - gasPayerPublicKey - ); - console.log(isVerifiedA); - const txB = Transaction.of({ - chainTag: networkInfo.solo.chainTag, - blockRef: latestBlock?.id.slice(0, 18) ?? '0x0', - expiration: 0, - clauses, - gasPriceCoef: 0, - gas: gasToPay.totalGas, - dependsOn: null, - nonce: 2, - reserved: { - features: 1 // set the transaction to be delegated - } - }); - const bs = txB.signAsSender(sender.privateKey.bytes); - const bp = bs.signAsGasPayer(sender.address, gasPayer.privateKey.bytes); - const sigmaB = nc_secp256k1.Signature.fromCompact( - bp.signature?.slice(-65).slice(0, 64) as Uint8Array - ); - const hashB = bp.getTransactionHash(sender.address).bytes; - const isVerifiedB = nc_secp256k1.verify( - sigmaB, - hashB, - gasPayerPublicKey - ); - console.log(isVerifiedB); - const isVerifiedForge = nc_secp256k1.verify( - sigmaA, - hashB, - gasPayerPublicKey - ); - console.log(isVerifiedForge); - }); -}); diff --git a/packages/thorest/tests/thor/transactions/EXP.testnet.test.ts b/packages/thorest/tests/thor/transactions/EXP.testnet.test.ts deleted file mode 100644 index c24ab6755..000000000 --- a/packages/thorest/tests/thor/transactions/EXP.testnet.test.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { describe, test } from '@jest/globals'; -import { TESTNET_URL, ThorClient } from '../../../../network/src'; -import { - Address, - Clause, - HexUInt, - networkInfo, - Transaction, - type TransactionBody, - VET -} from '@vechain/sdk-core'; - -describe('Testnet Experiments', () => { - const thorClient = ThorClient.at(TESTNET_URL + '/', { - isPollingEnabled: false - }); - const sender = { - privateKey: HexUInt.of( - 'f9fc826b63a35413541d92d2bfb6661128cd5075fcdca583446d20c59994ba26' - ), - address: Address.of('0x7a28e7361fd10f4f058f9fefc77544349ecff5d6') - }; - const receiver = { - address: Address.of('0xb717b660cd51109334bd10b2c168986055f58c1a') - }; - const gasPayer = { - privateKey: HexUInt.of( - '521b7793c6eb27d137b617627c6b85d57c0aa303380e9ca4e30a30302fbc6676' - ), - address: Address.of('0x062F167A905C1484DE7e75B88EDC7439f82117DE') - }; - const OneVET = VET.of(1); - const clauses = [Clause.transferVET(receiver.address, OneVET)]; - - test('Delegated Tx', async () => { - const latestBlock = await thorClient.blocks.getBestBlockCompressed(); - console.log(latestBlock); - const gasToPay = await thorClient.transactions.estimateGas( - clauses, - gasPayer.address.toString() - ); - console.log(gasToPay); - const body: TransactionBody = { - chainTag: networkInfo.testnet.chainTag, - blockRef: latestBlock?.id.slice(0, 18) ?? '0x0', - expiration: 32, - clauses, - gasPriceCoef: 128, - gas: gasToPay.totalGas, - dependsOn: null, - // eslint-disable-next-line sonarjs/pseudo-random - nonce: Math.floor(1000000 * Math.random()), - reserved: { - features: 1 // set the transaction to be delegated - } - }; - const tx = Transaction.of(body).signAsSenderAndGasPayer( - sender.privateKey.bytes, - gasPayer.privateKey.bytes - ); - console.log('tx', tx); - const txResult = await thorClient.transactions.sendRawTransaction( - HexUInt.of(tx.encoded).toString() - ); - console.log(txResult); - const txReceipt = await thorClient.transactions.waitForTransaction( - tx.id.toString() - ); - console.log(txReceipt); - }, 60000); -}); diff --git a/packages/thorest/tests/thor/transactions/SendTransaction.solo.test.ts b/packages/thorest/tests/thor/transactions/SendTransaction.solo.test.ts deleted file mode 100644 index e5a60312f..000000000 --- a/packages/thorest/tests/thor/transactions/SendTransaction.solo.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { describe, test } from '@jest/globals'; - -import { THOR_SOLO_URL, ThorClient } from '../../../../network/src'; -import { - transfer1VTHOClause, - transferTransactionBody -} from '../../../../network/tests/thor-client/transactions/fixture'; -import { TEST_ACCOUNTS } from '../../../../network/tests/fixture'; -import { HexUInt, Transaction } from '@vechain/sdk-core'; -import { FetchHttpClient, SendTransaction } from '../../../src'; - -describe('SendTransaction solo tests', () => { - test('ok <- askTo', async () => { - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - const gasResult = await thorSoloClient.gas.estimateGas( - [transfer1VTHOClause], - TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address - ); - console.log(gasResult); - const tx = Transaction.of({ - ...transferTransactionBody, - gas: gasResult.totalGas, - nonce: 10000000 - }).sign( - HexUInt.of(TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.privateKey) - .bytes - ).encoded; - console.log(tx); - const r = await SendTransaction.of(tx).askTo( - FetchHttpClient.at(THOR_SOLO_URL) - ); - console.log(r); - }); -}); diff --git a/packages/thorest/tests/ws/MozillaWebSocketClient.solo.test.ts b/packages/thorest/tests/ws/MozillaWebSocketClient.solo.test.ts index 820ba56b3..0404cbff1 100644 --- a/packages/thorest/tests/ws/MozillaWebSocketClient.solo.test.ts +++ b/packages/thorest/tests/ws/MozillaWebSocketClient.solo.test.ts @@ -1,4 +1,4 @@ -import { afterEach, beforeEach, describe } from '@jest/globals'; +import { afterEach, beforeEach, describe, test } from '@jest/globals'; import { MozillaWebSocketClient } from '../../src/ws/MozillaWebSocketClient'; import { type WebSocketListener } from '../../src/ws'; diff --git a/packages/thorest/typedoc.json b/packages/thorest/typedoc.json index 664b688e4..d76647377 100644 --- a/packages/thorest/typedoc.json +++ b/packages/thorest/typedoc.json @@ -1,4 +1,4 @@ { "extends": ["../../typedoc.base.json"], - "entryPoints": ["src/network.ts"] -} \ No newline at end of file + "entryPoints": ["src/thorest.ts"] +} diff --git a/yarn.lock b/yarn.lock index c0943f300..36ace8c3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1139,11 +1139,6 @@ "@babel/helper-string-parser" "^7.25.9" "@babel/helper-validator-identifier" "^7.25.9" -"@balena/dockerignore@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@balena/dockerignore/-/dockerignore-1.0.2.tgz#9ffe4726915251e8eb69f44ef3547e0da2c03e0d" - integrity sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q== - "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -2403,16 +2398,6 @@ "@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.1.2" "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.2" -"@openzeppelin/contracts-upgradeable@5.0.2": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-5.0.2.tgz#3e5321a2ecdd0b206064356798c21225b6ec7105" - integrity sha512-0MmkHSHiW2NRFiT9/r5Lu4eJq5UJ4/tzlOgYXNAIj/ONkQTVnz22pLxDvp4C4uZ9he7ZFvGn3Driptn1/iU7tQ== - -"@openzeppelin/contracts@5.0.2": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.2.tgz#b1d03075e49290d06570b2fd42154d76c2a5d210" - integrity sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA== - "@pkgjs/parseargs@^0.11.0": version "0.11.0" resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" @@ -2761,21 +2746,6 @@ dependencies: "@types/node" "*" -"@types/body-parser@*": - version "1.19.5" - resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.5.tgz#04ce9a3b677dc8bd681a17da1ab9835dc9d3ede4" - integrity sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg== - dependencies: - "@types/connect" "*" - "@types/node" "*" - -"@types/connect@*": - version "3.4.38" - resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" - integrity sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug== - dependencies: - "@types/node" "*" - "@types/conventional-commits-parser@^5.0.0": version "5.0.0" resolved "https://registry.yarnpkg.com/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz#8c9d23e0b415b24b91626d07017303755d542dc8" @@ -2783,30 +2753,6 @@ dependencies: "@types/node" "*" -"@types/cors@^2.8.17": - version "2.8.17" - resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.17.tgz#5d718a5e494a8166f569d986794e49c48b216b2b" - integrity sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA== - dependencies: - "@types/node" "*" - -"@types/docker-modem@*": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@types/docker-modem/-/docker-modem-3.0.6.tgz#1f9262fcf85425b158ca725699a03eb23cddbf87" - integrity sha512-yKpAGEuKRSS8wwx0joknWxsmLha78wNMe9R2S3UNsVOkZded8UqOrV8KoeDXoXsjndxwyF3eIhyClGbO1SEhEg== - dependencies: - "@types/node" "*" - "@types/ssh2" "*" - -"@types/dockerode@^3.3.29": - version "3.3.31" - resolved "https://registry.yarnpkg.com/@types/dockerode/-/dockerode-3.3.31.tgz#27a192c134651d85afc658e4d3e7a805b865989e" - integrity sha512-42R9eoVqJDSvVspV89g7RwRqfNExgievLNWoHkg7NoWIqAmavIbgQBb4oc0qRtHkxE+I3Xxvqv7qVXFABKPBTg== - dependencies: - "@types/docker-modem" "*" - "@types/node" "*" - "@types/ssh2" "*" - "@types/eslint@^7.2.13": version "7.29.0" resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.29.0.tgz#e56ddc8e542815272720bb0b4ccc2aff9c3e1c78" @@ -2820,26 +2766,6 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== -"@types/express-serve-static-core@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.0.0.tgz#91f06cda1049e8f17eeab364798ed79c97488a1c" - integrity sha512-AbXMTZGt40T+KON9/Fdxx0B2WK5hsgxcfXJLr5bFpZ7b4JCex2WyQPTEKdXqfHiY5nKKBScZ7yCoO6Pvgxfvnw== - dependencies: - "@types/node" "*" - "@types/qs" "*" - "@types/range-parser" "*" - "@types/send" "*" - -"@types/express@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.0.tgz#13a7d1f75295e90d19ed6e74cab3678488eaa96c" - integrity sha512-DvZriSMehGHL1ZNLzi6MidnsDhUZM/x2pRdDIKdwbUNqqwHxMlRdkxtn6/EPKyqKpHqTl/4nRZsRNLpZxZRpPQ== - dependencies: - "@types/body-parser" "*" - "@types/express-serve-static-core" "^5.0.0" - "@types/qs" "*" - "@types/serve-static" "*" - "@types/fs-extra@^11.0.4": version "11.0.4" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-11.0.4.tgz#e16a863bb8843fba8c5004362b5a73e17becca45" @@ -2862,11 +2788,6 @@ dependencies: "@types/unist" "*" -"@types/http-errors@*": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.4.tgz#7eb47726c391b7345a6ec35ad7f4de469cf5ba4f" - integrity sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA== - "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.6" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" @@ -2924,17 +2845,12 @@ dependencies: "@types/unist" "*" -"@types/mime@^1": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" - integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== - "@types/minimist@^1.2.0": version "1.2.5" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== -"@types/node@*", "@types/node@^22.7.9": +"@types/node@*": version "22.7.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.9.tgz#2bf2797b5e84702d8262ea2cf843c3c3c880d0e9" integrity sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg== @@ -2958,13 +2874,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== -"@types/node@^18.11.18": - version "18.19.54" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.54.tgz#f1048dc083f81b242640f04f18fb3e4ccf13fcdb" - integrity sha512-+BRgt0G5gYjTvdLac9sIeE0iZcJxi4Jc4PV5EUzqi+88jmQLr+fRZdv2tCTV7IHKSGxM6SaLoOXQWWUiLUItMw== - dependencies: - undici-types "~5.26.4" - "@types/normalize-package-data@^2.4.0": version "2.4.4" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901" @@ -2977,16 +2886,6 @@ dependencies: "@types/node" "*" -"@types/qs@*": - version "6.9.16" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.16.tgz#52bba125a07c0482d26747d5d4947a64daf8f794" - integrity sha512-7i+zxXdPD0T4cKDuxCUXJ4wHcsJLwENa6Z3dCu8cfCK743OGy5Nu1RmAGqDPsoTDINVEcdXKRvR/zre+P2Ku1A== - -"@types/range-parser@*": - version "1.2.7" - resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" - integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== - "@types/secp256k1@^4.0.1": version "4.0.6" resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.6.tgz#d60ba2349a51c2cbc5e816dcd831a42029d376bf" @@ -2994,45 +2893,6 @@ dependencies: "@types/node" "*" -"@types/send@*": - version "0.17.4" - resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.4.tgz#6619cd24e7270793702e4e6a4b958a9010cfc57a" - integrity sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA== - dependencies: - "@types/mime" "^1" - "@types/node" "*" - -"@types/serve-static@*": - version "1.15.7" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.7.tgz#22174bbd74fb97fe303109738e9b5c2f3064f714" - integrity sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw== - dependencies: - "@types/http-errors" "*" - "@types/node" "*" - "@types/send" "*" - -"@types/ssh2-streams@*": - version "0.1.12" - resolved "https://registry.yarnpkg.com/@types/ssh2-streams/-/ssh2-streams-0.1.12.tgz#e68795ba2bf01c76b93f9c9809e1f42f0eaaec5f" - integrity sha512-Sy8tpEmCce4Tq0oSOYdfqaBpA3hDM8SoxoFh5vzFsu2oL+znzGz8oVWW7xb4K920yYMUY+PIG31qZnFMfPWNCg== - dependencies: - "@types/node" "*" - -"@types/ssh2@*": - version "1.15.1" - resolved "https://registry.yarnpkg.com/@types/ssh2/-/ssh2-1.15.1.tgz#4db4b6864abca09eb299fe5354fa591add412223" - integrity sha512-ZIbEqKAsi5gj35y4P4vkJYly642wIbY6PqoN0xiyQGshKUGXR9WQjF/iF9mXBQ8uBKy3ezfsCkcoHKhd0BzuDA== - dependencies: - "@types/node" "^18.11.18" - -"@types/ssh2@^0.5.48": - version "0.5.52" - resolved "https://registry.yarnpkg.com/@types/ssh2/-/ssh2-0.5.52.tgz#9dbd8084e2a976e551d5e5e70b978ed8b5965741" - integrity sha512-lbLLlXxdCZOSJMCInKH2+9V/77ET2J6NPQHpFI0kda61Dd1KglJs+fPQBchizmzYSOJBgdTajhPqBO1xxLywvg== - dependencies: - "@types/node" "*" - "@types/ssh2-streams" "*" - "@types/stack-utils@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" @@ -3330,15 +3190,6 @@ uuid "2.0.1" xmlhttprequest "1.8.0" -"@vechain/vebetterdao-contracts@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@vechain/vebetterdao-contracts/-/vebetterdao-contracts-4.1.0.tgz#5a081bf9c548ea777fe16dcab40536d6d2cc1a62" - integrity sha512-vLxxErpvHuVisrkgvrrqgz8hkhbhreEmOyjolcRGpYF9ozzhEm1wTZKelO9qmKoNi/mviMG6ZYZU3Ykwg9LfIw== - dependencies: - "@openzeppelin/contracts" "5.0.2" - "@openzeppelin/contracts-upgradeable" "5.0.2" - ethers "^6.9.0" - JSONStream@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -3362,21 +3213,6 @@ abitype@^1.0.6, abitype@^1.0.8: resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.8.tgz#3554f28b2e9d6e9f35eb59878193eabd1b9f46ba" integrity sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg== -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - -accepts@~1.3.8: - version "1.3.8" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" - integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== - dependencies: - mime-types "~2.1.34" - negotiator "0.6.3" - acorn-globals@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" @@ -3530,32 +3366,6 @@ append-transform@^2.0.0: dependencies: default-require-extensions "^3.0.0" -archiver-utils@^5.0.0, archiver-utils@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/archiver-utils/-/archiver-utils-5.0.2.tgz#63bc719d951803efc72cf961a56ef810760dd14d" - integrity sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA== - dependencies: - glob "^10.0.0" - graceful-fs "^4.2.0" - is-stream "^2.0.1" - lazystream "^1.0.0" - lodash "^4.17.15" - normalize-path "^3.0.0" - readable-stream "^4.0.0" - -archiver@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/archiver/-/archiver-7.0.1.tgz#c9d91c350362040b8927379c7aa69c0655122f61" - integrity sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ== - dependencies: - archiver-utils "^5.0.2" - async "^3.2.4" - buffer-crc32 "^1.0.0" - readable-stream "^4.0.0" - readdir-glob "^1.1.2" - tar-stream "^3.0.0" - zip-stream "^6.0.1" - archy@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" @@ -3586,11 +3396,6 @@ array-buffer-byte-length@^1.0.1: call-bind "^1.0.5" is-array-buffer "^3.0.4" -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - array-ify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" @@ -3687,24 +3492,12 @@ arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== -asn1@^0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - ast-types-flow@^0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.8.tgz#0a85e1c92695769ac13a428bb653e7538bea27d6" integrity sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ== -async-lock@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/async-lock/-/async-lock-1.4.1.tgz#56b8718915a9b68b10fce2f2a9a3dddf765ef53f" - integrity sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ== - -async@^3.2.3, async@^3.2.4: +async@^3.2.3: version "3.2.6" resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== @@ -3731,11 +3524,6 @@ axobject-query@^4.1.0: resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-4.1.0.tgz#28768c76d0e3cff21bc62a9e2d0b6ac30042a1ee" integrity sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ== -b4a@^1.6.4, b4a@^1.6.6: - version "1.6.7" - resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.6.7.tgz#a99587d4ebbfbd5a6e3b21bdb5d5fa385767abe4" - integrity sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg== - babel-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" @@ -3828,40 +3616,6 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -bare-events@^2.0.0, bare-events@^2.2.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/bare-events/-/bare-events-2.5.0.tgz#305b511e262ffd8b9d5616b056464f8e1b3329cc" - integrity sha512-/E8dDe9dsbLyh2qrZ64PEPadOQ0F4gbl1sUJOrmph7xOiIxfY8vwab/4bFLh4Y88/Hk/ujKcrQKc+ps0mv873A== - -bare-fs@^2.1.1: - version "2.3.5" - resolved "https://registry.yarnpkg.com/bare-fs/-/bare-fs-2.3.5.tgz#05daa8e8206aeb46d13c2fe25a2cd3797b0d284a" - integrity sha512-SlE9eTxifPDJrT6YgemQ1WGFleevzwY+XAP1Xqgl56HtcrisC2CHCZ2tq6dBpcH2TnNxwUEUGhweo+lrQtYuiw== - dependencies: - bare-events "^2.0.0" - bare-path "^2.0.0" - bare-stream "^2.0.0" - -bare-os@^2.1.0: - version "2.4.4" - resolved "https://registry.yarnpkg.com/bare-os/-/bare-os-2.4.4.tgz#01243392eb0a6e947177bb7c8a45123d45c9b1a9" - integrity sha512-z3UiI2yi1mK0sXeRdc4O1Kk8aOa/e+FNWZcTiPB/dfTWyLypuE99LibgRaQki914Jq//yAWylcAt+mknKdixRQ== - -bare-path@^2.0.0, bare-path@^2.1.0: - version "2.1.3" - resolved "https://registry.yarnpkg.com/bare-path/-/bare-path-2.1.3.tgz#594104c829ef660e43b5589ec8daef7df6cedb3e" - integrity sha512-lh/eITfU8hrj9Ru5quUp0Io1kJWIk1bTjzo7JH1P5dWmQ2EL4hFUlfI8FonAhSlgIfhn63p84CDY/x+PisgcXA== - dependencies: - bare-os "^2.1.0" - -bare-stream@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.3.0.tgz#5bef1cab8222517315fca1385bd7f08dff57f435" - integrity sha512-pVRWciewGUeCyKEuRxwv06M079r+fRjAQjBEK2P6OYGrO43O+Z0LrPZZEjlc4mB6C2RpZ9AxJ1s7NLEtOHO6eA== - dependencies: - b4a "^1.6.6" - streamx "^2.20.0" - base-x@^3.0.2: version "3.0.10" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.10.tgz#62de58653f8762b5d6f8d9fe30fa75f7b2585a75" @@ -3869,18 +3623,6 @@ base-x@^3.0.2: dependencies: safe-buffer "^5.0.1" -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bcrypt-pbkdf@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - better-path-resolve@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/better-path-resolve/-/better-path-resolve-1.0.0.tgz#13a35a1104cdd48a7b74bf8758f96a1ee613f99d" @@ -3903,15 +3645,6 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== -bl@^4.0.3: - version "4.1.0" - resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" - integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== - dependencies: - buffer "^5.5.0" - inherits "^2.0.4" - readable-stream "^3.4.0" - blakejs@^1.1.0, blakejs@^1.1.2: version "1.2.1" resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" @@ -3927,24 +3660,6 @@ bn.js@^5.2.0, bn.js@^5.2.1: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== -body-parser@1.20.3: - version "1.20.3" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" - integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g== - dependencies: - bytes "3.1.2" - content-type "~1.0.5" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.13.0" - raw-body "2.5.2" - type-is "~1.6.18" - unpipe "1.0.0" - boxen@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.1.2.tgz#788cb686fc83c1f486dfa8a40c68fc2b831d2b50" @@ -4053,11 +3768,6 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" -buffer-crc32@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-1.0.0.tgz#a10993b9055081d55304bd9feb4a072de179f405" - integrity sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w== - buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" @@ -4068,27 +3778,6 @@ buffer-xor@^1.0.3: resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== -buffer@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - -buffer@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - -buildcheck@~0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/buildcheck/-/buildcheck-0.0.6.tgz#89aa6e417cfd1e2196e3f8fe915eb709d2fe4238" - integrity sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A== - builtin-modules@3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" @@ -4101,11 +3790,6 @@ bundle-require@^5.0.0: dependencies: load-tsconfig "^0.2.3" -byline@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" - integrity sha512-s6webAy+R4SR8XVuJWt2V2rGvhnrhxN+9S15GNuTK3wKPOXFF6RNc+8ug2XhH+2s4f+uudG4kUVYmYOQWL2g0Q== - bytes@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" @@ -4235,11 +3919,6 @@ chokidar@^4.0.0, chokidar@^4.0.1: dependencies: readdirp "^4.0.1" -chownr@^1.1.1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" - integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== - ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -4351,11 +4030,6 @@ command-exists@^1.2.8: resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== -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" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" @@ -4379,17 +4053,6 @@ compare-func@^2.0.0: array-ify "^1.0.0" dot-prop "^5.1.0" -compress-commons@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/compress-commons/-/compress-commons-6.0.2.tgz#26d31251a66b9d6ba23a84064ecd3a6a71d2609e" - integrity sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg== - dependencies: - crc-32 "^1.2.0" - crc32-stream "^6.0.0" - is-stream "^2.0.1" - normalize-path "^3.0.0" - readable-stream "^4.0.0" - concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -4400,18 +4063,6 @@ consola@^3.2.3: resolved "https://registry.yarnpkg.com/consola/-/consola-3.2.3.tgz#0741857aa88cfa0d6fd53f1cff0375136e98502f" integrity sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ== -content-disposition@0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" - integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== - dependencies: - safe-buffer "5.2.1" - -content-type@~1.0.4, content-type@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== - conventional-changelog-angular@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz#5eec8edbff15aa9b1680a8dcfbd53e2d7eb2ba7a" @@ -4446,16 +4097,6 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - -cookie@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.1.tgz#2f73c42142d5d5cf71310a74fc4ae61670e5dbc9" - integrity sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w== - cookie@^0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" @@ -4468,19 +4109,6 @@ core-js-compat@^3.31.0, core-js-compat@^3.38.0: dependencies: browserslist "^4.24.2" -core-util-is@~1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" - integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== - -cors@^2.8.5: - version "2.8.5" - resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" - integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== - dependencies: - object-assign "^4" - vary "^1" - cosmiconfig-typescript-loader@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-6.1.0.tgz#7f644503e1c2bff90aed2d29a637008f279646bb" @@ -4498,27 +4126,6 @@ cosmiconfig@^9.0.0: js-yaml "^4.1.0" parse-json "^5.2.0" -cpu-features@~0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/cpu-features/-/cpu-features-0.0.10.tgz#9aae536db2710c7254d7ed67cb3cbc7d29ad79c5" - integrity sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA== - dependencies: - buildcheck "~0.0.6" - nan "^2.19.0" - -crc-32@^1.2.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" - integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== - -crc32-stream@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/crc32-stream/-/crc32-stream-6.0.0.tgz#8529a3868f8b27abb915f6c3617c0fadedbf9430" - integrity sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g== - dependencies: - crc-32 "^1.2.0" - readable-stream "^4.0.0" - create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" @@ -4555,13 +4162,6 @@ create-jest@^29.7.0: jest-util "^29.7.0" prompts "^2.0.1" -cross-env@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" - integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== - dependencies: - cross-spawn "^7.0.1" - cross-fetch@^3.0.4: version "3.1.8" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" @@ -4569,7 +4169,7 @@ cross-fetch@^3.0.4: dependencies: node-fetch "^2.6.12" -cross-spawn@^5.1.0, cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3, cross-spawn@^7.0.5: +cross-spawn@^5.1.0, cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3, cross-spawn@^7.0.5: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== @@ -4641,13 +4241,6 @@ data-view-byte-offset@^1.0.0: es-errors "^1.3.0" is-data-view "^1.0.1" -debug@2.6.9: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5, debug@^4.3.7: version "4.3.7" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" @@ -4740,11 +4333,6 @@ dequal@^2.0.0: resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - detect-indent@^6.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" @@ -4779,32 +4367,6 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -docker-compose@^0.24.8: - version "0.24.8" - resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.24.8.tgz#6c125e6b9e04cf68ced47e2596ef2bb93ee9694e" - integrity sha512-plizRs/Vf15H+GCVxq2EUvyPK7ei9b/cVesHvjnX4xaXjM9spHe2Ytq0BitndFgvTJ3E3NljPNUEl7BAN43iZw== - dependencies: - yaml "^2.2.2" - -docker-modem@^3.0.0: - version "3.0.8" - resolved "https://registry.yarnpkg.com/docker-modem/-/docker-modem-3.0.8.tgz#ef62c8bdff6e8a7d12f0160988c295ea8705e77a" - integrity sha512-f0ReSURdM3pcKPNS30mxOHSbaFLcknGmQjwSfmbcdOw1XWKXVhukM3NJHhr7NpY9BIyyWQb0EBo3KQvvuU5egQ== - dependencies: - debug "^4.1.1" - readable-stream "^3.5.0" - split-ca "^1.0.1" - ssh2 "^1.11.0" - -dockerode@^3.3.5: - version "3.3.5" - resolved "https://registry.yarnpkg.com/dockerode/-/dockerode-3.3.5.tgz#7ae3f40f2bec53ae5e9a741ce655fff459745629" - integrity sha512-/0YNa3ZDNeLr/tSckmD69+Gq+qVNhvKfAHNeZJBnp7EOP6RGKV8ORrJHkUn20So5wU+xxT7+1n5u8PjHbfjbSA== - dependencies: - "@balena/dockerignore" "^1.0.2" - docker-modem "^3.0.0" - tar-fs "~2.0.1" - doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" @@ -4831,11 +4393,6 @@ eastasianwidth@^0.2.0: resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - ejs@^3.1.10: version "3.1.10" resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b" @@ -4894,23 +4451,6 @@ emoji-regex@^9.2.2: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - -encodeurl@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58" - integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg== - -end-of-stream@^1.1.0, end-of-stream@^1.4.1: - version "1.4.4" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" - integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== - dependencies: - once "^1.4.0" - enhanced-resolve@^5.17.1: version "5.17.1" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" @@ -5101,11 +4641,6 @@ escalade@^3.1.1, escalade@^3.2.0: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -5484,11 +5019,6 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -5541,7 +5071,7 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: ethjs-util "0.1.6" rlp "^2.2.3" -ethers@6.13.5, ethers@^6.9.0: +ethers@6.13.5: version "6.13.5" resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.5.tgz#8c1d6ac988ac08abc3c1d8fabbd4b8b602851ac4" integrity sha512-+knKNieu5EKRThQJWwqaJ10a6HE9sSehGeqWN65//wE7j47ZpFhKAnHB/JJFibwwg61I/koxaPsXbXpD/skNOQ== @@ -5562,21 +5092,11 @@ ethjs-util@0.1.6, ethjs-util@^0.1.6: is-hex-prefixed "1.0.0" strip-hex-prefix "1.0.0" -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - eventemitter3@5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== -events@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" - integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== - evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" @@ -5616,43 +5136,6 @@ expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -express@^4.21.2: - version "4.21.2" - resolved "https://registry.npmjs.org/express/-/express-4.21.2.tgz#cf250e48362174ead6cea4a566abef0162c1ec32" - integrity sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA== - dependencies: - accepts "~1.3.8" - array-flatten "1.1.1" - body-parser "1.20.3" - content-disposition "0.5.4" - content-type "~1.0.4" - cookie "0.7.1" - cookie-signature "1.0.6" - debug "2.6.9" - depd "2.0.0" - encodeurl "~2.0.0" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.3.1" - fresh "0.5.2" - http-errors "2.0.0" - merge-descriptors "1.0.3" - methods "~1.1.2" - on-finished "2.4.1" - parseurl "~1.3.3" - path-to-regexp "0.1.12" - proxy-addr "~2.0.7" - qs "6.13.0" - range-parser "~1.2.1" - safe-buffer "5.2.1" - send "0.19.0" - serve-static "1.16.2" - setprototypeof "1.2.0" - statuses "2.0.1" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - extendable-error@^0.1.5: version "0.1.7" resolved "https://registry.yarnpkg.com/extendable-error/-/extendable-error-0.1.7.tgz#60b9adf206264ac920058a7395685ae4670c2b96" @@ -5677,11 +5160,6 @@ fast-diff@^1.1.2: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-fifo@^1.2.0, fast-fifo@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" - integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== - fast-glob@^3.2.9, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -5748,19 +5226,6 @@ fill-range@^7.1.1: dependencies: to-regex-range "^5.0.1" -finalhandler@1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.1.tgz#0c575f1d1d324ddd1da35ad7ece3df7d19088019" - integrity sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ== - dependencies: - debug "2.6.9" - encodeurl "~2.0.0" - escape-html "~1.0.3" - on-finished "2.4.1" - parseurl "~1.3.3" - statuses "2.0.1" - unpipe "~1.0.0" - find-cache-dir@^3.2.0: version "3.3.2" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.2.tgz#b30c5b6eff0730731aea9bbd9dbecbd80256d64b" @@ -5857,11 +5322,6 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - fp-ts@1.19.3: version "1.19.3" resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-1.19.3.tgz#261a60d1088fbff01f91256f91d21d0caaaaa96f" @@ -5872,21 +5332,11 @@ fp-ts@^1.0.0: resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-1.19.5.tgz#3da865e585dfa1fdfd51785417357ac50afc520a" integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - fromentries@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a" integrity sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg== -fs-constants@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" - integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== - fs-extra@^11.2.0: version "11.2.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" @@ -5975,11 +5425,6 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-port@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193" - integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ== - get-stream@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" @@ -6036,7 +5481,7 @@ glob@7.2.0: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^10.0.0, glob@^10.3.10, glob@^10.4.2: +glob@^10.3.10, glob@^10.4.2: version "10.4.5" resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== @@ -6388,11 +5833,6 @@ iconv-lite@0.6.3: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -ieee754@^1.1.13, ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - ignore@^5.2.0, ignore@^5.3.1, ignore@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" @@ -6442,7 +5882,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -6468,11 +5908,6 @@ io-ts@1.10.4: dependencies: fp-ts "^1.0.0" -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - irregular-plurals@^3.2.0: version "3.5.0" resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-3.5.0.tgz#0835e6639aa8425bdc8b0d33d0dc4e89d9c01d2b" @@ -6649,7 +6084,7 @@ is-shared-array-buffer@^1.0.2, is-shared-array-buffer@^1.0.3: dependencies: call-bind "^1.0.7" -is-stream@^2.0.0, is-stream@^2.0.1: +is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== @@ -6729,21 +6164,11 @@ isarray@^2.0.5: resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -isomorphic-ws@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" - integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== - isows@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.6.tgz#0da29d706fa51551c663c627ace42769850f86e7" @@ -7434,13 +6859,6 @@ language-tags@^1.0.9: dependencies: language-subtag-registry "^0.3.20" -lazystream@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.1.tgz#494c831062f1f9408251ec44db1cba29242a2638" - integrity sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw== - dependencies: - readable-stream "^2.0.5" - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -7570,7 +6988,7 @@ lodash.upperfirst@^4.3.1: resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" integrity sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg== -lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.21: +lodash@^4.17.11, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -7696,11 +7114,6 @@ mdurl@^2.0.0: resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0" integrity sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w== -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - memorystream@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" @@ -7729,11 +7142,6 @@ meow@^9.0.0: type-fest "^0.18.0" yargs-parser "^20.2.3" -merge-descriptors@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz#d80319a65f3c7935351e5cfdac8f9318504dbed5" - integrity sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ== - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -7744,11 +7152,6 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - micromark-util-character@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-2.1.0.tgz#31320ace16b4644316f6bf057531689c71e2aee1" @@ -7794,18 +7197,13 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" -mime@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -7840,7 +7238,7 @@ minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" -minimatch@^5.0.1, minimatch@^5.1.0, minimatch@^5.1.6: +minimatch@^5.0.1, minimatch@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== @@ -7873,11 +7271,6 @@ minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.8: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== -mkdirp-classic@^0.5.2: - version "0.5.3" - resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" - integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== - mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" @@ -7921,12 +7314,7 @@ mri@^1.2.0: resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - -ms@2.1.3, ms@^2.1.1, ms@^2.1.3: +ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -7940,21 +7328,11 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@^2.19.0, nan@^2.20.0: - version "2.20.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.20.0.tgz#08c5ea813dd54ed16e5bd6505bf42af4f7838ca3" - integrity sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -negotiator@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" - integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== - node-addon-api@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" @@ -8064,7 +7442,7 @@ nyc@^17.1.0: test-exclude "^6.0.0" yargs "^15.0.2" -object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.1: +object-assign@^4.0.1, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== @@ -8131,14 +7509,7 @@ obliterator@^2.0.0: resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816" integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ== -on-finished@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - -once@^1.3.0, once@^1.3.1, once@^1.4.0: +once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== @@ -8330,11 +7701,6 @@ parse5@^7.0.0, parse5@^7.1.1: dependencies: entities "^4.4.0" -parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -8373,11 +7739,6 @@ path-scurry@^1.11.1: lru-cache "^10.2.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" -path-to-regexp@0.1.12: - version "0.1.12" - resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7" - integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ== - path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -8476,11 +7837,6 @@ pretty-format@^29.7.0: ansi-styles "^5.0.0" react-is "^18.0.0" -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - process-on-spawn@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/process-on-spawn/-/process-on-spawn-1.0.0.tgz#95b05a23073d30a17acfdc92a440efd2baefdc93" @@ -8488,11 +7844,6 @@ process-on-spawn@^1.0.0: dependencies: fromentries "^1.2.0" -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== - promise-polyfill@^8.1.3: version "8.3.0" resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.3.0.tgz#9284810268138d103807b11f4e23d5e945a4db63" @@ -8515,48 +7866,16 @@ prop-types@^15.8.1: object-assign "^4.1.1" react-is "^16.13.1" -proper-lockfile@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-4.1.2.tgz#c8b9de2af6b2f1601067f98e01ac66baa223141f" - integrity sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA== - dependencies: - graceful-fs "^4.2.4" - retry "^0.12.0" - signal-exit "^3.0.2" - -properties-reader@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/properties-reader/-/properties-reader-2.3.0.tgz#f3ab84224c9535a7a36e011ae489a79a13b472b2" - integrity sha512-z597WicA7nDZxK12kZqHr2TcvwNU1GCfA5UwfDY/HDp3hXPoPlb5rlEx9bwGTiJnc0OqbBTkU975jDToth8Gxw== - dependencies: - mkdirp "^1.0.4" - property-information@^6.0.0: version "6.5.0" resolved "https://registry.yarnpkg.com/property-information/-/property-information-6.5.0.tgz#6212fbb52ba757e92ef4fb9d657563b933b7ffec" integrity sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig== -proxy-addr@~2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" - psl@^1.1.33: version "1.9.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== -pump@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.2.tgz#836f3edd6bc2ee599256c924ffe0d88573ddcbf8" - integrity sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - punycode.js@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode.js/-/punycode.js-2.3.1.tgz#6b53e56ad75588234e79f4affa90972c7dd8cdb7" @@ -8572,13 +7891,6 @@ pure-rand@^6.0.0: resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== -qs@6.13.0: - version "6.13.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" - integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== - dependencies: - side-channel "^1.0.6" - querystringify@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" @@ -8589,11 +7901,6 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -queue-tick@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/queue-tick/-/queue-tick-1.0.1.tgz#f6f07ac82c1fd60f82e098b417a80e52f1f4c142" - integrity sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag== - quick-lru@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" @@ -8606,12 +7913,7 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.5.2, raw-body@^2.4.1: +raw-body@^2.4.1: version "2.5.2" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== @@ -8660,20 +7962,7 @@ read-yaml-file@^1.1.0: pify "^4.0.1" strip-bom "^3.0.0" -readable-stream@^2.0.5: - version "2.3.8" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" - integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: +readable-stream@^3.6.0: version "3.6.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== @@ -8682,24 +7971,6 @@ readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable string_decoder "^1.1.1" util-deprecate "^1.0.1" -readable-stream@^4.0.0: - version "4.5.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.5.2.tgz#9e7fc4c45099baeed934bff6eb97ba6cf2729e09" - integrity sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g== - dependencies: - abort-controller "^3.0.0" - buffer "^6.0.3" - events "^3.3.0" - process "^0.11.10" - string_decoder "^1.3.0" - -readdir-glob@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/readdir-glob/-/readdir-glob-1.1.3.tgz#c3d831f51f5e7bfa62fa2ffbe4b508c640f09584" - integrity sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA== - dependencies: - minimatch "^5.1.0" - readdirp@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.0.2.tgz#388fccb8b75665da3abffe2d8f8ed59fe74c230a" @@ -8895,11 +8166,6 @@ resolve@^2.0.0-next.5: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -retry@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" - integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== - reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -8972,16 +8238,11 @@ safe-array-concat@^1.1.2: has-symbols "^1.0.3" isarray "^2.0.5" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - safe-regex-test@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.3.tgz#a5b4c0f06e0ab50ea2c395c14d8371232924c377" @@ -8998,7 +8259,7 @@ safe-regex@^2.1.1: dependencies: regexp-tree "~0.1.1" -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -9060,25 +8321,6 @@ semver@^7.3.4, semver@^7.3.6, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semve resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== -send@0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" - integrity sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw== - dependencies: - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" - mime "1.6.0" - ms "2.1.3" - on-finished "2.4.1" - range-parser "~1.2.1" - statuses "2.0.1" - serialize-javascript@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" @@ -9086,16 +8328,6 @@ serialize-javascript@^6.0.2: dependencies: randombytes "^2.1.0" -serve-static@1.16.2: - version "1.16.2" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.2.tgz#b6a5343da47f6bdd2673848bf45754941e803296" - integrity sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw== - dependencies: - encodeurl "~2.0.0" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.19.0" - set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -9292,11 +8524,6 @@ spdx-license-ids@^3.0.0: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.20.tgz#e44ed19ed318dd1e5888f93325cee800f0f51b89" integrity sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw== -split-ca@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/split-ca/-/split-ca-1.0.1.tgz#6c83aff3692fa61256e0cd197e05e9de157691a6" - integrity sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ== - split2@^4.0.0: version "4.2.0" resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" @@ -9307,25 +8534,6 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -ssh-remote-port-forward@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/ssh-remote-port-forward/-/ssh-remote-port-forward-1.0.4.tgz#72b0c5df8ec27ca300c75805cc6b266dee07e298" - integrity sha512-x0LV1eVDwjf1gmG7TTnfqIzf+3VPRz7vrNIjX6oYLbeCrf/PeVY6hkT68Mg+q02qXxQhrLjB0jfgvhevoCRmLQ== - dependencies: - "@types/ssh2" "^0.5.48" - ssh2 "^1.4.0" - -ssh2@^1.11.0, ssh2@^1.4.0: - version "1.16.0" - resolved "https://registry.yarnpkg.com/ssh2/-/ssh2-1.16.0.tgz#79221d40cbf4d03d07fe881149de0a9de928c9f0" - integrity sha512-r1X4KsBGedJqo7h8F5c4Ybpcr5RjyP+aWIG007uBPRjmdQWfEiVLzSK71Zji1B9sKxwaCvD8y8cwSkYrlLiRRg== - dependencies: - asn1 "^0.2.6" - bcrypt-pbkdf "^1.0.2" - optionalDependencies: - cpu-features "~0.0.10" - nan "^2.20.0" - stack-utils@^2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" @@ -9345,17 +8553,6 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -streamx@^2.15.0, streamx@^2.20.0: - version "2.20.1" - resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.20.1.tgz#471c4f8b860f7b696feb83d5b125caab2fdbb93c" - integrity sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA== - dependencies: - fast-fifo "^1.3.2" - queue-tick "^1.0.1" - text-decoder "^1.1.0" - optionalDependencies: - bare-events "^2.2.0" - string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -9454,20 +8651,13 @@ string.prototype.trimstart@^1.0.8: define-properties "^1.2.1" es-object-atoms "^1.0.0" -string_decoder@^1.1.1, string_decoder@^1.3.0: +string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== dependencies: safe-buffer "~5.2.0" -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - stringify-entities@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/stringify-entities/-/stringify-entities-4.0.4.tgz#b3b79ef5f277cc4ac73caeb0236c5ba939b3a4f3" @@ -9596,47 +8786,6 @@ tapable@^2.2.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== -tar-fs@^3.0.6: - version "3.0.6" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.0.6.tgz#eaccd3a67d5672f09ca8e8f9c3d2b89fa173f217" - integrity sha512-iokBDQQkUyeXhgPYaZxmczGPhnhXZ0CmrqI+MOb/WFGS9DW5wnfrLgtjUJBvz50vQ3qfRwJ62QVoCFu8mPVu5w== - dependencies: - pump "^3.0.0" - tar-stream "^3.1.5" - optionalDependencies: - bare-fs "^2.1.1" - bare-path "^2.1.0" - -tar-fs@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.0.1.tgz#e44086c1c60d31a4f0cf893b1c4e155dabfae9e2" - integrity sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA== - dependencies: - chownr "^1.1.1" - mkdirp-classic "^0.5.2" - pump "^3.0.0" - tar-stream "^2.0.0" - -tar-stream@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" - integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== - dependencies: - bl "^4.0.3" - end-of-stream "^1.4.1" - fs-constants "^1.0.0" - inherits "^2.0.3" - readable-stream "^3.1.1" - -tar-stream@^3.0.0, tar-stream@^3.1.5: - version "3.1.7" - resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.1.7.tgz#24b3fb5eabada19fe7338ed6d26e5f7c482e792b" - integrity sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ== - dependencies: - b4a "^1.6.4" - fast-fifo "^1.2.0" - streamx "^2.15.0" - term-size@^2.1.0: version "2.2.1" resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.1.tgz#2a6a54840432c2fb6320fea0f415531e90189f54" @@ -9651,34 +8800,6 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" -testcontainers@^10.14.0: - version "10.14.0" - resolved "https://registry.yarnpkg.com/testcontainers/-/testcontainers-10.14.0.tgz#99cfbbf1b62c7c6c67a8130687aabc6e67d5ed06" - integrity sha512-8fReFeQ4bk17T2vHHzcFavBG8UHuHwsdVj+48TchtsCSklwmSUTkg/b57hVjxZdxN1ed/GfF63WZ39I4syV5tQ== - dependencies: - "@balena/dockerignore" "^1.0.2" - "@types/dockerode" "^3.3.29" - archiver "^7.0.1" - async-lock "^1.4.1" - byline "^5.0.0" - debug "^4.3.5" - docker-compose "^0.24.8" - dockerode "^3.3.5" - get-port "^5.1.1" - proper-lockfile "^4.1.2" - properties-reader "^2.3.0" - ssh-remote-port-forward "^1.0.4" - tar-fs "^3.0.6" - tmp "^0.2.3" - undici "^5.28.4" - -text-decoder@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.0.tgz#85f19d4d5088e0b45cd841bdfaeac458dbffeefc" - integrity sha512-n1yg1mOj9DNpk3NeZOx7T6jchTbyJS3i3cucbNN6FcdPriMZx7NsgrGpWWdWZZGxD7ES1XB+3uoqHMgOKaN+fg== - dependencies: - b4a "^1.6.4" - text-extensions@^2.0.0: version "2.4.0" resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-2.4.0.tgz#a1cfcc50cf34da41bfd047cc744f804d1680ea34" @@ -9741,11 +8862,6 @@ tmp@0.0.33, tmp@^0.0.33: dependencies: os-tmpdir "~1.0.2" -tmp@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.3.tgz#eb783cc22bc1e8bebd0671476d46ea4eb32a79ae" - integrity sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w== - tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -9949,11 +9065,6 @@ tweetnacl-util@^0.15.1: resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz#b80fcdb5c97bcc508be18c44a4be50f022eea00b" integrity sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw== -tweetnacl@^0.14.3: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== - tweetnacl@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" @@ -10001,14 +9112,6 @@ type-fest@^0.8.0, type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - typed-array-buffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3" @@ -10105,17 +9208,12 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - undici-types@~6.19.2: version "6.19.8" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== -undici@^5.14.0, undici@^5.28.4, undici@^5.28.5: +undici@^5.14.0, undici@^5.28.5: version "5.28.5" resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.5.tgz#b2b94b6bf8f1d919bc5a6f31f2c01deb02e54d4b" integrity sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA== @@ -10203,7 +9301,7 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unpipe@1.0.0, unpipe@~1.0.0: +unpipe@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== @@ -10231,16 +9329,11 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -util-deprecate@^1.0.1, util-deprecate@~1.0.1: +util-deprecate@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - uuid@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.1.tgz#c2a30dedb3e535d72ccf82e343941a50ba8533ac" @@ -10268,11 +9361,6 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== - vfile-message@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-4.0.2.tgz#c883c9f677c72c166362fd635f21fc165a7d1181" @@ -10580,7 +9668,7 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^2.2.2, yaml@^2.5.1: +yaml@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130" integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q== @@ -10666,15 +9754,6 @@ yocto-queue@^1.0.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.1.1.tgz#fef65ce3ac9f8a32ceac5a634f74e17e5b232110" integrity sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g== -zip-stream@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-6.0.1.tgz#e141b930ed60ccaf5d7fa9c8260e0d1748a2bbfb" - integrity sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA== - dependencies: - archiver-utils "^5.0.0" - compress-commons "^6.0.2" - readable-stream "^4.0.0" - zwitch@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-2.0.4.tgz#c827d4b0acb76fc3e685a4c6ec2902d51070e9d7" From ea92bff4b0b4dde381abc3fb4ef1b83a64f154b8 Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Thu, 6 Mar 2025 19:09:04 +0000 Subject: [PATCH 12/15] refactor: 1886 `network` module removed --- .../tests/thor/logs/QuerySmartContractEvents.unit.test.ts | 2 +- .../thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/thorest/tests/thor/logs/QuerySmartContractEvents.unit.test.ts b/packages/thorest/tests/thor/logs/QuerySmartContractEvents.unit.test.ts index 5a693f4b2..251324268 100644 --- a/packages/thorest/tests/thor/logs/QuerySmartContractEvents.unit.test.ts +++ b/packages/thorest/tests/thor/logs/QuerySmartContractEvents.unit.test.ts @@ -70,7 +70,7 @@ describe('QuerySmartContractEvents unit tests', () => { const response = await QuerySmartContractEvents.of(request).askTo(mockClient); - expect(response.response.toJSON()).toMatchObject( + expect(response.response.toJSON()).toEqual( new EventLogsResponse(mockResponse).toJSON() ); }); diff --git a/packages/thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts b/packages/thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts index 73ce5ad36..114056dd4 100644 --- a/packages/thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts +++ b/packages/thorest/tests/thor/logs/QueryVETTransferEvents.unit.test.ts @@ -71,7 +71,7 @@ describe('QueryVETTransferEvents unit tests', () => { const response = await QueryVETTransferEvents.of(request).askTo(mockClient); - expect(response.response.toJSON()).toMatchObject( + expect(response.response.toJSON()).toEqual( new TransferLogsResponse(mockResponse).toJSON() ); }); From c0a852c5e0189fd0bda120f00aa82b813356b778 Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Mon, 10 Mar 2025 16:55:47 +0000 Subject: [PATCH 13/15] fix: 1886 unit-integration-test.yml --- .github/workflows/unit-integration-test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/unit-integration-test.yml b/.github/workflows/unit-integration-test.yml index 6d1640d44..8768f9ef2 100644 --- a/.github/workflows/unit-integration-test.yml +++ b/.github/workflows/unit-integration-test.yml @@ -23,9 +23,6 @@ jobs: - name: Install & Patch packages run: yarn install - - name: Install playwright dependencies (for sample Vite dApp tests) - run: yarn playwright install - - name: Preliminary Stop of Thor solo node id: preliminary-stop-solo run: yarn stop-thor-solo From 32071549b94d788a1b8365f598fd921eb7d9f77c Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Mon, 10 Mar 2025 17:14:29 +0000 Subject: [PATCH 14/15] fix: 1886 unit-integration-test-browser.yml removed --- .../unit-integration-test-browser.yml | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/unit-integration-test-browser.yml diff --git a/.github/workflows/unit-integration-test-browser.yml b/.github/workflows/unit-integration-test-browser.yml deleted file mode 100644 index c54f1af20..000000000 --- a/.github/workflows/unit-integration-test-browser.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Unit tests for browser - -on: - workflow_call: - -jobs: - build: - name: Build & Lint - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node: [18, lts/*, latest] - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - - name: Install & Patch packages - run: yarn install - - - name: Preliminary Stop of Thor solo node - id: preliminary-stop-solo - run: yarn stop-thor-solo - - - name: Start Thor solo node - id: start-solo - run: yarn start-thor-solo - - - name: Test - id: unit-test - run: yarn test:browser - - - name: Stop Thor solo node - id: stop-solo - run: yarn stop-thor-solo \ No newline at end of file From 22afe9bde8bfe5a66bd4d6c469d76f70ca07d5eb Mon Sep 17 00:00:00 2001 From: lucanicoladebiasi Date: Tue, 11 Mar 2025 10:33:23 +0000 Subject: [PATCH 15/15] chore: removed useless modules --- .../src/thor-client/transactions/helpers/delegation-handler.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 packages/network/src/thor-client/transactions/helpers/delegation-handler.ts diff --git a/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts b/packages/network/src/thor-client/transactions/helpers/delegation-handler.ts deleted file mode 100644 index e69de29bb..000000000