diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index cca18858a..0985a9866 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -2,7 +2,11 @@ name: Check for leaks in secrets on: pull_request: branches: - - main + - 'main' + - 'main-*' + - 'supported-*' + - 'feature-*' + - '1.0.0' permissions: contents: read # This is required for actions/checkout diff --git a/.github/workflows/on-main.yml b/.github/workflows/on-main.yml index ff100c6b2..20edd38bb 100644 --- a/.github/workflows/on-main.yml +++ b/.github/workflows/on-main.yml @@ -5,6 +5,9 @@ on: branches: - 'main' - 'main-*' + - 'supported-*' + - 'feature-*' + - '1.0.0' jobs: install-build: diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index b3ed09392..161eaa1ec 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -3,7 +3,11 @@ name: PR Checks on: pull_request: branches: - - main + - 'main' + - 'main-*' + - 'supported-*' + - 'feature-*' + - '1.0.0' jobs: doc-examples: diff --git a/apps/sdk-cloudflare-integration/package.json b/apps/sdk-cloudflare-integration/package.json index a6d1e3139..03fb161da 100644 --- a/apps/sdk-cloudflare-integration/package.json +++ b/apps/sdk-cloudflare-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-cloudflare-integration", "description": "An example app of how to integrate the VeChain SDK with Cloudflare Workers", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "private": true, "author": "VeChain Foundation", "license": "MIT", @@ -16,6 +16,6 @@ "wrangler": "^3.72.3" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.4" + "@vechain/sdk-core": "1.0.0-rc.6" } } \ No newline at end of file diff --git a/apps/sdk-hardhat-integration/package.json b/apps/sdk-hardhat-integration/package.json index 944ff2a2d..2c45312dd 100644 --- a/apps/sdk-hardhat-integration/package.json +++ b/apps/sdk-hardhat-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-hardhat-integration", "description": "An example app of how to use the @vechain/sdk-hardhat-plugin to interact with the VeChainThor blockchain", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "private": true, "main": "index.js", "author": "VeChain Foundation", @@ -18,9 +18,9 @@ }, "dependencies": { "@openzeppelin/contracts": "^5.0.2", - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-hardhat-plugin": "1.0.0-rc.4", - "@vechain/sdk-logging": "1.0.0-rc.4" + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-hardhat-plugin": "1.0.0-rc.6", + "@vechain/sdk-logging": "1.0.0-rc.6" }, "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", diff --git a/apps/sdk-nextjs-integration/package.json b/apps/sdk-nextjs-integration/package.json index a160beeff..eb2345138 100644 --- a/apps/sdk-nextjs-integration/package.json +++ b/apps/sdk-nextjs-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-nextjs-integration", "description": "An example app of how to integrate the VeChain SDK with Next.js", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "private": true, "author": "VeChain Foundation", "license": "MIT", @@ -14,8 +14,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-network": "1.0.0-rc.4", + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-network": "1.0.0-rc.6", "install": "^0.13.0", "nanoid": "3.3.8", "next": "15.1.4", @@ -43,4 +43,4 @@ "resolutions": { "nanoid": "3.3.8" } -} +} \ No newline at end of file diff --git a/apps/sdk-node-integration/package.json b/apps/sdk-node-integration/package.json index 1cf3ffdce..35e3500b7 100644 --- a/apps/sdk-node-integration/package.json +++ b/apps/sdk-node-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-node-integration", "description": "An example app of how to integrate the VeChain SDK with Node.js", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "private": true, "main": "dist/index.js", "types": "src/index.ts", @@ -13,7 +13,7 @@ "test": "jest" }, "dependencies": { - "@vechain/sdk-network": "1.0.0-rc.4" + "@vechain/sdk-network": "1.0.0-rc.6" }, "devDependencies": { "@jest/globals": "^29.7.0", diff --git a/apps/sdk-vite-integration/package.json b/apps/sdk-vite-integration/package.json index bcf2c6265..5919f4d10 100644 --- a/apps/sdk-vite-integration/package.json +++ b/apps/sdk-vite-integration/package.json @@ -1,7 +1,7 @@ { "name": "sdk-vite-integration", "private": true, - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "type": "module", "scripts": { "dev": "vite", @@ -12,8 +12,8 @@ "test:jsdom": "vitest --config vitest.jsdom.config.js" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-network": "1.0.0-rc.4", + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-network": "1.0.0-rc.6", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.27.0" diff --git a/docs/package.json b/docs/package.json index db9a64205..02e3b6a3e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "private": true, "description": "Official documentation for the VeChain TypeScript SDK with examples", "author": "VeChain Foundation", @@ -17,8 +17,8 @@ "test:examples:solo": "(yarn start-thor-solo && yarn test:examples && yarn stop-thor-solo) || yarn stop-thor-solo" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-network": "1.0.0-rc.4" + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-network": "1.0.0-rc.6" }, "devDependencies": { "expect": "^29.7.0", diff --git a/packages/aws-kms-adapter/package.json b/packages/aws-kms-adapter/package.json index 4490b7f16..71e71282b 100644 --- a/packages/aws-kms-adapter/package.json +++ b/packages/aws-kms-adapter/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-aws-kms-adapter", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "description": "This module implements the VeChain abstract signer so it is integrated with AWS KMS", "author": "VeChain Foundation", "license": "MIT", @@ -40,9 +40,9 @@ "dependencies": { "@aws-sdk/client-kms": "^3.723.0", "@noble/curves": "^1.6.0", - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-errors": "1.0.0-rc.4", - "@vechain/sdk-network": "1.0.0-rc.4", + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-errors": "1.0.0-rc.6", + "@vechain/sdk-network": "1.0.0-rc.6", "asn1js": "^3.0.5", "ethers": "6.13.4", "viem": "^2.21.45" diff --git a/packages/core/package.json b/packages/core/package.json index 2d632c925..2ab045196 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-core", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "description": "This module is crafted for dApp development and various blockchain operations that seamlessly unfold offline", "author": "VeChain Foundation", "license": "MIT", @@ -44,8 +44,8 @@ "@scure/base": "^1.1.9", "@scure/bip32": "^1.4.0", "@scure/bip39": "^1.4.0", - "@vechain/sdk-errors": "1.0.0-rc.4", - "@vechain/sdk-logging": "1.0.0-rc.4", + "@vechain/sdk-errors": "1.0.0-rc.6", + "@vechain/sdk-logging": "1.0.0-rc.6", "abitype": "^1.0.6", "ethers": "6.13.4", "fast-json-stable-stringify": "^2.1.0", diff --git a/packages/errors/package.json b/packages/errors/package.json index 481f97abd..0f3ba39b0 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-errors", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "description": "This module is dedicated to managing and customizing errors within the VeChain SDK", "author": "VeChain Foundation", "license": "MIT", diff --git a/packages/errors/src/helpers/helpers.ts b/packages/errors/src/helpers/helpers.ts index d1d99d3a8..039b35324 100644 --- a/packages/errors/src/helpers/helpers.ts +++ b/packages/errors/src/helpers/helpers.ts @@ -22,6 +22,9 @@ const stringifyData = (data: unknown): string => { } seen.add(value); } + if (typeof value === 'bigint') { + return value.toString() + 'n'; + } return value; }; }; diff --git a/packages/errors/tests/helpers/helpers.unit.test.ts b/packages/errors/tests/helpers/helpers.unit.test.ts index ea71323c2..712e99183 100644 --- a/packages/errors/tests/helpers/helpers.unit.test.ts +++ b/packages/errors/tests/helpers/helpers.unit.test.ts @@ -73,65 +73,18 @@ describe('Error package helpers unit tests', () => { }); /** - * Error message builder function + * An error message is built with big int data */ - test('Should be able to build an error message', () => { + test('Should be able to build an error message - bigint', () => { const errorMessage = createErrorMessage( 'simpleMethod', 'Error message', { - data: 'test' - }, - new Error('Internal error') - ); - expect(errorMessage).toBeDefined(); - }); - - /** - * An error message is built with inner error undefined - */ - test('Should be able to build an error message - inner error undefined', () => { - const errorMessage = createErrorMessage( - 'simpleMethod', - 'Error message', - { - data: 'test' - } - ); - expect(errorMessage).toBeDefined(); - }); - - /** - * An error message is built with circular dependency on data - */ - test('Should be able to build an error message - circular dependency', () => { - // Simple circular dependency object - const circularDependencyObject: { - prop1: string; - prop2: { - prop3: string; - prop4?: unknown; - }; - } = { - prop1: 'value1', - prop2: { - prop3: 'value3' + data: 10n } - }; - - // Introduce circular reference - circularDependencyObject.prop2.prop4 = circularDependencyObject; - - const errorMessage = createErrorMessage( - 'simpleMethod', - 'Error message', - { - params: [-1], - data: circularDependencyObject - }, - new Error('Internal error') ); expect(errorMessage).toBeDefined(); + expect(errorMessage).toContain('10n'); }); }); diff --git a/packages/ethers-adapter/package.json b/packages/ethers-adapter/package.json index fbcaa8625..cf41b92a6 100644 --- a/packages/ethers-adapter/package.json +++ b/packages/ethers-adapter/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-ethers-adapter", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "description": "This module serves as a crucial bridge between the standard Ethereum tooling provided by Hardhat and the unique features of the VeChainThor blockchain", "author": "VeChain Foundation", "license": "MIT", @@ -33,9 +33,9 @@ "test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-errors": "1.0.0-rc.4", - "@vechain/sdk-network": "1.0.0-rc.4", + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-errors": "1.0.0-rc.6", + "@vechain/sdk-network": "1.0.0-rc.6", "ethers": "6.13.4" } } \ No newline at end of file diff --git a/packages/hardhat-plugin/package.json b/packages/hardhat-plugin/package.json index a5584911c..52bef8be6 100644 --- a/packages/hardhat-plugin/package.json +++ b/packages/hardhat-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-hardhat-plugin", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "description": "This module allows to create smart contracts and interact with them using the VeChain SDK and Hardhat", "author": "VeChain Foundation", "license": "MIT", @@ -38,11 +38,11 @@ }, "dependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.8", - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-errors": "1.0.0-rc.4", - "@vechain/sdk-ethers-adapter": "1.0.0-rc.4", - "@vechain/sdk-logging": "1.0.0-rc.4", - "@vechain/sdk-network": "1.0.0-rc.4", + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-errors": "1.0.0-rc.6", + "@vechain/sdk-ethers-adapter": "1.0.0-rc.6", + "@vechain/sdk-logging": "1.0.0-rc.6", + "@vechain/sdk-network": "1.0.0-rc.6", "ethers": "6.13.4", "hardhat": "^2.22.15" } diff --git a/packages/logging/package.json b/packages/logging/package.json index e3f9105bf..2c2e8fa97 100644 --- a/packages/logging/package.json +++ b/packages/logging/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-logging", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "description": "This module provides functionality to logging data for vechain-sdk", "author": "VeChain Foundation", "license": "MIT", @@ -34,6 +34,6 @@ "test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit" }, "dependencies": { - "@vechain/sdk-errors": "1.0.0-rc.4" + "@vechain/sdk-errors": "1.0.0-rc.6" } } \ No newline at end of file diff --git a/packages/network/package.json b/packages/network/package.json index b7c40b3e7..e0be188c9 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-network", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "description": "This module serves as the standard interface connecting decentralized applications (dApps) and users to the VeChainThor blockchain", "author": "VeChain Foundation", "license": "MIT", @@ -42,9 +42,9 @@ }, "dependencies": { "@noble/curves": "^1.6.0", - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-errors": "1.0.0-rc.4", - "@vechain/sdk-logging": "1.0.0-rc.4", + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-errors": "1.0.0-rc.6", + "@vechain/sdk-logging": "1.0.0-rc.6", "@vechain/vebetterdao-contracts": "^4.0.0", "abitype": "^1.0.6", "ethers": "6.13.4", diff --git a/packages/network/solo-seeding/const.ts b/packages/network/solo-seeding/const.ts deleted file mode 100644 index ccd28765d..000000000 --- a/packages/network/solo-seeding/const.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Bytecode of the testing contract if already available. - * Leave empty to compile the contract using internal solc compiler. - */ -const TESTING_CONTRACT_BYTECODE = - '0x608060405261001261006860201b60201c565b6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600060015534801561006257600080fd5b50610079565b600068457874656e73696f6e905090565b6127ca806100886000396000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c80636188a79b1161011a578063bd255307116100ad578063da46084a1161007c578063da46084a146106a1578063e1967eae146106d1578063eb03555c146106ef578063f8b2cb4f1461071f578063fb3a4b941461074f57610206565b8063bd25530714610607578063c4e41b2214610637578063c7bce69d14610655578063cf98821c1461067157610206565b80637634787f116100e95780637634787f1461056f578063b2d144001461059f578063b6b55f25146105bb578063bd220e65146105d757610206565b80636188a79b146104d75780636765f626146105075780636a98ff2b1461052357806375f7286c1461055357610206565b80632e1a7d4d1161019d578063448dc9661161016c578063448dc96614610406578063459346c7146104245780634888df8d146104545780634d56c873146104725780635fb5fe3b146104a757610206565b80632e1a7d4d1461036c57806333956403146103885780633793077c146103b85780633f92958f146103d657610206565b806311c4ea65116101d957806311c4ea65146102b757806315a23066146102ee5780631d4a06de1461030c57806327e235e31461033c57610206565b806301cb08c51461020b57806301ec27bd146102275780630a9f3f05146102575780631083ac9214610287575b600080fd5b6102256004803603810190610220919061126e565b610759565b005b610241600480360381019061023c9190611457565b6107bb565b60405161024e919061156b565b60405180910390f35b610271600480360381019061026c919061126e565b6107cb565b60405161027e919061159c565b60405180910390f35b6102a1600480360381019061029c919061126e565b61086f565b6040516102ae919061159c565b60405180910390f35b6102d160048036038101906102cc91906117e9565b610879565b6040516102e5989796959493929190611b07565b60405180910390f35b6102f66108bf565b604051610303919061159c565b60405180910390f35b61032660048036038101906103219190611b9c565b610956565b6040516103339190611be5565b60405180910390f35b61035660048036038101906103519190611c07565b610960565b604051610363919061159c565b60405180910390f35b6103866004803603810190610381919061126e565b610978565b005b6103a2600480360381019061039d9190611c6c565b610a9a565b6040516103af9190611ca8565b60405180910390f35b6103c0610aa4565b6040516103cd919061159c565b60405180910390f35b6103f060048036038101906103eb919061126e565b610b3b565b6040516103fd9190611cc3565b60405180910390f35b61040e610bdf565b60405161041b9190611d19565b60405180910390f35b61043e60048036038101906104399190611d6a565b610c76565b60405161044b9190611da6565b60405180910390f35b61045c610c80565b6040516104699190611cc3565b60405180910390f35b61048c60048036038101906104879190611edc565b610d17565b60405161049e96959493929190611fb4565b60405180910390f35b6104c160048036038101906104bc9190611c07565b610d41565b6040516104ce9190612015565b60405180910390f35b6104f160048036038101906104ec9190612030565b610d4b565b6040516104fe919061205d565b60405180910390f35b610521600480360381019061051c919061126e565b610d55565b005b61053d60048036038101906105389190612119565b610d9b565b60405161054a9190611cc3565b60405180910390f35b61056d6004803603810190610568919061126e565b610e3f565b005b6105896004803603810190610584919061126e565b610e85565b6040516105969190612015565b60405180910390f35b6105b960048036038101906105b4919061126e565b610f29565b005b6105d560048036038101906105d0919061126e565b610f70565b005b6105f160048036038101906105ec919061126e565b61100e565b6040516105fe9190612162565b60405180910390f35b610621600480360381019061061c919061217d565b6110b2565b60405161062e91906121aa565b60405180910390f35b61063f6110c2565b60405161064c919061159c565b60405180910390f35b61066f600480360381019061066a919061126e565b611159565b005b61068b600480360381019061068691906121c5565b61116d565b604051610698919061220e565b60405180910390f35b6106bb60048036038101906106b69190612230565b611177565b6040516106c8919061225d565b60405180910390f35b6106d961118d565b6040516106e6919061159c565b60405180910390f35b61070960048036038101906107049190612278565b611193565b6040516107169190611cc3565b60405180910390f35b61073960048036038101906107349190611c07565b61119d565b604051610746919061159c565b60405180910390f35b6107576111e6565b005b60006001549050816001819055503373ffffffffffffffffffffffffffffffffffffffff1681837f300d5da673e2547b3469e683ff2c8c7efd661c408f45cd0be5a951392a00cfa3426040516107af919061159c565b60405180910390a45050565b6107c36111e8565b819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633b80eea2836040518263ffffffff1660e01b8152600401610827919061159c565b602060405180830381865afa158015610844573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086891906122ba565b9050919050565b6000819050919050565b60008060006060610888611202565b60606108926111e8565b60008f8f8f8f8f8f8f8f975097509750975097509750975097509850985098509850985098509850989050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663605df59c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561092d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095191906122ba565b905090565b6060819050919050565b60026020528060005260406000206000915090505481565b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f190612333565b60405180910390fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a499190612382565b925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a96573d6000803e3d6000fd5b5050565b6000819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6ddce6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3691906122ba565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d527e344836040518263ffffffff1660e01b8152600401610b97919061159c565b602060405180830381865afa158015610bb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd891906123cb565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e80558316040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c719190612424565b905090565b6000819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639ac53dbb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1291906123cb565b905090565b6000806000806000808b8b8b8b8b8b95509550955095509550955096509650965096509650969050565b6000819050919050565b6000819050919050565b600a8111610d98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8f9061249d565b60405180910390fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166337245814836040518263ffffffff1660e01b8152600401610df79190612512565b602060405180830381865afa158015610e14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3891906123cb565b9050919050565b602a8114610e82576040517f8d6ea8be000000000000000000000000000000000000000000000000000000008152600401610e7990612580565b60405180910390fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340f9fafe836040518263ffffffff1660e01b8152600401610ee1919061159c565b602060405180830381865afa158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2291906125b5565b9050919050565b6005811015610f6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f649061262e565b60405180910390fd5b50565b8060008111610fb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fab9061269a565b60405180910390fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461100391906126ba565b925050819055505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166341f90721836040518263ffffffff1660e01b815260040161106a919061159c565b602060405180830381865afa158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab9190612703565b9050919050565b6110ba611202565b819050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611130573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115491906122ba565b905090565b6000811461116a57611169612730565b5b50565b6060819050919050565b6000600182611186919061275f565b9050919050565b60015481565b6000819050919050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565bfe5b604051806040016040528060008152602001606081525090565b6040518060600160405280600390602082028036833780820191505090505090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61124b81611238565b811461125657600080fd5b50565b60008135905061126881611242565b92915050565b6000602082840312156112845761128361122e565b5b600061129284828501611259565b91505092915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6112e9826112a0565b810181811067ffffffffffffffff82111715611308576113076112b1565b5b80604052505050565b600061131b611224565b905061132782826112e0565b919050565b600080fd5b600080fd5b600080fd5b600067ffffffffffffffff821115611356576113556112b1565b5b61135f826112a0565b9050602081019050919050565b82818337600083830152505050565b600061138e6113898461133b565b611311565b9050828152602081018484840111156113aa576113a9611336565b5b6113b584828561136c565b509392505050565b600082601f8301126113d2576113d1611331565b5b81356113e284826020860161137b565b91505092915050565b6000604082840312156114015761140061129b565b5b61140b6040611311565b9050600061141b84828501611259565b600083015250602082013567ffffffffffffffff81111561143f5761143e61132c565b5b61144b848285016113bd565b60208301525092915050565b60006020828403121561146d5761146c61122e565b5b600082013567ffffffffffffffff81111561148b5761148a611233565b5b611497848285016113eb565b91505092915050565b6114a981611238565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156114e95780820151818401526020810190506114ce565b60008484015250505050565b6000611500826114af565b61150a81856114ba565b935061151a8185602086016114cb565b611523816112a0565b840191505092915050565b600060408301600083015161154660008601826114a0565b506020830151848203602086015261155e82826114f5565b9150508091505092915050565b60006020820190508181036000830152611585818461152e565b905092915050565b61159681611238565b82525050565b60006020820190506115b1600083018461158d565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006115e2826115b7565b9050919050565b6115f2816115d7565b81146115fd57600080fd5b50565b60008135905061160f816115e9565b92915050565b6000819050919050565b61162881611615565b811461163357600080fd5b50565b6000813590506116458161161f565b92915050565b600067ffffffffffffffff821115611666576116656112b1565b5b602082029050919050565b600080fd5b60006116896116848461164b565b611311565b905080602084028301858111156116a3576116a2611671565b5b835b818110156116cc57806116b88882611259565b8452602084019350506020810190506116a5565b5050509392505050565b600082601f8301126116eb576116ea611331565b5b60036116f8848285611676565b91505092915050565b600067ffffffffffffffff82111561171c5761171b6112b1565b5b602082029050602081019050919050565b600061174061173b84611701565b611311565b9050808382526020820190506020840283018581111561176357611762611671565b5b835b8181101561178c57806117788882611259565b845260208401935050602081019050611765565b5050509392505050565b600082601f8301126117ab576117aa611331565b5b81356117bb84826020860161172d565b91505092915050565b600381106117d157600080fd5b50565b6000813590506117e3816117c4565b92915050565b600080600080600080600080610140898b03121561180a5761180961122e565b5b60006118188b828c01611259565b98505060206118298b828c01611600565b975050604061183a8b828c01611636565b965050606089013567ffffffffffffffff81111561185b5761185a611233565b5b6118678b828c016113bd565b95505060806118788b828c016116d6565b94505060e089013567ffffffffffffffff81111561189957611898611233565b5b6118a58b828c01611796565b93505061010089013567ffffffffffffffff8111156118c7576118c6611233565b5b6118d38b828c016113eb565b9250506101206118e58b828c016117d4565b9150509295985092959890939650565b6118fe816115d7565b82525050565b61190d81611615565b82525050565b600082825260208201905092915050565b600061192f826114af565b6119398185611913565b93506119498185602086016114cb565b611952816112a0565b840191505092915050565b600060039050919050565b600081905092915050565b6000819050919050565b600061198983836114a0565b60208301905092915050565b6000602082019050919050565b6119ab8161195d565b6119b58184611968565b92506119c082611973565b8060005b838110156119f15781516119d8878261197d565b96506119e383611995565b9250506001810190506119c4565b505050505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000602082019050919050565b6000611a3d826119f9565b611a478185611a04565b9350611a5283611a15565b8060005b83811015611a83578151611a6a888261197d565b9750611a7583611a25565b925050600181019050611a56565b5085935050505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110611ad057611acf611a90565b5b50565b6000819050611ae182611abf565b919050565b6000611af182611ad3565b9050919050565b611b0181611ae6565b82525050565b600061014082019050611b1d600083018b61158d565b611b2a602083018a6118f5565b611b376040830189611904565b8181036060830152611b498188611924565b9050611b5860808301876119a2565b81810360e0830152611b6a8186611a32565b9050818103610100830152611b7f818561152e565b9050611b8f610120830184611af8565b9998505050505050505050565b600060208284031215611bb257611bb161122e565b5b600082013567ffffffffffffffff811115611bd057611bcf611233565b5b611bdc848285016113bd565b91505092915050565b60006020820190508181036000830152611bff8184611924565b905092915050565b600060208284031215611c1d57611c1c61122e565b5b6000611c2b84828501611600565b91505092915050565b60008115159050919050565b611c4981611c34565b8114611c5457600080fd5b50565b600081359050611c6681611c40565b92915050565b600060208284031215611c8257611c8161122e565b5b6000611c9084828501611c57565b91505092915050565b611ca281611c34565b82525050565b6000602082019050611cbd6000830184611c99565b92915050565b6000602082019050611cd86000830184611904565b92915050565b60007fffffffffffffffff00000000000000000000000000000000000000000000000082169050919050565b611d1381611cde565b82525050565b6000602082019050611d2e6000830184611d0a565b92915050565b6000819050919050565b611d4781611d34565b8114611d5257600080fd5b50565b600081359050611d6481611d3e565b92915050565b600060208284031215611d8057611d7f61122e565b5b6000611d8e84828501611d55565b91505092915050565b611da081611d34565b82525050565b6000602082019050611dbb6000830184611d97565b92915050565b600060ff82169050919050565b611dd781611dc1565b8114611de257600080fd5b50565b600081359050611df481611dce565b92915050565b600061ffff82169050919050565b611e1181611dfa565b8114611e1c57600080fd5b50565b600081359050611e2e81611e08565b92915050565b600063ffffffff82169050919050565b611e4d81611e34565b8114611e5857600080fd5b50565b600081359050611e6a81611e44565b92915050565b600067ffffffffffffffff82169050919050565b611e8d81611e70565b8114611e9857600080fd5b50565b600081359050611eaa81611e84565b92915050565b611eb9816115b7565b8114611ec457600080fd5b50565b600081359050611ed681611eb0565b92915050565b60008060008060008060c08789031215611ef957611ef861122e565b5b6000611f0789828a01611de5565b9650506020611f1889828a01611e1f565b9550506040611f2989828a01611e5b565b9450506060611f3a89828a01611e9b565b9350506080611f4b89828a01611ec7565b92505060a0611f5c89828a01611259565b9150509295509295509295565b611f7281611dc1565b82525050565b611f8181611dfa565b82525050565b611f9081611e34565b82525050565b611f9f81611e70565b82525050565b611fae816115b7565b82525050565b600060c082019050611fc96000830189611f69565b611fd66020830188611f78565b611fe36040830187611f87565b611ff06060830186611f96565b611ffd6080830185611fa5565b61200a60a083018461158d565b979650505050505050565b600060208201905061202a60008301846118f5565b92915050565b6000602082840312156120465761204561122e565b5b6000612054848285016117d4565b91505092915050565b60006020820190506120726000830184611af8565b92915050565b600067ffffffffffffffff821115612093576120926112b1565b5b61209c826112a0565b9050602081019050919050565b60006120bc6120b784612078565b611311565b9050828152602081018484840111156120d8576120d7611336565b5b6120e384828561136c565b509392505050565b600082601f830112612100576120ff611331565b5b81356121108482602086016120a9565b91505092915050565b60006020828403121561212f5761212e61122e565b5b600082013567ffffffffffffffff81111561214d5761214c611233565b5b612159848285016120eb565b91505092915050565b60006020820190506121776000830184611f96565b92915050565b6000606082840312156121935761219261122e565b5b60006121a1848285016116d6565b91505092915050565b60006060820190506121bf60008301846119a2565b92915050565b6000602082840312156121db576121da61122e565b5b600082013567ffffffffffffffff8111156121f9576121f8611233565b5b61220584828501611796565b91505092915050565b600060208201905081810360008301526122288184611a32565b905092915050565b6000602082840312156122465761224561122e565b5b600061225484828501611de5565b91505092915050565b60006020820190506122726000830184611f69565b92915050565b60006020828403121561228e5761228d61122e565b5b600061229c84828501611636565b91505092915050565b6000815190506122b481611242565b92915050565b6000602082840312156122d0576122cf61122e565b5b60006122de848285016122a5565b91505092915050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061231d601483611913565b9150612328826122e7565b602082019050919050565b6000602082019050818103600083015261234c81612310565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061238d82611238565b915061239883611238565b92508282039050818111156123b0576123af612353565b5b92915050565b6000815190506123c58161161f565b92915050565b6000602082840312156123e1576123e061122e565b5b60006123ef848285016123b6565b91505092915050565b61240181611cde565b811461240c57600080fd5b50565b60008151905061241e816123f8565b92915050565b60006020828403121561243a5761243961122e565b5b60006124488482850161240f565b91505092915050565b7f56616c7565206d7573742062652067726561746572207468616e203130000000600082015250565b6000612487601d83611913565b915061249282612451565b602082019050919050565b600060208201905081810360008301526124b68161247a565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006124e4826124bd565b6124ee81856124c8565b93506124fe8185602086016114cb565b612507816112a0565b840191505092915050565b6000602082019050818103600083015261252c81846124d9565b905092915050565b7f56616c7565206973206e6f742034320000000000000000000000000000000000600082015250565b600061256a600f83611913565b915061257582612534565b602082019050919050565b600060208201905081810360008301526125998161255d565b9050919050565b6000815190506125af816115e9565b92915050565b6000602082840312156125cb576125ca61122e565b5b60006125d9848285016125a0565b91505092915050565b7f56616c7565206d757374206265206174206c6561737420350000000000000000600082015250565b6000612618601883611913565b9150612623826125e2565b602082019050919050565b600060208201905081810360008301526126478161260b565b9050919050565b7f56616c7565206d75737420626520706f73697469766500000000000000000000600082015250565b6000612684601683611913565b915061268f8261264e565b602082019050919050565b600060208201905081810360008301526126b381612677565b9050919050565b60006126c582611238565b91506126d083611238565b92508282019050808211156126e8576126e7612353565b5b92915050565b6000815190506126fd81611e84565b92915050565b6000602082840312156127195761271861122e565b5b6000612727848285016126ee565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600061276a82611dc1565b915061277583611dc1565b9250828201905060ff81111561278e5761278d612353565b5b9291505056fea264697066735822122090e8d98dff56f009773585884be02c1824429b468490cc66cf321ad52458c8b864736f6c63430008130033'; - -export { TESTING_CONTRACT_BYTECODE }; diff --git a/packages/network/solo-seeding/index.ts b/packages/network/solo-seeding/index.ts deleted file mode 100644 index d0f8c32c3..000000000 --- a/packages/network/solo-seeding/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './thor-solo-seeding'; diff --git a/packages/network/solo-seeding/thor-solo-seeding.ts b/packages/network/solo-seeding/thor-solo-seeding.ts deleted file mode 100644 index 17bb45deb..000000000 --- a/packages/network/solo-seeding/thor-solo-seeding.ts +++ /dev/null @@ -1,521 +0,0 @@ -import { expect } from '@jest/globals'; -import { - ABIContract, - ABIFunction, - ABIItem, - Address, - Clause, - HexUInt, - networkInfo, - Transaction, - Units, - ZERO_ADDRESS, - type TransactionClause -} from '@vechain/sdk-core'; -import { stringifyData } from '@vechain/sdk-errors'; -import { - BUILT_IN_CONTRACTS, - THOR_SOLO_ACCOUNTS, - THOR_SOLO_URL -} from '@vechain/sdk-network'; -import { id, namehash } from 'ethers'; -import { ThorClient } from '../src'; -import { TESTING_CONTRACT_BYTECODE } from './const'; - -/** - * Constructs clauses for transferring VTHO tokens. - * - * @remarks - * This constant creates an array of transaction clauses for transferring VTHO tokens - * from the built-in energy contract to the first 10 accounts in the `THOR_SOLO_ACCOUNTS` array. - */ -const CLAUSES_VTHO = THOR_SOLO_ACCOUNTS.slice(0, 10).map((account) => ({ - to: BUILT_IN_CONTRACTS.ENERGY_ADDRESS, - value: 0, - data: ABIContract.ofAbi(BUILT_IN_CONTRACTS.ENERGY_ABI) - .encodeFunctionInput('transfer', [ - account.address, - Units.parseEther('500000000').bi - ]) - .toString() -})); - -/** - * Constructs clauses for transferring VET tokens. - * - * @remarks - * This constant creates an array of transaction clauses for transferring VET tokens - * to the first 10 accounts in the `THOR_SOLO_ACCOUNTS` array. - */ -const CLAUSES_VET = THOR_SOLO_ACCOUNTS.slice(0, 10).map((account) => ({ - to: account.address, - value: `0x${Units.parseEther('500000000').bi.toString(16)}`, - data: '0x' -})); - -/** - * Constructs a transaction body. - * - * @remarks blockRef is set to the genesis block ref. Expiration is set to 100000 blocks as an example but can be set to any value. - * gas is set to 100000 as an example but can be set to a estimated gas value when the functionality is implemented. - */ -const txBody = { - chainTag: networkInfo.solo.chainTag, - blockRef: '0x0000000000000000', - expiration: 100000, - gasPriceCoef: 0, - gas: 100000000, - dependsOn: null, - nonce: '0x851fd66f' // Random nonce -}; - -/** - * Array of transaction bodies with clauses for VTHO and VET transfers. - */ -const txBodies = CLAUSES_VTHO.map((clause, index) => ({ - ...txBody, - // eslint-disable-next-line security/detect-object-injection - clauses: [clause, CLAUSES_VET[index]] -})); - -/** - * Array of unsigned transactions. - */ -const unsignedTxs = txBodies.map((txBody) => Transaction.of(txBody)); - -/** - * Array of signed transactions where each transaction is being signed and performed by each of the 10 thor-solo pre-seeded accounts. - */ -const txs = unsignedTxs.map((unsignedTx, index) => - unsignedTx.sign( - HexUInt.of(THOR_SOLO_ACCOUNTS[10 + index].privateKey).bytes // 10 is the index of the first thor-solo genesis account - ) -); - -/** - * Prepares a transaction for deploying the `TestingContract.sol` contract. - * - * @returns A signed transaction for deploying the `TestingContract.sol` contract. - */ -const deployTestContractTransaction = (): Transaction => { - try { - return Transaction.of({ - ...txBody, - clauses: [ - { - to: null, - value: '0x0', - data: TESTING_CONTRACT_BYTECODE - } - ] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes); - } catch (err) { - console.log('Error creating deploy testing contract tx:', err); - throw err; - } -}; - -const seedVnsSolo = async (): Promise => { - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - const tld = 'vet'; - - let nonce = 0; - - const vnsRegistry = await (async () => { - const contract = Clause.deployContract( - HexUInt.of( - '0x608060405234801561001057600080fd5b5060008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb580546001600160a01b03191633179055610a43806100596000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80635b0fc9c311610081578063cf4088231161005b578063cf40882314610204578063e985e9c514610217578063f79fe5381461026357600080fd5b80635b0fc9c3146101cb5780635ef2c7f0146101de578063a22cb465146101f157600080fd5b806314ab9038116100b257806314ab90381461015657806316a25cbd1461016b5780631896f70a146101b857600080fd5b80630178b8bf146100d957806302571be31461012257806306ab592314610135575b600080fd5b6101056100e7366004610832565b6000908152602081905260409020600101546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b610105610130366004610832565b61028e565b610148610143366004610867565b6102bc565b604051908152602001610119565b6101696101643660046108b4565b6103bc565b005b61019f610179366004610832565b600090815260208190526040902060010154600160a01b900467ffffffffffffffff1690565b60405167ffffffffffffffff9091168152602001610119565b6101696101c63660046108e0565b6104a3565b6101696101d93660046108e0565b610575565b6101696101ec366004610903565b610641565b6101696101ff36600461095a565b610663565b610169610212366004610996565b6106cf565b6102536102253660046109e3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6040519015158152602001610119565b610253610271366004610832565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b03163081036102b65750600092915050565b92915050565b60008381526020819052604081205484906001600160a01b03163381148061030757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61031057600080fd5b604080516020810188905290810186905260009060600160408051601f1981840301815291815281516020928301206000818152928390529120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905590506040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b03163381148061040757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61041057600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806104ee57506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104f757600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806105c057506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6105c957600080fd5b6000848152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790556040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b600061064e8686866102bc565b905061065b8184846106ea565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6106d98484610575565b6106e48483836106ea565b50505050565b6000838152602081905260409020600101546001600160a01b0383811691161461077d5760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b909204161461082d576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a25b505050565b60006020828403121561084457600080fd5b5035919050565b80356001600160a01b038116811461086257600080fd5b919050565b60008060006060848603121561087c57600080fd5b83359250602084013591506108936040850161084b565b90509250925092565b803567ffffffffffffffff8116811461086257600080fd5b600080604083850312156108c757600080fd5b823591506108d76020840161089c565b90509250929050565b600080604083850312156108f357600080fd5b823591506108d76020840161084b565b600080600080600060a0868803121561091b57600080fd5b85359450602086013593506109326040870161084b565b92506109406060870161084b565b915061094e6080870161089c565b90509295509295909350565b6000806040838503121561096d57600080fd5b6109768361084b565b91506020830135801515811461098b57600080fd5b809150509250929050565b600080600080608085870312156109ac57600080fd5b843593506109bc6020860161084b565b92506109ca6040860161084b565b91506109d86060860161089c565b905092959194509250565b600080604083850312156109f657600080fd5b6109ff8361084b565b91506108d76020840161084b56fea264697066735822122077b2e963ccd038f34ccd990487d962cebf8be244a9dcab9c3af4099662a96cbc64736f6c63430008110033' - ) - ); - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [contract] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - const txReceipt = await thorSoloClient.transactions.waitForTransaction( - tx.id - ); - - return txReceipt?.outputs[0].contractAddress ?? ''; - })(); - console.log('Deployed Registry to', vnsRegistry); - - const vnsRegistrar = await (async () => { - const contract = Clause.deployContract( - HexUInt.of( - '0x608060405234801561001057600080fd5b5060405161036038038061036083398101604081905261002f91610058565b600080546001600160a01b0319166001600160a01b039390931692909217909155600155610092565b6000806040838503121561006b57600080fd5b82516001600160a01b038116811461008257600080fd5b6020939093015192949293505050565b6102bf806100a16000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d22057a914610030575b600080fd5b61004361003e36600461021c565b610045565b005b6000805460015460408051602080820193909352808201879052815180820383018152606082019283905280519301929092207f02571be300000000000000000000000000000000000000000000000000000000909152606482015284929173ffffffffffffffffffffffffffffffffffffffff16906302571be390608401602060405180830381865afa1580156100e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610105919061024c565b905073ffffffffffffffffffffffffffffffffffffffff8116158061013f575073ffffffffffffffffffffffffffffffffffffffff811633145b61014857600080fd5b6000546001546040517f06ab592300000000000000000000000000000000000000000000000000000000815260048101919091526024810186905273ffffffffffffffffffffffffffffffffffffffff8581166044830152909116906306ab5923906064016020604051808303816000875af11580156101cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f09190610270565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461021957600080fd5b50565b6000806040838503121561022f57600080fd5b823591506020830135610241816101f7565b809150509250929050565b60006020828403121561025e57600080fd5b8151610269816101f7565b9392505050565b60006020828403121561028257600080fd5b505191905056fea2646970667358221220a97c65d48bc1b106cc64da7676b2cf51e0b5b2a151bca9490762028d353b386e64736f6c63430008110033' - ), - { - types: ['address', 'bytes32'], - values: [vnsRegistry, namehash(tld)] - } - ); - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [contract] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - const txReceipt = await thorSoloClient.transactions.waitForTransaction( - tx.id - ); - - return txReceipt?.outputs[0].contractAddress ?? ''; - })(); - console.log('Deployed Registrar to', vnsRegistrar); - - const vnsReverseRegistrar = await (async () => { - const contract = Clause.deployContract( - HexUInt.of( - '0x60a060405234801561001057600080fd5b5060405162000f5338038062000f53833981016040819052610031916101b6565b61003a3361014e565b6001600160a01b03811660808190526040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152600091906302571be390602401602060405180830381865afa1580156100a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ca91906101b6565b90506001600160a01b0381161561014757604051630f41a04d60e11b81523360048201526001600160a01b03821690631e83409a906024016020604051808303816000875af1158015610121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014591906101da565b505b50506101f3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146101b357600080fd5b50565b6000602082840312156101c857600080fd5b81516101d38161019e565b9392505050565b6000602082840312156101ec57600080fd5b5051919050565b608051610d366200021d6000396000818161012d015281816102f001526105070152610d366000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220beab0412e54fd175ddb6fc54aabebbad253b933d875cac9f5991b7575afa240764736f6c63430008110033' - ), - { - types: ['address'], - values: [vnsRegistry] - } - ); - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [contract] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - const txReceipt = await thorSoloClient.transactions.waitForTransaction( - tx.id - ); - - return txReceipt?.outputs[0].contractAddress ?? ''; - })(); - console.log('Deployed Reverse Registrar to', vnsReverseRegistrar); - - await (async () => { - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [ - Clause.callFunction( - Address.of(vnsRegistry), - ABIItem.ofSignature( - ABIFunction, - 'function setSubnodeOwner(bytes32 node, bytes32 label, address owner)' - ), - [ - '0x0000000000000000000000000000000000000000000000000000000000000000', - // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - ethers.id(tld), - vnsRegistrar - ] - ) as TransactionClause, - Clause.callFunction( - Address.of(vnsRegistry), - ABIItem.ofSignature( - ABIFunction, - 'function setSubnodeOwner(bytes32 node, bytes32 label, address owner)' - ), - [ - '0x0000000000000000000000000000000000000000000000000000000000000000', - id('reverse'), - THOR_SOLO_ACCOUNTS[4].address - ] - ) as TransactionClause, - Clause.callFunction( - Address.of(vnsRegistry), - ABIItem.ofSignature( - ABIFunction, - 'function setSubnodeOwner(bytes32 node, bytes32 label, address owner)' - ), - [namehash('reverse'), id('addr'), vnsReverseRegistrar] - ) as TransactionClause - ] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - await thorSoloClient.transactions.waitForTransaction(tx.id); - })(); - console.log('Configured vet.domains setup for TLD', tld); - - const vnsPublicResolver = await (async () => { - const contract = Clause.deployContract( - HexUInt.of( - '0x6101006040523480156200001257600080fd5b50604051620032973803806200329783398101604081905262000035916200017a565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152849033906000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c79190620001e2565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af115801562000114573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200013a919062000209565b5050506001600160a01b039485166080525091831660a052821660c0521660e05262000223565b6001600160a01b03811681146200017757600080fd5b50565b600080600080608085870312156200019157600080fd5b84516200019e8162000161565b6020860151909450620001b18162000161565b6040860151909350620001c48162000161565b6060860151909250620001d78162000161565b939692955090935050565b600060208284031215620001f557600080fd5b8151620002028162000161565b9392505050565b6000602082840312156200021c57600080fd5b5051919050565b60805160a05160c05160e0516130336200026460003960006117da015260006117a80152600081816118b201526119180152600061183b01526130336000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed36600461252c565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612589565b61058a565b005b61021a61022a3660046125d5565b610794565b61024261023d36600461264f565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d61026836600461267b565b610b0d565b6040516101fe9291906126ed565b61021a610289366004612706565b610c44565b61021a61029c366004612589565b610cdf565b61021a6102af366004612732565b610d5b565b6102426102c2366004612732565b610dfe565b6101f26102d536600461267b565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612589565b610e31565b6040516101fe919061274b565b610326610341366004612732565b610f11565b61021a61035436600461275e565b610fd0565b610326610367366004612732565b61106d565b61021a61037a366004612589565b6110a7565b61021a61038d3660046127c7565b611123565b61021a6103a03660046128b0565b611204565b61021a6103b33660046128dc565b6112f3565b6103266103c636600461291a565b6113c0565b6101f26103d936600461295a565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d6565b61140e565b6040516101fe9190612a18565b61032661043d366004612732565b61141c565b610486610450366004612732565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612589565b611456565b61021a6104bc366004612a7a565b611599565b6104eb6104cf366004612732565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aaa565b6115c1565b61021a610525366004612ae9565b6115d6565b6101f2610538366004612b1e565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b61032661057436600461267b565b611695565b60006105848261175d565b92915050565b826105948161179b565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d90819084018382808284376000920191909152509293925050611a029050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a63565b9450846040516020016106439190612b4c565b60405160208183030381529060405280519060200120925061066481611a84565b935061071f565b600061067682611a63565b9050816040015161ffff168861ffff1614158061069a57506106988682611aa0565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7e565b8b51158a611abe565b81604001519750816020015196508095508580519060200120935061071a82611a84565b94505b505b61072881611d2b565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7e565b89511588611abe565b50505050505050505050565b8461079e8161179b565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b91565b90815260200160405180910390209182610802929190612c29565b508484604051610813929190612b91565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d12565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b4c565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d44565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b4c565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d44565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612ba1565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612ba1565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e8161179b565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce98161179b565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c29565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d5a565b80610d658161179b565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6e565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0d836102bf611695565b90508051600003610e215750600092915050565b610e2a81611e13565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e719085908590612b91565b90815260200160405180910390208054610e8a90612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb690612ba1565b8015610f035780601f10610ed857610100808354040283529160200191610f03565b820191906000526020600020905b815481529060010190602001808311610ee657829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4b90612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7790612ba1565b8015610fc45780601f10610f9957610100808354040283529160200191610fc4565b820191906000526020600020905b815481529060010190602001808311610fa757829003601f168201915b50505050509050919050565b83610fda8161179b565b610fe357600080fd5b83610fef600182612b7e565b1615610ffa57600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611038838583612c29565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4b90612ba1565b826110b18161179b565b6110ba57600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110f0838583612c29565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d5a565b8261112d8161179b565b61113657600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111689291906126ed565b60405180910390a26102bf83036111c057837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a484611e13565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fd8382612d95565b5050505050565b6001600160a01b03821633036112875760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b038216330361134b5760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127e565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8a90612ba1565b6060610e2a60008484611e3b565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4b90612ba1565b826114608161179b565b61146957600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a390612ba1565b80601f01602080910402602001604051908101604052809291908181526020018280546114cf90612ba1565b801561151c5780601f106114f15761010080835404028352916020019161151c565b820191906000526020600020905b8154815290600101906020018083116114ff57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115549050858783612c29565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158993929190612e55565b60405180910390a2505050505050565b816115a38161179b565b6115ac57600080fd5b6115bc836102bf61038d85612014565b505050565b60606115ce848484611e3b565b949350505050565b826115e08161179b565b6115e957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d790612ba1565b80601f016020809104026020016040519081016040528092919081815260200182805461170390612ba1565b80156117505780601f1061172557610100808354040283529160200191611750565b820191906000526020600020905b81548152906001019060200180831161173357829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204d565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117fc5750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180957506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa15801561188a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ae9190612e85565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198e576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611967573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198b9190612e85565b90505b6001600160a01b0381163314806119c857506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2a57506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e2a565b611a506040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d2b565b6020810151815160609161058491611a7b908261208b565b845191906120e5565b60a081015160c082015160609161058491611a7b908290612b7e565b600081518351148015610e2a5750610e2a836000846000875161215c565b865160208801206000611ad28787876120e5565b90508315611bfc5767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1d90612ba1565b159050611b7c5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b6083612ea2565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bbd916124b9565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bef929190612ec0565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3f90612ba1565b9050600003611ca05767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8483612ee6565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611ce28282612d95565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1793929190612efd565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d425750565b6000611d568260000151836020015161208b565b8260200151611d659190612f2c565b8251909150611d74908261217f565b61ffff166040830152611d88600282612f2c565b8251909150611d97908261217f565b61ffff166060830152611dab600282612f2c565b8251909150611dba90826121a7565b63ffffffff166080830152611dd0600482612f2c565b8251909150600090611de2908361217f565b61ffff169050611df3600283612f2c565b60a084018190529150611e068183612f2c565b60c0909301929092525050565b60008151601414611e2357600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5657611e566127b1565b604051908082528060200260200182016040528015611e8957816020015b6060815260200190600190039081611e745790505b50905060005b8281101561200c578415611f54576000848483818110611eb157611eb1612d44565b9050602002810190611ec39190612f3f565b611ed291602491600491612f86565b611edb91612fb0565b9050858114611f525760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127e565b505b60008030868685818110611f6a57611f6a612d44565b9050602002810190611f7c9190612f3f565b604051611f8a929190612b91565b600060405180830381855af49150503d8060008114611fc5576040519150601f19603f3d011682016040523d82523d6000602084013e611fca565b606091505b509150915081611fd957600080fd5b80848481518110611fec57611fec612d44565b60200260200101819052505050808061200490612fce565b915050611e8f565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121d1565b6000815b8351811061209f5761209f612fe7565b60006120ab858361220f565b60ff1690506120bb816001612f2c565b6120c59083612f2c565b9150806000036120d557506120db565b5061208f565b6115ce8382612b7e565b82516060906120f48385612f2c565b11156120ff57600080fd5b60008267ffffffffffffffff81111561211a5761211a6127b1565b6040519080825280601f01601f191660200182016040528015612144576020820181803683370190505b50905060208082019086860101610b02828287612233565b6000612169848484612289565b612174878785612289565b149695505050505050565b815160009061218f836002612f2c565b111561219a57600080fd5b50016002015161ffff1690565b81516000906121b7836004612f2c565b11156121c257600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122ad565b600082828151811061222357612223612d44565b016020015160f81c905092915050565b6020811061226b578151835261224a602084612f2c565b9250612257602083612f2c565b9150612264602082612b7e565b9050612233565b905182516020929092036101000a6000190180199091169116179052565b82516000906122988385612f2c565b11156122a357600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234957506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ef57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c590612ba1565b6000825580601f106124d5575050565b601f0160209004906000526020600020908101906124f391906124f6565b50565b5b8082111561250b57600081556001016124f7565b5090565b80356001600160e01b03198116811461252757600080fd5b919050565b60006020828403121561253e57600080fd5b610e2a8261250f565b60008083601f84011261255957600080fd5b50813567ffffffffffffffff81111561257157600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259e57600080fd5b83359250602084013567ffffffffffffffff8111156125bc57600080fd5b6125c886828701612547565b9497909650939450505050565b6000806000806000606086880312156125ed57600080fd5b85359450602086013567ffffffffffffffff8082111561260c57600080fd5b61261889838a01612547565b9096509450604088013591508082111561263157600080fd5b5061263e88828901612547565b969995985093965092949392505050565b6000806040838503121561266257600080fd5b823591506126726020840161250f565b90509250929050565b6000806040838503121561268e57600080fd5b50508035926020909101359150565b60005b838110156126b85781810151838201526020016126a0565b50506000910152565b600081518084526126d981602086016020860161269d565b601f01601f19169290920160200192915050565b8281526040602082015260006115ce60408301846126c1565b60008060006060848603121561271b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274457600080fd5b5035919050565b602081526000610e2a60208301846126c1565b6000806000806060858703121561277457600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279957600080fd5b6127a587828801612547565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127dc57600080fd5b8335925060208401359150604084013567ffffffffffffffff8082111561280257600080fd5b818601915086601f83011261281657600080fd5b813581811115612828576128286127b1565b604051601f8201601f19908116603f01168101908382118183101715612850576128506127b1565b8160405282815289602084870101111561286957600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f357600080fd5b8035801515811461252757600080fd5b600080604083850312156128c357600080fd5b82356128ce8161288b565b9150612672602084016128a0565b6000806000606084860312156128f157600080fd5b8335925060208401356129038161288b565b9150612911604085016128a0565b90509250925092565b60008060006060848603121561292f57600080fd5b8335925060208401359150604084013561ffff8116811461294f57600080fd5b809150509250925092565b60008060006060848603121561296f57600080fd5b833561297a8161288b565b925060208401359150604084013561294f8161288b565b60008083601f8401126129a357600080fd5b50813567ffffffffffffffff8111156129bb57600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e957600080fd5b823567ffffffffffffffff811115612a0057600080fd5b612a0c85828601612991565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6d57603f19888603018452612a5b8583516126c1565b94509285019290850190600101612a3f565b5092979650505050505050565b60008060408385031215612a8d57600080fd5b823591506020830135612a9f8161288b565b809150509250929050565b600080600060408486031215612abf57600080fd5b83359250602084013567ffffffffffffffff811115612add57600080fd5b6125c886828701612991565b600080600060608486031215612afe57600080fd5b83359250612b0e6020850161250f565b9150604084013561294f8161288b565b60008060408385031215612b3157600080fd5b8235612b3c8161288b565b91506020830135612a9f8161288b565b60008251612b5e81846020870161269d565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b68565b8183823760009101908152919050565b600181811c90821680612bb557607f821691505b602082108103612bd557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115bc57600081815260208120601f850160051c81016020861015612c025750805b601f850160051c820191505b81811015612c2157828155600101612c0e565b505050505050565b67ffffffffffffffff831115612c4157612c416127b1565b612c5583612c4f8354612ba1565b83612bdb565b6000601f841160018114612c895760008515612c715750838201355b600019600387901b1c1916600186901b1783556111fd565b600083815260209020601f19861690835b82811015612cba5786850135825560209485019460019092019101612c9a565b5086821015612cd75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d26604083018688612ce9565b8281036020840152612d39818587612ce9565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115ce602083018486612ce9565b600067ffffffffffffffff808316818103612d8b57612d8b612b68565b6001019392505050565b815167ffffffffffffffff811115612daf57612daf6127b1565b612dc381612dbd8454612ba1565b84612bdb565b602080601f831160018114612df85760008415612de05750858301515b600019600386901b1c1916600185901b178555612c21565b600085815260208120601f198616915b82811015612e2757888601518255948401946001909101908401612e08565b5085821015612e455787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6860408301866126c1565b8281036020840152612e7b818587612ce9565b9695505050505050565b600060208284031215612e9757600080fd5b8151610e2a8161288b565b600061ffff821680612eb657612eb6612b68565b6000190192915050565b604081526000612ed360408301856126c1565b905061ffff831660208301529392505050565b600061ffff808316818103612d8b57612d8b612b68565b606081526000612f1060608301866126c1565b61ffff851660208401528281036040840152612e7b81856126c1565b8082018082111561058457610584612b68565b6000808335601e19843603018112612f5657600080fd5b83018035915067ffffffffffffffff821115612f7157600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9657600080fd5b83861115612fa357600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fe057612fe0612b68565b5060010190565b634e487b7160e01b600052600160045260246000fdfea26469706673582212200c3e3b1387abb2b640b74741abfd956c83c48988e9ab32af86659298b069a04264736f6c63430008110033' - ), - { - types: ['address', 'address', 'address', 'address'], - values: [ - vnsRegistry, - ZERO_ADDRESS, - vnsRegistrar, - vnsReverseRegistrar - ] - } - ); - - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [contract] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - const txReceipt = await thorSoloClient.transactions.waitForTransaction( - tx.id - ); - return txReceipt?.outputs[0].contractAddress ?? ''; - })(); - console.log('Deployed Public Resolver to', vnsPublicResolver); - - await (async () => { - const vnsReverseRegistrarAddress = Address.of(vnsReverseRegistrar); - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [ - Clause.callFunction( - vnsReverseRegistrarAddress, - ABIItem.ofSignature( - ABIFunction, - 'function setDefaultResolver(address resolver)' - ), - [vnsPublicResolver] - ) - ] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - await thorSoloClient.transactions.waitForTransaction(tx.id); - })(); - console.log('Set Default Resolver'); - - const vnsResolveUtils = await (async () => { - const contract = Clause.deployContract( - HexUInt.of( - '0x608060405234801561001057600080fd5b5060405161108338038061108383398101604081905261002f91610108565b600080546001600160a01b0319166001600160a01b0383169081179091556040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526302571be390602401602060405180830381865afa1580156100a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ca9190610108565b600180546001600160a01b0319166001600160a01b03929092169190911790555061012c565b6001600160a01b038116811461010557600080fd5b50565b60006020828403121561011a57600080fd5b8151610125816100f0565b9392505050565b610f488061013b6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80638809a5ad14610046578063cbf8b66c1461006f578063cffe244a1461008f575b600080fd5b610059610054366004610a1a565b6100af565b6040516100669190610b21565b60405180910390f35b61008261007d366004610b65565b61015a565b6040516100669190610bfe565b6100a261009d366004610a1a565b61048c565b6040516100669190610c78565b6060815167ffffffffffffffff8111156100cb576100cb6109ab565b6040519080825280602002602001820160405280156100f4578160200160208202803683370190505b50905060005b82518110156101545761012583828151811061011857610118610cb9565b6020026020010151610646565b82828151811061013757610137610cb9565b60209081029190910101528061014c81610ce5565b9150506100fa565b50919050565b60608167ffffffffffffffff811115610175576101756109ab565b6040519080825280602002602001820160405280156101a857816020015b60608152602001906001900390816101935790505b50905060005b828110156104845760006101e78585848181106101cd576101cd610cb9565b90506020020160208101906101e29190610d16565b610748565b60008054604051630178b8bf60e01b81526004810184905292935090916001600160a01b0390911690630178b8bf90602401602060405180830381865afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190610d3a565b90506001600160a01b0381161561046f576040517f691f34310000000000000000000000000000000000000000000000000000000081526004810183905281906000906001600160a01b0383169063691f343190602401600060405180830381865afa1580156102ce573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102f69190810190610d57565b9050805160000361030a5750505050610472565b600061031582610646565b60008054604051630178b8bf60e01b81526004810184905292935090916001600160a01b0390911690630178b8bf90602401602060405180830381865afa158015610364573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103889190610d3a565b90506001600160a01b0381161561046a57604051631d9dabef60e11b81526004810183905281906000906001600160a01b03831690633b3b57de90602401602060405180830381865afa1580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190610d3a565b90508b8b8a81811061041b5761041b610cb9565b90506020020160208101906104309190610d16565b6001600160a01b0316816001600160a01b03160361046757848a8a8151811061045b5761045b610cb9565b60200260200101819052505b50505b505050505b50505b8061047c81610ce5565b9150506101ae565b505b92915050565b6060815167ffffffffffffffff8111156104a8576104a86109ab565b6040519080825280602002602001820160405280156104d1578160200160208202803683370190505b50905060005b82518110156101545760006104f784838151811061011857610118610cb9565b60008054604051630178b8bf60e01b81526004810184905292935090916001600160a01b0390911690630178b8bf90602401602060405180830381865afa158015610546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056a9190610d3a565b90506001600160a01b0381161561063157604051631d9dabef60e11b81526004810183905281906000906001600160a01b03831690633b3b57de90602401602060405180830381865afa1580156105c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e99190610d3a565b90506001600160a01b0381161561062e578086868151811061060d5761060d610cb9565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50505b5050808061063e90610ce5565b9150506104d7565b60008061067a8360408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b604080518082018252600181527f2e00000000000000000000000000000000000000000000000000000000000000602080830191825283518085018552600080825290820181905284518086018652935184528382019290925283518085019094528184528301529192506106f08383836107a3565b505b805115610740578051602082015120849060408051602081019390935282015260600160408051601f198184030181529190528051602090910120935061073a8383836107a3565b506106f2565b505050919050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e261077483610839565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b604080518082019091526000808252602082015260006107d5856000015186602001518660000151876020015161089d565b60208085018290528601519091506107ed9082610dce565b85516107f99190610dce565b83526020850151810361080f5760008552610830565b8351835161081d9190610de1565b8551869061082c908390610dce565b9052505b50909392505050565b60007f303132333435363738396162636465660000000000000000000000000000000060285b80156108905760001901600f841682901a815360109093049260001901600f841682901a815360108404935061085f565b5050602860002092915050565b60008085841161099e576020841161094a57600060016108be866020610dce565b6108c9906008610df4565b6108d4906002610eef565b6108de9190610dce565b8451901991508116856108f18989610de1565b6108fb9190610dce565b805190935082165b8181146109355787841161091d57879450505050506109a3565b8361092781610efb565b945050828451169050610903565b61093f8785610de1565b9450505050506109a3565b8383206109578588610dce565b6109619087610de1565b91505b85821061099c578482208082036109895761097f8684610de1565b93505050506109a3565b610994600184610dce565b925050610964565b505b849150505b949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156109ea576109ea6109ab565b604052919050565b600067ffffffffffffffff821115610a0c57610a0c6109ab565b50601f01601f191660200190565b60006020808385031215610a2d57600080fd5b823567ffffffffffffffff80821115610a4557600080fd5b818501915085601f830112610a5957600080fd5b813581811115610a6b57610a6b6109ab565b8060051b610a7a8582016109c1565b9182528381018501918581019089841115610a9457600080fd5b86860192505b83831015610b1457823585811115610ab25760008081fd5b8601603f81018b13610ac45760008081fd5b878101356040610adb610ad6836109f2565b6109c1565b8281528d82848601011115610af05760008081fd5b828285018c83013760009281018b0192909252508352509186019190860190610a9a565b9998505050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610b5957835183529284019291840191600101610b3d565b50909695505050505050565b60008060208385031215610b7857600080fd5b823567ffffffffffffffff80821115610b9057600080fd5b818501915085601f830112610ba457600080fd5b813581811115610bb357600080fd5b8660208260051b8501011115610bc857600080fd5b60209290920196919550909350505050565b60005b83811015610bf5578181015183820152602001610bdd565b50506000910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015610c6b57878503603f1901845281518051808752610c4c818989018a8501610bda565b601f01601f191695909501860194509285019290850190600101610c25565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610b595783516001600160a01b031683529284019291840191600101610c94565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610cf757610cf7610ccf565b5060010190565b6001600160a01b0381168114610d1357600080fd5b50565b600060208284031215610d2857600080fd5b8135610d3381610cfe565b9392505050565b600060208284031215610d4c57600080fd5b8151610d3381610cfe565b600060208284031215610d6957600080fd5b815167ffffffffffffffff811115610d8057600080fd5b8201601f81018413610d9157600080fd5b8051610d9f610ad6826109f2565b818152856020838501011115610db457600080fd5b610dc5826020830160208601610bda565b95945050505050565b8181038181111561048657610486610ccf565b8082018082111561048657610486610ccf565b808202811582820484141761048657610486610ccf565b600181815b80851115610e46578160001904821115610e2c57610e2c610ccf565b80851615610e3957918102915b93841c9390800290610e10565b509250929050565b600082610e5d57506001610486565b81610e6a57506000610486565b8160018114610e805760028114610e8a57610ea6565b6001915050610486565b60ff841115610e9b57610e9b610ccf565b50506001821b610486565b5060208310610133831016604e8410600b8410161715610ec9575081810a610486565b610ed38383610e0b565b8060001904821115610ee757610ee7610ccf565b029392505050565b6000610d338383610e4e565b600081610f0a57610f0a610ccf565b50600019019056fea26469706673582212200661929524507140d95d3c1a563503b80d9bdaa9a3f04320ed9a5af5181c7ae664736f6c63430008110033' - ), - { - types: ['address'], - values: [vnsRegistry] - } - ); - - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [contract] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - const txReceipt = await thorSoloClient.transactions.waitForTransaction( - tx.id - ); - return txReceipt?.outputs[0].contractAddress ?? ''; - })(); - console.log('Deployed Resolve Utilities to', vnsResolveUtils); - - const registerName = async ( - name: string, - address: string - ): Promise => { - const fullName = [name, tld].join('.'); - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [ - Clause.callFunction( - Address.of(vnsRegistrar), - ABIItem.ofSignature( - ABIFunction, - 'function register(bytes32 id, address owner)' - ), - [id(name), address] - ), - Clause.callFunction( - Address.of(vnsRegistry), - ABIItem.ofSignature( - ABIFunction, - 'function setResolver(bytes32 node, address resolver)' - ), - [namehash(fullName), vnsPublicResolver] - ), - Clause.callFunction( - Address.of(vnsPublicResolver), - ABIItem.ofSignature( - ABIFunction, - 'function setAddr(bytes32 node, address addr)' - ), - [namehash(fullName), address] - ), - Clause.callFunction( - Address.of(vnsReverseRegistrar), - ABIItem.ofSignature( - ABIFunction, - 'function setNameForAddr(address addr, address owner, address resolver, string name)' - ), - [address, address, vnsPublicResolver, fullName] - ) - ] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - const receipt = await thorSoloClient.transactions.waitForTransaction( - tx.id - ); - if (receipt?.reverted === true) { - throw new Error(`Registration for ${fullName} reverted`); - } - console.log('Registered', fullName, 'to', address); - }; - - const registerSubName = async ( - name: string, - parentName: string, - address: string - ): Promise => { - const fullName = [name, parentName, tld].join('.'); - const vnsRegistryAddress = Address.of(vnsRegistry); - const tx = await thorSoloClient.transactions.sendTransaction( - Transaction.of({ - ...txBody, - nonce: ++nonce, - clauses: [ - Clause.callFunction( - vnsRegistryAddress, - ABIItem.ofSignature( - ABIFunction, - 'function setSubnodeOwner(bytes32 node, bytes32 label, address owner)' - ), - [ - namehash(`${parentName}.${tld}`), - id(name), - THOR_SOLO_ACCOUNTS[4].address - ] - ), - Clause.callFunction( - vnsRegistryAddress, - ABIItem.ofSignature( - ABIFunction, - 'function setResolver(bytes32 node, address resolver)' - ), - [namehash(fullName), vnsPublicResolver] - ), - Clause.callFunction( - Address.of(vnsPublicResolver), - ABIItem.ofSignature( - ABIFunction, - 'function setAddr(bytes32 node, address addr)' - ), - [namehash(fullName), address] - ) - ] - }).sign(HexUInt.of(THOR_SOLO_ACCOUNTS[4].privateKey).bytes) - ); - - const receipt = await thorSoloClient.transactions.waitForTransaction( - tx.id - ); - if (receipt?.reverted === true) { - throw new Error(`Registration for ${fullName} reverted`); - } - console.log('Registered', fullName, 'to', address); - }; - - await registerName('test-sdk', THOR_SOLO_ACCOUNTS[4].address); - - await registerSubName( - 'vtho', - `test-sdk`, - '0x0000000000000000000000000000456E65726779' - ); - await registerSubName( - 'params', - `test-sdk`, - '0x0000000000000000000000000000506172616D73' - ); -}; - -/** - * Distributes balances of VTHO and VET to the first 10 accounts. - * - * @remarks - * This function signs and sends transactions to distribute VTHO and VET tokens - * to the first 10 accounts in the `THOR_SOLO_ACCOUNTS` array. It uses the ThorestClient - * to interact with the VeChainThor blockchain. - * - * @returns A Promise that resolves when all transactions have been processed. - */ -const seedThorSolo = async (): Promise => { - const thorSoloClient = ThorClient.at(THOR_SOLO_URL); - - console.log( - "Distributing balances to the first 10 accounts in the 'THOR_SOLO_ACCOUNTS' array:" - ); - - let lastTxId = ''; - for (const tx of txs) { - const resp = await thorSoloClient.transactions.sendTransaction(tx); - - console.log(resp.id); // Print the transaction id - - lastTxId = resp.id; - } - - // Wait for the last transaction to be confirmed - await thorSoloClient.transactions.waitForTransaction(lastTxId); - - // Check that the balances have been distributed - for (const account of THOR_SOLO_ACCOUNTS) { - const accountInfo = await thorSoloClient.accounts.getAccount( - account.address - ); - - expect(BigInt(accountInfo.balance)).toBeGreaterThanOrEqual( - Units.parseEther('500000000').bi - ); - - expect(BigInt(accountInfo.energy)).toBeGreaterThanOrEqual( - Units.parseEther('500000000').bi - ); - } - - // Deploy the test contract - const deployTx = deployTestContractTransaction(); - - const simulations = await thorSoloClient.gas.estimateGas( - deployTx.body.clauses, - THOR_SOLO_ACCOUNTS[4].address - ); - - console.log('Deploy contract simulation: ', stringifyData(simulations)); - - const resp = await thorSoloClient.transactions.sendTransaction(deployTx); - - console.log('Deploy contract tx ID: ', resp.id); - - // Wait 5 seconds - await new Promise((resolve) => setTimeout(resolve, 5000)); - - // Wait for the contract to be deployed - const txReceipt = await thorSoloClient.transactions.waitForTransaction( - resp.id - ); - - console.log( - 'Deployed contract address:', - txReceipt?.outputs[0].contractAddress - ); - - console.log('Seeding complete. You can now dump the thor-solo database.'); -}; - -export { seedThorSolo, seedVnsSolo }; diff --git a/packages/network/src/http/SimpleHttpClient.ts b/packages/network/src/http/SimpleHttpClient.ts index 93009263d..69b83a600 100644 --- a/packages/network/src/http/SimpleHttpClient.ts +++ b/packages/network/src/http/SimpleHttpClient.ts @@ -65,7 +65,7 @@ class SimpleHttpClient implements HttpClient { * Executes an HTTP request with the specified method, path, and optional parameters. * * @param {HttpMethod} method - The HTTP method to use for the request (e.g., GET, POST). - * @param {string} path - The URL path for the request. + * @param {string} path - The URL path for the request. Leading slashes will be automatically removed. * @param {HttpParams} [params] - Optional parameters for the request, * including query parameters, headers, body, and response validation. * {@link HttpParams.headers} override {@link SimpleHttpClient.headers}. @@ -82,7 +82,16 @@ class SimpleHttpClient implements HttpClient { controller.abort(); }, this.timeout); try { - const url = new URL(path, this.baseURL); + // Remove leading slash from path + if (path.startsWith('/')) { + path = path.slice(1); + } + // Add trailing slash from baseURL if not present + let baseURL = this.baseURL; + if (!this.baseURL.endsWith('/')) { + baseURL += '/'; + } + const url = new URL(path, baseURL); if (params?.query != null) { Object.entries(params.query).forEach(([key, value]) => { url.searchParams.append(key, String(value)); diff --git a/packages/network/tests/http/SimpleHttpClient.testnet.test.ts b/packages/network/tests/http/SimpleHttpClient.testnet.test.ts index deeae37e7..be70cbeb8 100644 --- a/packages/network/tests/http/SimpleHttpClient.testnet.test.ts +++ b/packages/network/tests/http/SimpleHttpClient.testnet.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from '@jest/globals'; -import { SimpleHttpClient } from '../../src/http'; +import { HttpMethod, SimpleHttpClient } from '../../src/http'; import { TESTNET_URL } from '../../src'; import { ZERO_ADDRESS } from '../fixture'; import { stringifyData } from '@vechain/sdk-errors'; @@ -52,6 +52,18 @@ describe('SimpleHttpClient testnet tests', () => { TIMEOUT ); + test('Test http without leading slash', async () => { + const httpClient = new SimpleHttpClient(TESTNET_URL); + const resp = await httpClient.http(HttpMethod.GET, 'blocks/best'); + expect(resp).toBeDefined(); + }); + + test('Test http with leading slash', async () => { + const httpClient = new SimpleHttpClient(TESTNET_URL); + const resp = await httpClient.http(HttpMethod.GET, '/blocks/best'); + expect(resp).toBeDefined(); + }); + /* NOTE: this test doesn't succeed in CI/CD. Enable locally to challenge a real time-out calling testnet. diff --git a/packages/network/tests/seeding/seeding.solo.test.ts b/packages/network/tests/seeding/seeding.solo.test.ts deleted file mode 100644 index 65a0c7de3..000000000 --- a/packages/network/tests/seeding/seeding.solo.test.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { describe, test } from '@jest/globals'; -import { seedThorSolo, seedVnsSolo } from '../../solo-seeding'; - -/** - * Test suite for seeding thor solo - * - * @group seeding - */ -describe('Seeding', () => { - /** - * Test case useful for invoking the seeding script manually. - */ - test('Should seed thor solo', async () => { - await seedThorSolo(); - }, 20000); - - test('Should seed vns for thor solo', async () => { - await seedVnsSolo(); - }, 30000); -}); diff --git a/packages/rpc-proxy/package.json b/packages/rpc-proxy/package.json index c8d618b33..dd0dcf2a7 100644 --- a/packages/rpc-proxy/package.json +++ b/packages/rpc-proxy/package.json @@ -1,6 +1,6 @@ { "name": "@vechain/sdk-rpc-proxy", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.6", "description": "Proxy Thor's RESTful API to Eth JSON-RPC", "author": "VeChain Foundation", "license": "MIT", @@ -39,10 +39,10 @@ "test:browser": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit --config ./jest.config.browser.js" }, "dependencies": { - "@vechain/sdk-core": "1.0.0-rc.4", - "@vechain/sdk-errors": "1.0.0-rc.4", - "@vechain/sdk-logging": "1.0.0-rc.4", - "@vechain/sdk-network": "1.0.0-rc.4", + "@vechain/sdk-core": "1.0.0-rc.6", + "@vechain/sdk-errors": "1.0.0-rc.6", + "@vechain/sdk-logging": "1.0.0-rc.6", + "@vechain/sdk-network": "1.0.0-rc.6", "commander": "^12.1.0", "cors": "^2.8.5", "express": "^4.21.2"