From e9cfe5c8e036a64576e0e062f74e272db058d798 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Mon, 16 Sep 2024 18:16:57 +0530 Subject: [PATCH 01/33] fix: remove typegen artifacts from create-fuels gitignore --- templates/nextjs/.gitignore | 5 - templates/nextjs/gitignore | 5 - .../src/sway-api/contracts/TestContract.ts | 109 ++++++++++++++++++ .../sway-api/contracts/TestContractFactory.ts | 44 +++++++ .../nextjs/src/sway-api/contracts/index.ts | 14 +++ templates/nextjs/src/sway-api/index.ts | 3 + .../src/sway-api/predicates/TestPredicate.ts | 96 +++++++++++++++ .../nextjs/src/sway-api/predicates/index.ts | 13 +++ .../nextjs/src/sway-api/scripts/TestScript.ts | 63 ++++++++++ .../nextjs/src/sway-api/scripts/index.ts | 13 +++ templates/vite/.gitignore | 5 - templates/vite/gitignore | 5 - .../src/sway-api/contracts/TestContract.ts | 109 ++++++++++++++++++ .../sway-api/contracts/TestContractFactory.ts | 44 +++++++ .../vite/src/sway-api/contracts/index.ts | 14 +++ templates/vite/src/sway-api/index.ts | 3 + .../src/sway-api/predicates/TestPredicate.ts | 96 +++++++++++++++ .../vite/src/sway-api/predicates/index.ts | 13 +++ .../vite/src/sway-api/scripts/TestScript.ts | 63 ++++++++++ templates/vite/src/sway-api/scripts/index.ts | 13 +++ 20 files changed, 710 insertions(+), 20 deletions(-) create mode 100644 templates/nextjs/src/sway-api/contracts/TestContract.ts create mode 100644 templates/nextjs/src/sway-api/contracts/TestContractFactory.ts create mode 100644 templates/nextjs/src/sway-api/contracts/index.ts create mode 100644 templates/nextjs/src/sway-api/index.ts create mode 100644 templates/nextjs/src/sway-api/predicates/TestPredicate.ts create mode 100644 templates/nextjs/src/sway-api/predicates/index.ts create mode 100644 templates/nextjs/src/sway-api/scripts/TestScript.ts create mode 100644 templates/nextjs/src/sway-api/scripts/index.ts create mode 100644 templates/vite/src/sway-api/contracts/TestContract.ts create mode 100644 templates/vite/src/sway-api/contracts/TestContractFactory.ts create mode 100644 templates/vite/src/sway-api/contracts/index.ts create mode 100644 templates/vite/src/sway-api/index.ts create mode 100644 templates/vite/src/sway-api/predicates/TestPredicate.ts create mode 100644 templates/vite/src/sway-api/predicates/index.ts create mode 100644 templates/vite/src/sway-api/scripts/TestScript.ts create mode 100644 templates/vite/src/sway-api/scripts/index.ts diff --git a/templates/nextjs/.gitignore b/templates/nextjs/.gitignore index 993cdb130df..85b68a9b40e 100644 --- a/templates/nextjs/.gitignore +++ b/templates/nextjs/.gitignore @@ -34,11 +34,6 @@ yarn-error.log* .fuels -src/sway-api/contracts -src/sway-api/predicates -src/sway-api/scripts -src/sway-api/index.ts - sway-programs/**/out .turbo diff --git a/templates/nextjs/gitignore b/templates/nextjs/gitignore index 1be56e10fab..efa80889beb 100644 --- a/templates/nextjs/gitignore +++ b/templates/nextjs/gitignore @@ -35,11 +35,6 @@ next-env.d.ts .fuels -src/sway-api/contracts -src/sway-api/predicates -src/sway-api/scripts -src/sway-api/index.ts - sway-programs/**/out .turbo diff --git a/templates/nextjs/src/sway-api/contracts/TestContract.ts b/templates/nextjs/src/sway-api/contracts/TestContract.ts new file mode 100644 index 00000000000..7279f000416 --- /dev/null +++ b/templates/nextjs/src/sway-api/contracts/TestContract.ts @@ -0,0 +1,109 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +import { Contract, Interface } from "fuels"; +import type { + Provider, + Account, + StorageSlot, + AbstractAddress, + BigNumberish, + BN, + FunctionFragment, + InvokeFunction, +} from 'fuels'; + +const abi = { + "programType": "contract", + "specVersion": "1", + "encodingVersion": "1", + "concreteTypes": [ + { + "type": "u64", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "metadataTypes": [], + "functions": [ + { + "inputs": [], + "name": "get_count", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "amount", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "increment_counter", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "storage", + "arguments": [ + "write", + "read" + ] + } + ] + } + ], + "loggedTypes": [], + "messagesTypes": [], + "configurables": [] +}; + +const storageSlots: StorageSlot[] = [ + { + "key": "6e3c7b4f69bbff7132c3c3a62883a6868f47b0bc2a7f21605f29038cd9a5e05f", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + } +]; + +export class TestContractInterface extends Interface { + constructor() { + super(abi); + } + + declare functions: { + get_count: FunctionFragment; + increment_counter: FunctionFragment; + }; +} + +export class TestContract extends Contract { + static readonly abi = abi; + static readonly storageSlots = storageSlots; + + declare interface: TestContractInterface; + declare functions: { + get_count: InvokeFunction<[], BN>; + increment_counter: InvokeFunction<[amount: BigNumberish], BN>; + }; + + constructor( + id: string | AbstractAddress, + accountOrProvider: Account | Provider, + ) { + super(id, abi, accountOrProvider); + } +} diff --git a/templates/nextjs/src/sway-api/contracts/TestContractFactory.ts b/templates/nextjs/src/sway-api/contracts/TestContractFactory.ts new file mode 100644 index 00000000000..e41421d5cc1 --- /dev/null +++ b/templates/nextjs/src/sway-api/contracts/TestContractFactory.ts @@ -0,0 +1,44 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +import { Contract, ContractFactory, decompressBytecode } from "fuels"; +import type { Provider, Account, DeployContractOptions, DeployContractResult } from "fuels"; + +import { TestContract } from "./TestContract"; + +const bytecode = decompressBytecode("H4sIAAAAAAAAA61YX2gcVRe/u91t1zRNJsmGb7/JJ5lP1roK4qJpSVXIDLvj7Ha77I1pbNRud0GLKWiNSxOKohktSB4Eo6D2zYoo+ja76UNBHxZ88cGHIj5UUIgPSoMN7INCgg/1d+69s51ONopgYLl37p9zzj33d37n3OidLDvHWJSJv6HJ6s12RLt5k8aYfoOzd1gs2zDZ0domi+hmnaF9rep4r1VzXqRRYIkxK800K0njLsZcfYMxY+shNvfHepT/sR47xyIP6LmrNP8G5t/gjldHv5/n1jK0P2MlXe6snRd9O+ZCVxHzTOlaxp5l6GNCl502NStmYvx1jL/eQ1dS6bqA+QvQtYL+EHRlA7q+9nVh/OseMkZ1h2Ror2Lt9WrJe5VXvPMNjj3lOOPT2UTjOPrToybkaxjXMvYhxiuXDdEvj7JqmbGxQtLVihNuzTIY9ExCp6b0XxN90u80235f39DCdiToLGQDL3nzOMcBbhmJxjFxjjbPeUYjTzLTsGOt0JWZW5vzdVWdTp9ma21eWnOxT8sUY+h7HGfrw9470O7HGdbFnJ3GXGuyuy7XKog+dOkbBtN/DvuJbZF9SyZ7u5rr7Ncs1uaVNZeXmpOw9R7c4xDaDM81V2/Z2ZK22RNY15r3ddHZ9Z+NsPx1JT8KWa8cNhn58fzO+2KfSz95q9A3jDXzgbte8O8aNvaTjdVS54BWNNrVSmdAK2fb1ZnOoDZttvmJtXZjDmtnR+E37zw/4V3Et5GZjbu1G+w/3OIZ8W3dDR+3CK+FjHW8F97vURh8GXfUwTrsAQ5usLt4kWVwZiNTzMMO72UNeIY9mrJniOzhM80O8FXITMdNfcOEX8K4iH4LnxbgU8hNm5B7P7chl/SQX50WYaqwC6aYsm0R8bEI/Hlkfw8dpvKpGcCV18Vwrrnu93vcx1Nib2ktJe9X4ickf4Vi7G4rrHdPv7KvAfsasO/SLvallH0U1759FwP2Xf0L+x5U9lEs7WZf3bfvPcb2vZ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A5w6rvTsyK/+u+IgMKGbC3+bT0N5iXzRJn0BXT737QnrQu6OheTv2RkXkYti/dMUF9CRj7GDwLaeXyDcLADvAzSGdhD+0ODjFPiZ3gdXcJaU5Lsm+SRF+MKdEZenZM3tUZ2kxr0Vf7w64w0h1oaBxRHyhwbsjyLOUG9EiBcwFh0rT7gHjzGWuTNv6nyBacW8WaMawsR6vMkIM7VNU0fOHMMd/U/liJTEjbcl+pJbCZ9qvEmx5o/TN/Gn+vaI7/39xEdiHPySBM9qOMt16Lkz9E6p36r/m1SPCw4THPdkEndbBy7g320ext+/UdvsGwY3/kV9E+Q+WZOdwB2D91S8+flQ5arbuWORsUuKO0in4A6cke6T9u2oObD+w1BOPCq4TGBWYKG+W05EvjgTqHn9nEg8oHJi85qaUzmxeZW+QzlR7A/lRHoL9syJsPcXlROnSD6wOAVefhi8tir5Je4esWPfnsJ7HXKmME/vhe47XdTJ8qzE/dGaxSmnxU7JNiq56LgZku2JfFuOm4+UY4/D3sQpG/74TeQv1MA7eCqIk1U9h5h2OsP07sXbaoTeVpKLkm3iLMiTbzDytyPwXKD43HlX0SLdreKtVX2b3Yad506fqz3z4uJZqvfp78zZZxqnXzh9Vo2ebqjxs4++Ujnzxc2XHvzqq08zFz59823H+/K+5f/Xa/fueev7T9Zr34g///8vg3OqVbsHlPiB51X7rGpPyvbAD6r9Tm1YUa37Jxdjjh/YEQAA"); + +export class TestContractFactory extends ContractFactory { + + static readonly bytecode = bytecode; + + constructor(accountOrProvider: Account | Provider) { + super(bytecode, TestContract.abi, accountOrProvider); + } + + deploy( + deployOptions?: DeployContractOptions + ): Promise> { + return super.deploy({ + storageSlots: TestContract.storageSlots, + ...deployOptions, + }); + } + + static async deploy ( + wallet: Account, + options: DeployContractOptions = {} + ): Promise> { + const factory = new TestContractFactory(wallet); + return factory.deploy(options); + } +} diff --git a/templates/nextjs/src/sway-api/contracts/index.ts b/templates/nextjs/src/sway-api/contracts/index.ts new file mode 100644 index 00000000000..4ecc3c0fde5 --- /dev/null +++ b/templates/nextjs/src/sway-api/contracts/index.ts @@ -0,0 +1,14 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +export { TestContract } from './TestContract'; +export { TestContractFactory } from './TestContractFactory'; diff --git a/templates/nextjs/src/sway-api/index.ts b/templates/nextjs/src/sway-api/index.ts new file mode 100644 index 00000000000..af6e5049ced --- /dev/null +++ b/templates/nextjs/src/sway-api/index.ts @@ -0,0 +1,3 @@ +export * from './contracts'; +export * from './scripts'; +export * from './predicates'; diff --git a/templates/nextjs/src/sway-api/predicates/TestPredicate.ts b/templates/nextjs/src/sway-api/predicates/TestPredicate.ts new file mode 100644 index 00000000000..2041e1ca1b6 --- /dev/null +++ b/templates/nextjs/src/sway-api/predicates/TestPredicate.ts @@ -0,0 +1,96 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +import { + BigNumberish, + BN, + decompressBytecode, + InputValue, + Predicate, + PredicateParams, + Provider, +} from 'fuels'; + +export type TestPredicateConfigurables = undefined; + +export type TestPredicateInputs = [password: BigNumberish]; + +export type TestPredicateParameters = Omit< + PredicateParams, + 'abi' | 'bytecode' +>; + +const abi = { + "programType": "predicate", + "specVersion": "1", + "encodingVersion": "1", + "concreteTypes": [ + { + "type": "bool", + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + }, + { + "type": "u64", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "metadataTypes": [], + "functions": [ + { + "inputs": [ + { + "name": "password", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "main", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This predicate checks if the given password is 1337." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " If it is, the predicate is 'unlocked' and the transaction is allowed to proceed." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " Otherwise, it is reverted." + ] + } + ] + } + ], + "loggedTypes": [], + "messagesTypes": [], + "configurables": [] +}; + +const bytecode = decompressBytecode('H4sIAAAAAAAAA01QP0vDQBx9iRGDjTaQDuVcinTIWBBEtwtpSWyWGzsYxc1Rg4hjvoKDf0Y/wg1+AD+CHyGrYMFFaOmQvhy05ODg3fu99+7xE38jPAA2zLGe8vrL8usa4lfhGSjvJXau5/DyTHs30TFUovtXE0DFun8ZAQHvo0SweRdj2EHkSHLWKRPpmdJ/yPkdvX6Rwg0nTsn3wOCoV6pMh/S54YUj2cWlx6PngJpbw88daTSSOPts/h4ZPhpKZp61MmebzDzWnZx9mNNtcKM/Gvekz27kOuS69LrEFn1y2yXRaStPtfL2xQ8wWJxgtqpstaqcZm8i/sZQAi/A3qsLszcRf0AkFYp095y7KMU/+aWPd87fqJsugDV20P+heAEAAA=='); + +export class TestPredicate extends Predicate< + TestPredicateInputs, + TestPredicateConfigurables +> { + static readonly abi = abi; + static readonly bytecode = bytecode; + + constructor(params: TestPredicateParameters) { + super({ abi, bytecode, ...params }); + } +} diff --git a/templates/nextjs/src/sway-api/predicates/index.ts b/templates/nextjs/src/sway-api/predicates/index.ts new file mode 100644 index 00000000000..18cd4f0d9bd --- /dev/null +++ b/templates/nextjs/src/sway-api/predicates/index.ts @@ -0,0 +1,13 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +export { TestPredicate } from './TestPredicate'; diff --git a/templates/nextjs/src/sway-api/scripts/TestScript.ts b/templates/nextjs/src/sway-api/scripts/TestScript.ts new file mode 100644 index 00000000000..07f21e346a8 --- /dev/null +++ b/templates/nextjs/src/sway-api/scripts/TestScript.ts @@ -0,0 +1,63 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +import { + Account, + BigNumberish, + BN, + decompressBytecode, + Script, +} from 'fuels'; + +export type TestScriptInputs = [input: BigNumberish]; +export type TestScriptOutput = BN; + +const abi = { + "programType": "script", + "specVersion": "1", + "encodingVersion": "1", + "concreteTypes": [ + { + "type": "u64", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "metadataTypes": [], + "functions": [ + { + "inputs": [ + { + "name": "input", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "main", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": null + } + ], + "loggedTypes": [], + "messagesTypes": [], + "configurables": [] +}; + +const bytecode = decompressBytecode('H4sIAAAAAAAAA02Sv4sTQRzFX9YVgo2jbiTMeZricmwZsFGvcJbdsFlDcA4DWjhs7CzDInLl/glaqFdaWs6ChaWl5ZWW2wq3YCNErohvNobcNPPmM98fb76M/D3CG8BDu7yFWX/viPUa8lzjPTyhn1b6lcK1vMFj7j73hzquVjq1y2KCbjj2Sz2tFoWizgLw7meRUEcHysT2yEQAcyKnHd9LAiUiX5EdkUWsc0J9nXmv23pRUOq02tWOq7MtZ/wj+QsYrO7jxUXt6Yvap/eXMj5zPVw/VSQ+DhNAJkvoqT3NG3HLMe5Bfo4ePfTD5kCx7w/W7YfpV+f/pNDUWQ/sPWj1eOjy+ztuyy03z60wz+wNk9qbzpvIgrKXDfF2gg79XCXz9o6T8lAD4f5cyfkSIpurPAPcnETEOaW2zht9J2/UPr3f1bEdtX427++2evP+d5d4fYnXPD/Yne1kF2ftlpupva2PheD9Km8G9/QYrjZnm7i4BbX4X+9Lqzd9vm05/YpwFsBEo46ZjTCcAR+AKx+7nDH/iIw/Q6Y15B+e/wqckn/i/ZMVkPJH/QPs/31HYAIAAA=='); + +export class TestScript extends Script { + + static readonly abi = abi; + static readonly bytecode = bytecode; + + constructor(wallet: Account) { + super(bytecode, abi, wallet); + } +} diff --git a/templates/nextjs/src/sway-api/scripts/index.ts b/templates/nextjs/src/sway-api/scripts/index.ts new file mode 100644 index 00000000000..33c8d585069 --- /dev/null +++ b/templates/nextjs/src/sway-api/scripts/index.ts @@ -0,0 +1,13 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +export { TestScript } from './TestScript'; diff --git a/templates/vite/.gitignore b/templates/vite/.gitignore index e88e6b4af18..dea3c7ead68 100644 --- a/templates/vite/.gitignore +++ b/templates/vite/.gitignore @@ -25,11 +25,6 @@ dist-ssr .fuels -src/sway-api/contracts -src/sway-api/predicates -src/sway-api/scripts -src/sway-api/index.ts - sway-programs/**/out .turbo diff --git a/templates/vite/gitignore b/templates/vite/gitignore index e88e6b4af18..dea3c7ead68 100644 --- a/templates/vite/gitignore +++ b/templates/vite/gitignore @@ -25,11 +25,6 @@ dist-ssr .fuels -src/sway-api/contracts -src/sway-api/predicates -src/sway-api/scripts -src/sway-api/index.ts - sway-programs/**/out .turbo diff --git a/templates/vite/src/sway-api/contracts/TestContract.ts b/templates/vite/src/sway-api/contracts/TestContract.ts new file mode 100644 index 00000000000..7279f000416 --- /dev/null +++ b/templates/vite/src/sway-api/contracts/TestContract.ts @@ -0,0 +1,109 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +import { Contract, Interface } from "fuels"; +import type { + Provider, + Account, + StorageSlot, + AbstractAddress, + BigNumberish, + BN, + FunctionFragment, + InvokeFunction, +} from 'fuels'; + +const abi = { + "programType": "contract", + "specVersion": "1", + "encodingVersion": "1", + "concreteTypes": [ + { + "type": "u64", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "metadataTypes": [], + "functions": [ + { + "inputs": [], + "name": "get_count", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "amount", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "increment_counter", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "storage", + "arguments": [ + "write", + "read" + ] + } + ] + } + ], + "loggedTypes": [], + "messagesTypes": [], + "configurables": [] +}; + +const storageSlots: StorageSlot[] = [ + { + "key": "6e3c7b4f69bbff7132c3c3a62883a6868f47b0bc2a7f21605f29038cd9a5e05f", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + } +]; + +export class TestContractInterface extends Interface { + constructor() { + super(abi); + } + + declare functions: { + get_count: FunctionFragment; + increment_counter: FunctionFragment; + }; +} + +export class TestContract extends Contract { + static readonly abi = abi; + static readonly storageSlots = storageSlots; + + declare interface: TestContractInterface; + declare functions: { + get_count: InvokeFunction<[], BN>; + increment_counter: InvokeFunction<[amount: BigNumberish], BN>; + }; + + constructor( + id: string | AbstractAddress, + accountOrProvider: Account | Provider, + ) { + super(id, abi, accountOrProvider); + } +} diff --git a/templates/vite/src/sway-api/contracts/TestContractFactory.ts b/templates/vite/src/sway-api/contracts/TestContractFactory.ts new file mode 100644 index 00000000000..e41421d5cc1 --- /dev/null +++ b/templates/vite/src/sway-api/contracts/TestContractFactory.ts @@ -0,0 +1,44 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +import { Contract, ContractFactory, decompressBytecode } from "fuels"; +import type { Provider, Account, DeployContractOptions, DeployContractResult } from "fuels"; + +import { TestContract } from "./TestContract"; + +const bytecode = decompressBytecode("H4sIAAAAAAAAA61YX2gcVRe/u91t1zRNJsmGb7/JJ5lP1roK4qJpSVXIDLvj7Ha77I1pbNRud0GLKWiNSxOKohktSB4Eo6D2zYoo+ja76UNBHxZ88cGHIj5UUIgPSoMN7INCgg/1d+69s51ONopgYLl37p9zzj33d37n3OidLDvHWJSJv6HJ6s12RLt5k8aYfoOzd1gs2zDZ0domi+hmnaF9rep4r1VzXqRRYIkxK800K0njLsZcfYMxY+shNvfHepT/sR47xyIP6LmrNP8G5t/gjldHv5/n1jK0P2MlXe6snRd9O+ZCVxHzTOlaxp5l6GNCl502NStmYvx1jL/eQ1dS6bqA+QvQtYL+EHRlA7q+9nVh/OseMkZ1h2Ror2Lt9WrJe5VXvPMNjj3lOOPT2UTjOPrToybkaxjXMvYhxiuXDdEvj7JqmbGxQtLVihNuzTIY9ExCp6b0XxN90u80235f39DCdiToLGQDL3nzOMc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v1MA7eCqIk1U9h5h2OsP07sXbaoTeVpKLkm3iLMiTbzDytyPwXKD43HlX0SLdreKtVX2b3Yad506fqz3z4uJZqvfp78zZZxqnXzh9Vo2ebqjxs4++Ujnzxc2XHvzqq08zFz59823H+/K+5f/Xa/fueev7T9Zr34g///8vg3OqVbsHlPiB51X7rGpPyvbAD6r9Tm1YUa37Jxdjjh/YEQAA"); + +export class TestContractFactory extends ContractFactory { + + static readonly bytecode = bytecode; + + constructor(accountOrProvider: Account | Provider) { + super(bytecode, TestContract.abi, accountOrProvider); + } + + deploy( + deployOptions?: DeployContractOptions + ): Promise> { + return super.deploy({ + storageSlots: TestContract.storageSlots, + ...deployOptions, + }); + } + + static async deploy ( + wallet: Account, + options: DeployContractOptions = {} + ): Promise> { + const factory = new TestContractFactory(wallet); + return factory.deploy(options); + } +} diff --git a/templates/vite/src/sway-api/contracts/index.ts b/templates/vite/src/sway-api/contracts/index.ts new file mode 100644 index 00000000000..4ecc3c0fde5 --- /dev/null +++ b/templates/vite/src/sway-api/contracts/index.ts @@ -0,0 +1,14 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +export { TestContract } from './TestContract'; +export { TestContractFactory } from './TestContractFactory'; diff --git a/templates/vite/src/sway-api/index.ts b/templates/vite/src/sway-api/index.ts new file mode 100644 index 00000000000..af6e5049ced --- /dev/null +++ b/templates/vite/src/sway-api/index.ts @@ -0,0 +1,3 @@ +export * from './contracts'; +export * from './scripts'; +export * from './predicates'; diff --git a/templates/vite/src/sway-api/predicates/TestPredicate.ts b/templates/vite/src/sway-api/predicates/TestPredicate.ts new file mode 100644 index 00000000000..2041e1ca1b6 --- /dev/null +++ b/templates/vite/src/sway-api/predicates/TestPredicate.ts @@ -0,0 +1,96 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +import { + BigNumberish, + BN, + decompressBytecode, + InputValue, + Predicate, + PredicateParams, + Provider, +} from 'fuels'; + +export type TestPredicateConfigurables = undefined; + +export type TestPredicateInputs = [password: BigNumberish]; + +export type TestPredicateParameters = Omit< + PredicateParams, + 'abi' | 'bytecode' +>; + +const abi = { + "programType": "predicate", + "specVersion": "1", + "encodingVersion": "1", + "concreteTypes": [ + { + "type": "bool", + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + }, + { + "type": "u64", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "metadataTypes": [], + "functions": [ + { + "inputs": [ + { + "name": "password", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "main", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This predicate checks if the given password is 1337." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " If it is, the predicate is 'unlocked' and the transaction is allowed to proceed." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " Otherwise, it is reverted." + ] + } + ] + } + ], + "loggedTypes": [], + "messagesTypes": [], + "configurables": [] +}; + +const bytecode = decompressBytecode('H4sIAAAAAAAAA01QP0vDQBx9iRGDjTaQDuVcinTIWBBEtwtpSWyWGzsYxc1Rg4hjvoKDf0Y/wg1+AD+CHyGrYMFFaOmQvhy05ODg3fu99+7xE38jPAA2zLGe8vrL8usa4lfhGSjvJXau5/DyTHs30TFUovtXE0DFun8ZAQHvo0SweRdj2EHkSHLWKRPpmdJ/yPkdvX6Rwg0nTsn3wOCoV6pMh/S54YUj2cWlx6PngJpbw88daTSSOPts/h4ZPhpKZp61MmebzDzWnZx9mNNtcKM/Gvekz27kOuS69LrEFn1y2yXRaStPtfL2xQ8wWJxgtqpstaqcZm8i/sZQAi/A3qsLszcRf0AkFYp095y7KMU/+aWPd87fqJsugDV20P+heAEAAA=='); + +export class TestPredicate extends Predicate< + TestPredicateInputs, + TestPredicateConfigurables +> { + static readonly abi = abi; + static readonly bytecode = bytecode; + + constructor(params: TestPredicateParameters) { + super({ abi, bytecode, ...params }); + } +} diff --git a/templates/vite/src/sway-api/predicates/index.ts b/templates/vite/src/sway-api/predicates/index.ts new file mode 100644 index 00000000000..18cd4f0d9bd --- /dev/null +++ b/templates/vite/src/sway-api/predicates/index.ts @@ -0,0 +1,13 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +export { TestPredicate } from './TestPredicate'; diff --git a/templates/vite/src/sway-api/scripts/TestScript.ts b/templates/vite/src/sway-api/scripts/TestScript.ts new file mode 100644 index 00000000000..07f21e346a8 --- /dev/null +++ b/templates/vite/src/sway-api/scripts/TestScript.ts @@ -0,0 +1,63 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +import { + Account, + BigNumberish, + BN, + decompressBytecode, + Script, +} from 'fuels'; + +export type TestScriptInputs = [input: BigNumberish]; +export type TestScriptOutput = BN; + +const abi = { + "programType": "script", + "specVersion": "1", + "encodingVersion": "1", + "concreteTypes": [ + { + "type": "u64", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "metadataTypes": [], + "functions": [ + { + "inputs": [ + { + "name": "input", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "main", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": null + } + ], + "loggedTypes": [], + "messagesTypes": [], + "configurables": [] +}; + +const bytecode = decompressBytecode('H4sIAAAAAAAAA02Sv4sTQRzFX9YVgo2jbiTMeZricmwZsFGvcJbdsFlDcA4DWjhs7CzDInLl/glaqFdaWs6ChaWl5ZWW2wq3YCNErohvNobcNPPmM98fb76M/D3CG8BDu7yFWX/viPUa8lzjPTyhn1b6lcK1vMFj7j73hzquVjq1y2KCbjj2Sz2tFoWizgLw7meRUEcHysT2yEQAcyKnHd9LAiUiX5EdkUWsc0J9nXmv23pRUOq02tWOq7MtZ/wj+QsYrO7jxUXt6Yvap/eXMj5zPVw/VSQ+DhNAJkvoqT3NG3HLMe5Bfo4ePfTD5kCx7w/W7YfpV+f/pNDUWQ/sPWj1eOjy+ztuyy03z60wz+wNk9qbzpvIgrKXDfF2gg79XCXz9o6T8lAD4f5cyfkSIpurPAPcnETEOaW2zht9J2/UPr3f1bEdtX427++2evP+d5d4fYnXPD/Yne1kF2ftlpupva2PheD9Km8G9/QYrjZnm7i4BbX4X+9Lqzd9vm05/YpwFsBEo46ZjTCcAR+AKx+7nDH/iIw/Q6Y15B+e/wqckn/i/ZMVkPJH/QPs/31HYAIAAA=='); + +export class TestScript extends Script { + + static readonly abi = abi; + static readonly bytecode = bytecode; + + constructor(wallet: Account) { + super(bytecode, abi, wallet); + } +} diff --git a/templates/vite/src/sway-api/scripts/index.ts b/templates/vite/src/sway-api/scripts/index.ts new file mode 100644 index 00000000000..33c8d585069 --- /dev/null +++ b/templates/vite/src/sway-api/scripts/index.ts @@ -0,0 +1,13 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.94.6 + Forc version: 0.63.5 + Fuel-Core version: 0.35.0 +*/ + +export { TestScript } from './TestScript'; From 7dfdeaf82c319253102ae72aee1cca2c12a0118a Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Mon, 16 Sep 2024 18:17:24 +0530 Subject: [PATCH 02/33] add changeset --- .changeset/spotty-worms-float.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spotty-worms-float.md diff --git a/.changeset/spotty-worms-float.md b/.changeset/spotty-worms-float.md new file mode 100644 index 00000000000..aab962ab33f --- /dev/null +++ b/.changeset/spotty-worms-float.md @@ -0,0 +1,5 @@ +--- +"create-fuels": patch +--- + +fix: remove typegen artifacts from create-fuels gitignore From 34bb78f9b62c05f1717d41c4d5e0f04d331e6665 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Tue, 17 Sep 2024 17:21:39 +0530 Subject: [PATCH 03/33] add comment to gitignore --- templates/nextjs/.gitignore | 10 +++++++++- templates/nextjs/gitignore | 10 +++++++++- templates/vite/.gitignore | 10 +++++++++- templates/vite/gitignore | 10 +++++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/templates/nextjs/.gitignore b/templates/nextjs/.gitignore index 85b68a9b40e..6aa28c49c88 100644 --- a/templates/nextjs/.gitignore +++ b/templates/nextjs/.gitignore @@ -38,4 +38,12 @@ sway-programs/**/out .turbo test-results -playwright-report \ No newline at end of file +playwright-report + +# Uncomment the lines below if you don't wish +# to commit the generated files to git. + +# src/sway-api/contracts +# src/sway-api/predicates +# src/sway-api/scripts +# src/sway-api/index.ts \ No newline at end of file diff --git a/templates/nextjs/gitignore b/templates/nextjs/gitignore index efa80889beb..49c1468a3c6 100644 --- a/templates/nextjs/gitignore +++ b/templates/nextjs/gitignore @@ -39,4 +39,12 @@ sway-programs/**/out .turbo test-results -playwright-report \ No newline at end of file +playwright-report + +# Uncomment the lines below if you don't wish +# to commit the generated files to git. + +# src/sway-api/contracts +# src/sway-api/predicates +# src/sway-api/scripts +# src/sway-api/index.ts \ No newline at end of file diff --git a/templates/vite/.gitignore b/templates/vite/.gitignore index dea3c7ead68..06cae238140 100644 --- a/templates/vite/.gitignore +++ b/templates/vite/.gitignore @@ -29,4 +29,12 @@ sway-programs/**/out .turbo test-results -playwright-report \ No newline at end of file +playwright-report + +# Uncomment the lines below if you don't wish +# to commit the generated files to git. + +# src/sway-api/contracts +# src/sway-api/predicates +# src/sway-api/scripts +# src/sway-api/index.ts \ No newline at end of file diff --git a/templates/vite/gitignore b/templates/vite/gitignore index dea3c7ead68..06cae238140 100644 --- a/templates/vite/gitignore +++ b/templates/vite/gitignore @@ -29,4 +29,12 @@ sway-programs/**/out .turbo test-results -playwright-report \ No newline at end of file +playwright-report + +# Uncomment the lines below if you don't wish +# to commit the generated files to git. + +# src/sway-api/contracts +# src/sway-api/predicates +# src/sway-api/scripts +# src/sway-api/index.ts \ No newline at end of file From 235959f702be4df038807ce6bb83b0c68e496a28 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 14:47:19 +0530 Subject: [PATCH 04/33] push typegen files at runtime --- .github/workflows/pr-release.yaml | 2 +- packages/create-fuels/src/cli.ts | 12 ++++++++++++ templates/nextjs/.gitignore | 11 ++++------- templates/nextjs/gitignore | 11 ++++------- templates/vite/.gitignore | 11 ++++------- templates/vite/gitignore | 11 ++++------- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 6eeca1f3f04..593d7fce145 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - if: false + # if: false permissions: write-all steps: - name: Checkout diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 57c4ce005cf..e66780d0cfc 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -151,6 +151,18 @@ export const runScaffoldCli = async ({ installDepsSpinner.succeed('Installed dependencies!'); } + // Remove typegen files from gitignore + const gitignorePath = join(projectPath, '.gitignore'); + const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); + const newGitIgnoreContents = gitignoreContents.replace( + /(src\/sway-api\/contracts\n)|(src\/sway-api\/predicates\n)|(src\/sway-api\/scripts\n)|(src\/sway-api\/index.ts\n)/gm, + '' + ); + writeFileSync(gitignorePath, newGitIgnoreContents); + + // Build types + execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + log(); log(); log(chalk.green(`⚡️ Success! Created a fullstack Fuel dapp at ${projectPath}`)); diff --git a/templates/nextjs/.gitignore b/templates/nextjs/.gitignore index 6aa28c49c88..87db3ffdb51 100644 --- a/templates/nextjs/.gitignore +++ b/templates/nextjs/.gitignore @@ -40,10 +40,7 @@ sway-programs/**/out test-results playwright-report -# Uncomment the lines below if you don't wish -# to commit the generated files to git. - -# src/sway-api/contracts -# src/sway-api/predicates -# src/sway-api/scripts -# src/sway-api/index.ts \ No newline at end of file +src/sway-api/contracts +src/sway-api/predicates +src/sway-api/scripts +src/sway-api/index.ts \ No newline at end of file diff --git a/templates/nextjs/gitignore b/templates/nextjs/gitignore index 49c1468a3c6..26fa616f1a7 100644 --- a/templates/nextjs/gitignore +++ b/templates/nextjs/gitignore @@ -41,10 +41,7 @@ sway-programs/**/out test-results playwright-report -# Uncomment the lines below if you don't wish -# to commit the generated files to git. - -# src/sway-api/contracts -# src/sway-api/predicates -# src/sway-api/scripts -# src/sway-api/index.ts \ No newline at end of file +src/sway-api/contracts +src/sway-api/predicates +src/sway-api/scripts +src/sway-api/index.ts \ No newline at end of file diff --git a/templates/vite/.gitignore b/templates/vite/.gitignore index 06cae238140..f5844a2d9e1 100644 --- a/templates/vite/.gitignore +++ b/templates/vite/.gitignore @@ -31,10 +31,7 @@ sway-programs/**/out test-results playwright-report -# Uncomment the lines below if you don't wish -# to commit the generated files to git. - -# src/sway-api/contracts -# src/sway-api/predicates -# src/sway-api/scripts -# src/sway-api/index.ts \ No newline at end of file +src/sway-api/contracts +src/sway-api/predicates +src/sway-api/scripts +src/sway-api/index.ts \ No newline at end of file diff --git a/templates/vite/gitignore b/templates/vite/gitignore index 06cae238140..f5844a2d9e1 100644 --- a/templates/vite/gitignore +++ b/templates/vite/gitignore @@ -31,10 +31,7 @@ sway-programs/**/out test-results playwright-report -# Uncomment the lines below if you don't wish -# to commit the generated files to git. - -# src/sway-api/contracts -# src/sway-api/predicates -# src/sway-api/scripts -# src/sway-api/index.ts \ No newline at end of file +src/sway-api/contracts +src/sway-api/predicates +src/sway-api/scripts +src/sway-api/index.ts \ No newline at end of file From 9e97e13d5762ea463ab84e040165d9d065fa1920 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 15:16:56 +0530 Subject: [PATCH 05/33] Update rewriteTemplateFiles.ts --- packages/create-fuels/src/lib/rewriteTemplateFiles.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/create-fuels/src/lib/rewriteTemplateFiles.ts b/packages/create-fuels/src/lib/rewriteTemplateFiles.ts index 83c51c4a7a5..4c47931a132 100644 --- a/packages/create-fuels/src/lib/rewriteTemplateFiles.ts +++ b/packages/create-fuels/src/lib/rewriteTemplateFiles.ts @@ -13,10 +13,10 @@ export const rewriteTemplateFiles = (templateDir: string) => { writeFileSync(packageJsonFilePath, contents); // fuels.config.ts - contents = readFileSync(fuelsConfigFilePath, 'utf-8'); - contents = contents.replace(/\n\W+forcPath: 'fuels-forc',/g, ''); - contents = contents.replace(/\n\W+fuelCorePath: 'fuels-core',/g, ''); - writeFileSync(fuelsConfigFilePath, contents); + // contents = readFileSync(fuelsConfigFilePath, 'utf-8'); + // contents = contents.replace(/\n\W+forcPath: 'fuels-forc',/g, ''); + // contents = contents.replace(/\n\W+fuelCorePath: 'fuels-core',/g, ''); + // writeFileSync(fuelsConfigFilePath, contents); // tests const testDir = join(templateDir, 'test', 'integration'); From b056021442181edf555d4eb8672ccd25071ef21d Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 15:25:23 +0530 Subject: [PATCH 06/33] debug --- packages/create-fuels/src/cli.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index e66780d0cfc..da81ed3e77f 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -139,17 +139,17 @@ export const runScaffoldCli = async ({ fileCopySpinner.succeed('Copied template files!'); - if (opts.install) { - const installDepsSpinner = ora({ - text: 'Installing dependencies..', - color: 'green', - }).start(); + // if (opts.install) { + // const installDepsSpinner = ora({ + // text: 'Installing dependencies..', + // color: 'green', + // }).start(); - process.chdir(projectPath); - execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + // process.chdir(projectPath); + // execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); - installDepsSpinner.succeed('Installed dependencies!'); - } + // installDepsSpinner.succeed('Installed dependencies!'); + // } // Remove typegen files from gitignore const gitignorePath = join(projectPath, '.gitignore'); From 240f40c9a4667e72c6d212715bfdf6f91bac6108 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 15:36:04 +0530 Subject: [PATCH 07/33] debug --- packages/create-fuels/src/cli.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index da81ed3e77f..800fe9a7e2c 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -139,17 +139,18 @@ export const runScaffoldCli = async ({ fileCopySpinner.succeed('Copied template files!'); - // if (opts.install) { - // const installDepsSpinner = ora({ - // text: 'Installing dependencies..', - // color: 'green', - // }).start(); + if (opts.install) { + const installDepsSpinner = ora({ + text: 'Installing dependencies..', + color: 'green', + }).start(); - // process.chdir(projectPath); - // execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + process.chdir(projectPath); + // execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + execSync('pnpm install'); - // installDepsSpinner.succeed('Installed dependencies!'); - // } + installDepsSpinner.succeed('Installed dependencies!'); + } // Remove typegen files from gitignore const gitignorePath = join(projectPath, '.gitignore'); From bd589c18e0c279a9a9cec7f57c5696f12a541646 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 16:01:08 +0530 Subject: [PATCH 08/33] debug --- packages/create-fuels/src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 800fe9a7e2c..ee0855dff5b 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -153,7 +153,7 @@ export const runScaffoldCli = async ({ } // Remove typegen files from gitignore - const gitignorePath = join(projectPath, '.gitignore'); + const gitignorePath = join('.gitignore'); const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); const newGitIgnoreContents = gitignoreContents.replace( /(src\/sway-api\/contracts\n)|(src\/sway-api\/predicates\n)|(src\/sway-api\/scripts\n)|(src\/sway-api\/index.ts\n)/gm, From 12e144631d48d3862101176a4c499fd7575df182 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 16:40:37 +0530 Subject: [PATCH 09/33] debug --- packages/create-fuels/src/cli.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index ee0855dff5b..134fc2bf96f 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -161,6 +161,13 @@ export const runScaffoldCli = async ({ ); writeFileSync(gitignorePath, newGitIgnoreContents); + const fuelsConfigFilePath = join('fuels.config.ts'); + const fuelsConfigContents = readFileSync(fuelsConfigFilePath, 'utf-8'); + const newFuelsConfigContents = fuelsConfigContents + .replace(/\n\W+forcPath: 'fuels-forc',/g, '') + .replace(/\n\W+fuelCorePath: 'fuels-core',/g, ''); + writeFileSync(fuelsConfigFilePath, newFuelsConfigContents); + // Build types execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); From a036baa267a7c9b41cdc9a9ffdbdd336d4487300 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 16:52:36 +0530 Subject: [PATCH 10/33] debug --- packages/create-fuels/src/cli.ts | 21 ++++++------------- .../src/lib/rewriteTemplateFiles.ts | 8 +++---- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 134fc2bf96f..4819c98ae58 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -144,30 +144,21 @@ export const runScaffoldCli = async ({ text: 'Installing dependencies..', color: 'green', }).start(); - process.chdir(projectPath); - // execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); - execSync('pnpm install'); - + execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); installDepsSpinner.succeed('Installed dependencies!'); } // Remove typegen files from gitignore const gitignorePath = join('.gitignore'); const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); - const newGitIgnoreContents = gitignoreContents.replace( - /(src\/sway-api\/contracts\n)|(src\/sway-api\/predicates\n)|(src\/sway-api\/scripts\n)|(src\/sway-api\/index.ts\n)/gm, - '' - ); + const newGitIgnoreContents = gitignoreContents + .replace(/src\/sway-api\/contracts\n/g, '') + .replace(/src\/sway-api\/predicates\n/g, '') + .replace(/src\/sway-api\/scripts\n/g, '') + .replace(/src\/sway-api\/index.ts\n/g, ''); writeFileSync(gitignorePath, newGitIgnoreContents); - const fuelsConfigFilePath = join('fuels.config.ts'); - const fuelsConfigContents = readFileSync(fuelsConfigFilePath, 'utf-8'); - const newFuelsConfigContents = fuelsConfigContents - .replace(/\n\W+forcPath: 'fuels-forc',/g, '') - .replace(/\n\W+fuelCorePath: 'fuels-core',/g, ''); - writeFileSync(fuelsConfigFilePath, newFuelsConfigContents); - // Build types execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); diff --git a/packages/create-fuels/src/lib/rewriteTemplateFiles.ts b/packages/create-fuels/src/lib/rewriteTemplateFiles.ts index 4c47931a132..83c51c4a7a5 100644 --- a/packages/create-fuels/src/lib/rewriteTemplateFiles.ts +++ b/packages/create-fuels/src/lib/rewriteTemplateFiles.ts @@ -13,10 +13,10 @@ export const rewriteTemplateFiles = (templateDir: string) => { writeFileSync(packageJsonFilePath, contents); // fuels.config.ts - // contents = readFileSync(fuelsConfigFilePath, 'utf-8'); - // contents = contents.replace(/\n\W+forcPath: 'fuels-forc',/g, ''); - // contents = contents.replace(/\n\W+fuelCorePath: 'fuels-core',/g, ''); - // writeFileSync(fuelsConfigFilePath, contents); + contents = readFileSync(fuelsConfigFilePath, 'utf-8'); + contents = contents.replace(/\n\W+forcPath: 'fuels-forc',/g, ''); + contents = contents.replace(/\n\W+fuelCorePath: 'fuels-core',/g, ''); + writeFileSync(fuelsConfigFilePath, contents); // tests const testDir = join(templateDir, 'test', 'integration'); From 35d0ff7822e3799ebaed12545e61268c1c54405e Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 17:06:45 +0530 Subject: [PATCH 11/33] debug --- packages/create-fuels/src/cli.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 4819c98ae58..e7519eeb659 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -145,7 +145,8 @@ export const runScaffoldCli = async ({ color: 'green', }).start(); process.chdir(projectPath); - execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + // execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + execSync('pnpm install', { stdio: verboseEnabled ? 'inherit' : 'pipe' }); installDepsSpinner.succeed('Installed dependencies!'); } From 2798000f90e8c1b8d7a37778a6f5b8e5d7efa96b Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 17:07:30 +0530 Subject: [PATCH 12/33] debug --- packages/create-fuels/src/cli.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index e7519eeb659..d1c81f03506 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -139,6 +139,16 @@ export const runScaffoldCli = async ({ fileCopySpinner.succeed('Copied template files!'); + // Remove typegen files from gitignore + const gitignorePath = join('.gitignore'); + const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); + const newGitIgnoreContents = gitignoreContents + .replace(/src\/sway-api\/contracts\n/g, '') + .replace(/src\/sway-api\/predicates\n/g, '') + .replace(/src\/sway-api\/scripts\n/g, '') + .replace(/src\/sway-api\/index.ts\n/g, ''); + writeFileSync(gitignorePath, newGitIgnoreContents); + if (opts.install) { const installDepsSpinner = ora({ text: 'Installing dependencies..', @@ -150,16 +160,6 @@ export const runScaffoldCli = async ({ installDepsSpinner.succeed('Installed dependencies!'); } - // Remove typegen files from gitignore - const gitignorePath = join('.gitignore'); - const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); - const newGitIgnoreContents = gitignoreContents - .replace(/src\/sway-api\/contracts\n/g, '') - .replace(/src\/sway-api\/predicates\n/g, '') - .replace(/src\/sway-api\/scripts\n/g, '') - .replace(/src\/sway-api\/index.ts\n/g, ''); - writeFileSync(gitignorePath, newGitIgnoreContents); - // Build types execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); From 14adcd4d132116c50c8d06747c6d9386d9714279 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 17:12:33 +0530 Subject: [PATCH 13/33] debug --- packages/create-fuels/src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index d1c81f03506..db734922a7a 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -140,7 +140,7 @@ export const runScaffoldCli = async ({ fileCopySpinner.succeed('Copied template files!'); // Remove typegen files from gitignore - const gitignorePath = join('.gitignore'); + const gitignorePath = join(projectPath, '.gitignore'); const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); const newGitIgnoreContents = gitignoreContents .replace(/src\/sway-api\/contracts\n/g, '') From a1ce0bc6e28e6827523e442f45845e0e2a1c19b1 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 17:23:26 +0530 Subject: [PATCH 14/33] debug --- packages/create-fuels/src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index db734922a7a..7073241e3b7 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -146,7 +146,7 @@ export const runScaffoldCli = async ({ .replace(/src\/sway-api\/contracts\n/g, '') .replace(/src\/sway-api\/predicates\n/g, '') .replace(/src\/sway-api\/scripts\n/g, '') - .replace(/src\/sway-api\/index.ts\n/g, ''); + .replace(/src\/sway-api\/index.ts/g, ''); writeFileSync(gitignorePath, newGitIgnoreContents); if (opts.install) { From cb08ac5033a0a62f23f13c3bd642d1741bda6bb7 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 17:31:27 +0530 Subject: [PATCH 15/33] debug --- packages/create-fuels/src/cli.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 7073241e3b7..56290ce9a42 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -155,12 +155,11 @@ export const runScaffoldCli = async ({ color: 'green', }).start(); process.chdir(projectPath); - // execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); - execSync('pnpm install', { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); installDepsSpinner.succeed('Installed dependencies!'); } - // Build types + // Generate typegen files execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); log(); From c2c93d8d284940ed76c67f6e0d5d34a939b9d98d Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 17:58:47 +0530 Subject: [PATCH 16/33] fix tests --- packages/create-fuels/src/cli.ts | 4 +++- packages/create-fuels/test/cli.test.ts | 2 ++ .../create-fuels/test/utils/mockExecSync.ts | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 packages/create-fuels/test/utils/mockExecSync.ts diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 56290ce9a42..e69a3cc8cf4 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -160,7 +160,9 @@ export const runScaffoldCli = async ({ } // Generate typegen files - execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + if (!process.env.VITEST) { + execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + } log(); log(); diff --git a/packages/create-fuels/test/cli.test.ts b/packages/create-fuels/test/cli.test.ts index 8b5775f6395..30740d500f6 100644 --- a/packages/create-fuels/test/cli.test.ts +++ b/packages/create-fuels/test/cli.test.ts @@ -15,6 +15,7 @@ import { resetFilesystem, } from './utils/bootstrapProject'; import { generateArgv } from './utils/generateArgs'; +import { mockExecSync } from './utils/mockExecSync'; import { mockLogger } from './utils/mockLogger'; import { filterOriginalTemplateFiles, getAllFiles } from './utils/templateFiles'; @@ -28,6 +29,7 @@ describe('CLI', { timeout: 15_000 }, () => { beforeEach(() => { paths = bootstrapProject(__filename); copyTemplate(paths.templateSource, paths.templateRoot); + mockExecSync(); }); afterEach(() => { diff --git a/packages/create-fuels/test/utils/mockExecSync.ts b/packages/create-fuels/test/utils/mockExecSync.ts new file mode 100644 index 00000000000..2e742947435 --- /dev/null +++ b/packages/create-fuels/test/utils/mockExecSync.ts @@ -0,0 +1,19 @@ +import chalk from 'chalk'; +import type * as childProcessMod from 'child_process'; + +export const mockExecSync = () => { + vi.mock('child_process', async () => { + const actualChildProcess = await vi.importActual('child_process'); + + return { + ...actualChildProcess, // Preserve other functions in child_process + execSync: (command: string) => { + if (command.includes('prebuild')) { + return chalk('Skipping prebuild command'); + } + // Allow other execSync calls to proceed normally + return actualChildProcess.execSync(command); + }, + }; + }); +}; From f5f3f92aaf7f71a961d92f994cc6e637ccfd72a3 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 18:12:12 +0530 Subject: [PATCH 17/33] fix changeset --- .changeset/spotty-worms-float.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/spotty-worms-float.md b/.changeset/spotty-worms-float.md index aab962ab33f..078f9688424 100644 --- a/.changeset/spotty-worms-float.md +++ b/.changeset/spotty-worms-float.md @@ -2,4 +2,4 @@ "create-fuels": patch --- -fix: remove typegen artifacts from create-fuels gitignore +fix: generate types for `create fuels` users when extracted From 8d43732287af0faa5fa5d35f37eb1e7c97f5191b Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 19:04:46 +0530 Subject: [PATCH 18/33] disable pr release --- .github/workflows/pr-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 593d7fce145..6eeca1f3f04 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - # if: false + if: false permissions: write-all steps: - name: Checkout From b7c6510e3eb6753f2bacee6bdf41fc849c7412ac Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 18 Sep 2024 21:04:54 +0530 Subject: [PATCH 19/33] remove build artifacts --- .../src/sway-api/contracts/TestContract.ts | 109 ------------------ .../sway-api/contracts/TestContractFactory.ts | 44 ------- .../nextjs/src/sway-api/contracts/index.ts | 14 --- templates/nextjs/src/sway-api/index.ts | 3 - .../src/sway-api/predicates/TestPredicate.ts | 96 --------------- .../nextjs/src/sway-api/predicates/index.ts | 13 --- .../nextjs/src/sway-api/scripts/TestScript.ts | 63 ---------- .../nextjs/src/sway-api/scripts/index.ts | 13 --- .../src/sway-api/contracts/TestContract.ts | 109 ------------------ .../sway-api/contracts/TestContractFactory.ts | 44 ------- .../vite/src/sway-api/contracts/index.ts | 14 --- templates/vite/src/sway-api/index.ts | 3 - .../src/sway-api/predicates/TestPredicate.ts | 96 --------------- .../vite/src/sway-api/predicates/index.ts | 13 --- .../vite/src/sway-api/scripts/TestScript.ts | 63 ---------- templates/vite/src/sway-api/scripts/index.ts | 13 --- 16 files changed, 710 deletions(-) delete mode 100644 templates/nextjs/src/sway-api/contracts/TestContract.ts delete mode 100644 templates/nextjs/src/sway-api/contracts/TestContractFactory.ts delete mode 100644 templates/nextjs/src/sway-api/contracts/index.ts delete mode 100644 templates/nextjs/src/sway-api/index.ts delete mode 100644 templates/nextjs/src/sway-api/predicates/TestPredicate.ts delete mode 100644 templates/nextjs/src/sway-api/predicates/index.ts delete mode 100644 templates/nextjs/src/sway-api/scripts/TestScript.ts delete mode 100644 templates/nextjs/src/sway-api/scripts/index.ts delete mode 100644 templates/vite/src/sway-api/contracts/TestContract.ts delete mode 100644 templates/vite/src/sway-api/contracts/TestContractFactory.ts delete mode 100644 templates/vite/src/sway-api/contracts/index.ts delete mode 100644 templates/vite/src/sway-api/index.ts delete mode 100644 templates/vite/src/sway-api/predicates/TestPredicate.ts delete mode 100644 templates/vite/src/sway-api/predicates/index.ts delete mode 100644 templates/vite/src/sway-api/scripts/TestScript.ts delete mode 100644 templates/vite/src/sway-api/scripts/index.ts diff --git a/templates/nextjs/src/sway-api/contracts/TestContract.ts b/templates/nextjs/src/sway-api/contracts/TestContract.ts deleted file mode 100644 index 7279f000416..00000000000 --- a/templates/nextjs/src/sway-api/contracts/TestContract.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -import { Contract, Interface } from "fuels"; -import type { - Provider, - Account, - StorageSlot, - AbstractAddress, - BigNumberish, - BN, - FunctionFragment, - InvokeFunction, -} from 'fuels'; - -const abi = { - "programType": "contract", - "specVersion": "1", - "encodingVersion": "1", - "concreteTypes": [ - { - "type": "u64", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "metadataTypes": [], - "functions": [ - { - "inputs": [], - "name": "get_count", - "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "attributes": [ - { - "name": "storage", - "arguments": [ - "read" - ] - } - ] - }, - { - "inputs": [ - { - "name": "amount", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "name": "increment_counter", - "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "attributes": [ - { - "name": "storage", - "arguments": [ - "write", - "read" - ] - } - ] - } - ], - "loggedTypes": [], - "messagesTypes": [], - "configurables": [] -}; - -const storageSlots: StorageSlot[] = [ - { - "key": "6e3c7b4f69bbff7132c3c3a62883a6868f47b0bc2a7f21605f29038cd9a5e05f", - "value": "0000000000000000000000000000000000000000000000000000000000000000" - } -]; - -export class TestContractInterface extends Interface { - constructor() { - super(abi); - } - - declare functions: { - get_count: FunctionFragment; - increment_counter: FunctionFragment; - }; -} - -export class TestContract extends Contract { - static readonly abi = abi; - static readonly storageSlots = storageSlots; - - declare interface: TestContractInterface; - declare functions: { - get_count: InvokeFunction<[], BN>; - increment_counter: InvokeFunction<[amount: BigNumberish], BN>; - }; - - constructor( - id: string | AbstractAddress, - accountOrProvider: Account | Provider, - ) { - super(id, abi, accountOrProvider); - } -} diff --git a/templates/nextjs/src/sway-api/contracts/TestContractFactory.ts b/templates/nextjs/src/sway-api/contracts/TestContractFactory.ts deleted file mode 100644 index e41421d5cc1..00000000000 --- a/templates/nextjs/src/sway-api/contracts/TestContractFactory.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -import { Contract, ContractFactory, decompressBytecode } from "fuels"; -import type { Provider, Account, DeployContractOptions, DeployContractResult } from "fuels"; - -import { TestContract } from "./TestContract"; - -const bytecode = decompressBytecode("H4sIAAAAAAAAA61YX2gcVRe/u91t1zRNJsmGb7/JJ5lP1roK4qJpSVXIDLvj7Ha77I1pbNRud0GLKWiNSxOKohktSB4Eo6D2zYoo+ja76UNBHxZ88cGHIj5UUIgPSoMN7INCgg/1d+69s51ONopgYLl37p9zzj33d37n3OidLDvHWJSJv6HJ6s12RLt5k8aYfoOzd1gs2zDZ0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39xEdiHPySBM9qOMt16Lkz9E6p36r/m1SPCw4THPdkEndbBy7g320ext+/UdvsGwY3/kV9E+Q+WZOdwB2D91S8+flQ5arbuWORsUuKO0in4A6cke6T9u2oObD+w1BOPCq4TGBWYKG+W05EvjgTqHn9nEg8oHJi85qaUzmxeZW+QzlR7A/lRHoL9syJsPcXlROnSD6wOAVefhi8tir5Je4esWPfnsJ7HXKmME/vhe47XdTJ8qzE/dGaxSmnxU7JNiq56LgZku2JfFuOm4+UY4/D3sQpG/74TeQv1MA7eCqIk1U9h5h2OsP07sXbaoTeVpKLkm3iLMiTbzDytyPwXKD43HlX0SLdreKtVX2b3Yad506fqz3z4uJZqvfp78zZZxqnXzh9Vo2ebqjxs4++Ujnzxc2XHvzqq08zFz59823H+/K+5f/Xa/fueev7T9Zr34g///8vg3OqVbsHlPiB51X7rGpPyvbAD6r9Tm1YUa37Jxdjjh/YEQAA"); - -export class TestContractFactory extends ContractFactory { - - static readonly bytecode = bytecode; - - constructor(accountOrProvider: Account | Provider) { - super(bytecode, TestContract.abi, accountOrProvider); - } - - deploy( - deployOptions?: DeployContractOptions - ): Promise> { - return super.deploy({ - storageSlots: TestContract.storageSlots, - ...deployOptions, - }); - } - - static async deploy ( - wallet: Account, - options: DeployContractOptions = {} - ): Promise> { - const factory = new TestContractFactory(wallet); - return factory.deploy(options); - } -} diff --git a/templates/nextjs/src/sway-api/contracts/index.ts b/templates/nextjs/src/sway-api/contracts/index.ts deleted file mode 100644 index 4ecc3c0fde5..00000000000 --- a/templates/nextjs/src/sway-api/contracts/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -export { TestContract } from './TestContract'; -export { TestContractFactory } from './TestContractFactory'; diff --git a/templates/nextjs/src/sway-api/index.ts b/templates/nextjs/src/sway-api/index.ts deleted file mode 100644 index af6e5049ced..00000000000 --- a/templates/nextjs/src/sway-api/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './contracts'; -export * from './scripts'; -export * from './predicates'; diff --git a/templates/nextjs/src/sway-api/predicates/TestPredicate.ts b/templates/nextjs/src/sway-api/predicates/TestPredicate.ts deleted file mode 100644 index 2041e1ca1b6..00000000000 --- a/templates/nextjs/src/sway-api/predicates/TestPredicate.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -import { - BigNumberish, - BN, - decompressBytecode, - InputValue, - Predicate, - PredicateParams, - Provider, -} from 'fuels'; - -export type TestPredicateConfigurables = undefined; - -export type TestPredicateInputs = [password: BigNumberish]; - -export type TestPredicateParameters = Omit< - PredicateParams, - 'abi' | 'bytecode' ->; - -const abi = { - "programType": "predicate", - "specVersion": "1", - "encodingVersion": "1", - "concreteTypes": [ - { - "type": "bool", - "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" - }, - { - "type": "u64", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "metadataTypes": [], - "functions": [ - { - "inputs": [ - { - "name": "password", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "name": "main", - "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", - "attributes": [ - { - "name": "doc-comment", - "arguments": [ - " This predicate checks if the given password is 1337." - ] - }, - { - "name": "doc-comment", - "arguments": [ - " If it is, the predicate is 'unlocked' and the transaction is allowed to proceed." - ] - }, - { - "name": "doc-comment", - "arguments": [ - " Otherwise, it is reverted." - ] - } - ] - } - ], - "loggedTypes": [], - "messagesTypes": [], - "configurables": [] -}; - -const bytecode = decompressBytecode('H4sIAAAAAAAAA01QP0vDQBx9iRGDjTaQDuVcinTIWBBEtwtpSWyWGzsYxc1Rg4hjvoKDf0Y/wg1+AD+CHyGrYMFFaOmQvhy05ODg3fu99+7xE38jPAA2zLGe8vrL8usa4lfhGSjvJXau5/DyTHs30TFUovtXE0DFun8ZAQHvo0SweRdj2EHkSHLWKRPpmdJ/yPkdvX6Rwg0nTsn3wOCoV6pMh/S54YUj2cWlx6PngJpbw88daTSSOPts/h4ZPhpKZp61MmebzDzWnZx9mNNtcKM/Gvekz27kOuS69LrEFn1y2yXRaStPtfL2xQ8wWJxgtqpstaqcZm8i/sZQAi/A3qsLszcRf0AkFYp095y7KMU/+aWPd87fqJsugDV20P+heAEAAA=='); - -export class TestPredicate extends Predicate< - TestPredicateInputs, - TestPredicateConfigurables -> { - static readonly abi = abi; - static readonly bytecode = bytecode; - - constructor(params: TestPredicateParameters) { - super({ abi, bytecode, ...params }); - } -} diff --git a/templates/nextjs/src/sway-api/predicates/index.ts b/templates/nextjs/src/sway-api/predicates/index.ts deleted file mode 100644 index 18cd4f0d9bd..00000000000 --- a/templates/nextjs/src/sway-api/predicates/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -export { TestPredicate } from './TestPredicate'; diff --git a/templates/nextjs/src/sway-api/scripts/TestScript.ts b/templates/nextjs/src/sway-api/scripts/TestScript.ts deleted file mode 100644 index 07f21e346a8..00000000000 --- a/templates/nextjs/src/sway-api/scripts/TestScript.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -import { - Account, - BigNumberish, - BN, - decompressBytecode, - Script, -} from 'fuels'; - -export type TestScriptInputs = [input: BigNumberish]; -export type TestScriptOutput = BN; - -const abi = { - "programType": "script", - "specVersion": "1", - "encodingVersion": "1", - "concreteTypes": [ - { - "type": "u64", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "metadataTypes": [], - "functions": [ - { - "inputs": [ - { - "name": "input", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "name": "main", - "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "attributes": null - } - ], - "loggedTypes": [], - "messagesTypes": [], - "configurables": [] -}; - -const bytecode = decompressBytecode('H4sIAAAAAAAAA02Sv4sTQRzFX9YVgo2jbiTMeZricmwZsFGvcJbdsFlDcA4DWjhs7CzDInLl/glaqFdaWs6ChaWl5ZWW2wq3YCNErohvNobcNPPmM98fb76M/D3CG8BDu7yFWX/viPUa8lzjPTyhn1b6lcK1vMFj7j73hzquVjq1y2KCbjj2Sz2tFoWizgLw7meRUEcHysT2yEQAcyKnHd9LAiUiX5EdkUWsc0J9nXmv23pRUOq02tWOq7MtZ/wj+QsYrO7jxUXt6Yvap/eXMj5zPVw/VSQ+DhNAJkvoqT3NG3HLMe5Bfo4ePfTD5kCx7w/W7YfpV+f/pNDUWQ/sPWj1eOjy+ztuyy03z60wz+wNk9qbzpvIgrKXDfF2gg79XCXz9o6T8lAD4f5cyfkSIpurPAPcnETEOaW2zht9J2/UPr3f1bEdtX427++2evP+d5d4fYnXPD/Yne1kF2ftlpupva2PheD9Km8G9/QYrjZnm7i4BbX4X+9Lqzd9vm05/YpwFsBEo46ZjTCcAR+AKx+7nDH/iIw/Q6Y15B+e/wqckn/i/ZMVkPJH/QPs/31HYAIAAA=='); - -export class TestScript extends Script { - - static readonly abi = abi; - static readonly bytecode = bytecode; - - constructor(wallet: Account) { - super(bytecode, abi, wallet); - } -} diff --git a/templates/nextjs/src/sway-api/scripts/index.ts b/templates/nextjs/src/sway-api/scripts/index.ts deleted file mode 100644 index 33c8d585069..00000000000 --- a/templates/nextjs/src/sway-api/scripts/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -export { TestScript } from './TestScript'; diff --git a/templates/vite/src/sway-api/contracts/TestContract.ts b/templates/vite/src/sway-api/contracts/TestContract.ts deleted file mode 100644 index 7279f000416..00000000000 --- a/templates/vite/src/sway-api/contracts/TestContract.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -import { Contract, Interface } from "fuels"; -import type { - Provider, - Account, - StorageSlot, - AbstractAddress, - BigNumberish, - BN, - FunctionFragment, - InvokeFunction, -} from 'fuels'; - -const abi = { - "programType": "contract", - "specVersion": "1", - "encodingVersion": "1", - "concreteTypes": [ - { - "type": "u64", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "metadataTypes": [], - "functions": [ - { - "inputs": [], - "name": "get_count", - "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "attributes": [ - { - "name": "storage", - "arguments": [ - "read" - ] - } - ] - }, - { - "inputs": [ - { - "name": "amount", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "name": "increment_counter", - "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "attributes": [ - { - "name": "storage", - "arguments": [ - "write", - "read" - ] - } - ] - } - ], - "loggedTypes": [], - "messagesTypes": [], - "configurables": [] -}; - -const storageSlots: StorageSlot[] = [ - { - "key": "6e3c7b4f69bbff7132c3c3a62883a6868f47b0bc2a7f21605f29038cd9a5e05f", - "value": "0000000000000000000000000000000000000000000000000000000000000000" - } -]; - -export class TestContractInterface extends Interface { - constructor() { - super(abi); - } - - declare functions: { - get_count: FunctionFragment; - increment_counter: FunctionFragment; - }; -} - -export class TestContract extends Contract { - static readonly abi = abi; - static readonly storageSlots = storageSlots; - - declare interface: TestContractInterface; - declare functions: { - get_count: InvokeFunction<[], BN>; - increment_counter: InvokeFunction<[amount: BigNumberish], BN>; - }; - - constructor( - id: string | AbstractAddress, - accountOrProvider: Account | Provider, - ) { - super(id, abi, accountOrProvider); - } -} diff --git a/templates/vite/src/sway-api/contracts/TestContractFactory.ts b/templates/vite/src/sway-api/contracts/TestContractFactory.ts deleted file mode 100644 index e41421d5cc1..00000000000 --- a/templates/vite/src/sway-api/contracts/TestContractFactory.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -import { Contract, ContractFactory, decompressBytecode } from "fuels"; -import type { Provider, Account, DeployContractOptions, DeployContractResult } from "fuels"; - -import { TestContract } from "./TestContract"; - -const bytecode = decompressBytecode("H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MUF9CRj7GDwLaeXyDcLADvAzSGdhD+0ODjFPiZ3gdXcJaU5Lsm+SRF+MKdEZenZM3tUZ2kxr0Vf7w64w0h1oaBxRHyhwbsjyLOUG9EiBcwFh0rT7gHjzGWuTNv6nyBacW8WaMawsR6vMkIM7VNU0fOHMMd/U/liJTEjbcl+pJbCZ9qvEmx5o/TN/Gn+vaI7/39xEdiHPySBM9qOMt16Lkz9E6p36r/m1SPCw4THPdkEndbBy7g320ext+/UdvsGwY3/kV9E+Q+WZOdwB2D91S8+flQ5arbuWORsUuKO0in4A6cke6T9u2oObD+w1BOPCq4TGBWYKG+W05EvjgTqHn9nEg8oHJi85qaUzmxeZW+QzlR7A/lRHoL9syJsPcXlROnSD6wOAVefhi8tir5Je4esWPfnsJ7HXKmME/vhe47XdTJ8qzE/dGaxSmnxU7JNiq56LgZku2JfFuOm4+UY4/D3sQpG/74TeQv1MA7eCqIk1U9h5h2OsP07sXbaoTeVpKLkm3iLMiTbzDytyPwXKD43HlX0SLdreKtVX2b3Yad506fqz3z4uJZqvfp78zZZxqnXzh9Vo2ebqjxs4++Ujnzxc2XHvzqq08zFz59823H+/K+5f/Xa/fueev7T9Zr34g///8vg3OqVbsHlPiB51X7rGpPyvbAD6r9Tm1YUa37Jxdjjh/YEQAA"); - -export class TestContractFactory extends ContractFactory { - - static readonly bytecode = bytecode; - - constructor(accountOrProvider: Account | Provider) { - super(bytecode, TestContract.abi, accountOrProvider); - } - - deploy( - deployOptions?: DeployContractOptions - ): Promise> { - return super.deploy({ - storageSlots: TestContract.storageSlots, - ...deployOptions, - }); - } - - static async deploy ( - wallet: Account, - options: DeployContractOptions = {} - ): Promise> { - const factory = new TestContractFactory(wallet); - return factory.deploy(options); - } -} diff --git a/templates/vite/src/sway-api/contracts/index.ts b/templates/vite/src/sway-api/contracts/index.ts deleted file mode 100644 index 4ecc3c0fde5..00000000000 --- a/templates/vite/src/sway-api/contracts/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -export { TestContract } from './TestContract'; -export { TestContractFactory } from './TestContractFactory'; diff --git a/templates/vite/src/sway-api/index.ts b/templates/vite/src/sway-api/index.ts deleted file mode 100644 index af6e5049ced..00000000000 --- a/templates/vite/src/sway-api/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './contracts'; -export * from './scripts'; -export * from './predicates'; diff --git a/templates/vite/src/sway-api/predicates/TestPredicate.ts b/templates/vite/src/sway-api/predicates/TestPredicate.ts deleted file mode 100644 index 2041e1ca1b6..00000000000 --- a/templates/vite/src/sway-api/predicates/TestPredicate.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -import { - BigNumberish, - BN, - decompressBytecode, - InputValue, - Predicate, - PredicateParams, - Provider, -} from 'fuels'; - -export type TestPredicateConfigurables = undefined; - -export type TestPredicateInputs = [password: BigNumberish]; - -export type TestPredicateParameters = Omit< - PredicateParams, - 'abi' | 'bytecode' ->; - -const abi = { - "programType": "predicate", - "specVersion": "1", - "encodingVersion": "1", - "concreteTypes": [ - { - "type": "bool", - "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" - }, - { - "type": "u64", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "metadataTypes": [], - "functions": [ - { - "inputs": [ - { - "name": "password", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "name": "main", - "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", - "attributes": [ - { - "name": "doc-comment", - "arguments": [ - " This predicate checks if the given password is 1337." - ] - }, - { - "name": "doc-comment", - "arguments": [ - " If it is, the predicate is 'unlocked' and the transaction is allowed to proceed." - ] - }, - { - "name": "doc-comment", - "arguments": [ - " Otherwise, it is reverted." - ] - } - ] - } - ], - "loggedTypes": [], - "messagesTypes": [], - "configurables": [] -}; - -const bytecode = decompressBytecode('H4sIAAAAAAAAA01QP0vDQBx9iRGDjTaQDuVcinTIWBBEtwtpSWyWGzsYxc1Rg4hjvoKDf0Y/wg1+AD+CHyGrYMFFaOmQvhy05ODg3fu99+7xE38jPAA2zLGe8vrL8usa4lfhGSjvJXau5/DyTHs30TFUovtXE0DFun8ZAQHvo0SweRdj2EHkSHLWKRPpmdJ/yPkdvX6Rwg0nTsn3wOCoV6pMh/S54YUj2cWlx6PngJpbw88daTSSOPts/h4ZPhpKZp61MmebzDzWnZx9mNNtcKM/Gvekz27kOuS69LrEFn1y2yXRaStPtfL2xQ8wWJxgtqpstaqcZm8i/sZQAi/A3qsLszcRf0AkFYp095y7KMU/+aWPd87fqJsugDV20P+heAEAAA=='); - -export class TestPredicate extends Predicate< - TestPredicateInputs, - TestPredicateConfigurables -> { - static readonly abi = abi; - static readonly bytecode = bytecode; - - constructor(params: TestPredicateParameters) { - super({ abi, bytecode, ...params }); - } -} diff --git a/templates/vite/src/sway-api/predicates/index.ts b/templates/vite/src/sway-api/predicates/index.ts deleted file mode 100644 index 18cd4f0d9bd..00000000000 --- a/templates/vite/src/sway-api/predicates/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -export { TestPredicate } from './TestPredicate'; diff --git a/templates/vite/src/sway-api/scripts/TestScript.ts b/templates/vite/src/sway-api/scripts/TestScript.ts deleted file mode 100644 index 07f21e346a8..00000000000 --- a/templates/vite/src/sway-api/scripts/TestScript.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -import { - Account, - BigNumberish, - BN, - decompressBytecode, - Script, -} from 'fuels'; - -export type TestScriptInputs = [input: BigNumberish]; -export type TestScriptOutput = BN; - -const abi = { - "programType": "script", - "specVersion": "1", - "encodingVersion": "1", - "concreteTypes": [ - { - "type": "u64", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "metadataTypes": [], - "functions": [ - { - "inputs": [ - { - "name": "input", - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" - } - ], - "name": "main", - "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "attributes": null - } - ], - "loggedTypes": [], - "messagesTypes": [], - "configurables": [] -}; - -const bytecode = decompressBytecode('H4sIAAAAAAAAA02Sv4sTQRzFX9YVgo2jbiTMeZricmwZsFGvcJbdsFlDcA4DWjhs7CzDInLl/glaqFdaWs6ChaWl5ZWW2wq3YCNErohvNobcNPPmM98fb76M/D3CG8BDu7yFWX/viPUa8lzjPTyhn1b6lcK1vMFj7j73hzquVjq1y2KCbjj2Sz2tFoWizgLw7meRUEcHysT2yEQAcyKnHd9LAiUiX5EdkUWsc0J9nXmv23pRUOq02tWOq7MtZ/wj+QsYrO7jxUXt6Yvap/eXMj5zPVw/VSQ+DhNAJkvoqT3NG3HLMe5Bfo4ePfTD5kCx7w/W7YfpV+f/pNDUWQ/sPWj1eOjy+ztuyy03z60wz+wNk9qbzpvIgrKXDfF2gg79XCXz9o6T8lAD4f5cyfkSIpurPAPcnETEOaW2zht9J2/UPr3f1bEdtX427++2evP+d5d4fYnXPD/Yne1kF2ftlpupva2PheD9Km8G9/QYrjZnm7i4BbX4X+9Lqzd9vm05/YpwFsBEo46ZjTCcAR+AKx+7nDH/iIw/Q6Y15B+e/wqckn/i/ZMVkPJH/QPs/31HYAIAAA=='); - -export class TestScript extends Script { - - static readonly abi = abi; - static readonly bytecode = bytecode; - - constructor(wallet: Account) { - super(bytecode, abi, wallet); - } -} diff --git a/templates/vite/src/sway-api/scripts/index.ts b/templates/vite/src/sway-api/scripts/index.ts deleted file mode 100644 index 33c8d585069..00000000000 --- a/templates/vite/src/sway-api/scripts/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ - -/* eslint-disable max-classes-per-file */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/consistent-type-imports */ - -/* - Fuels version: 0.94.6 - Forc version: 0.63.5 - Fuel-Core version: 0.35.0 -*/ - -export { TestScript } from './TestScript'; From 5fa7fc879060829ec73f82390a9c40524db544ee Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Thu, 19 Sep 2024 10:48:14 +0530 Subject: [PATCH 20/33] properly mock --- packages/create-fuels/src/cli.ts | 4 +--- packages/create-fuels/test/cli.test.ts | 8 +++++++ .../create-fuels/test/utils/mockExecSync.ts | 21 +++++++------------ 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index e69a3cc8cf4..56290ce9a42 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -160,9 +160,7 @@ export const runScaffoldCli = async ({ } // Generate typegen files - if (!process.env.VITEST) { - execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); - } + execSync(packageManager.run('prebuild'), { stdio: verboseEnabled ? 'inherit' : 'pipe' }); log(); log(); diff --git a/packages/create-fuels/test/cli.test.ts b/packages/create-fuels/test/cli.test.ts index 30740d500f6..bd54c16ae55 100644 --- a/packages/create-fuels/test/cli.test.ts +++ b/packages/create-fuels/test/cli.test.ts @@ -19,6 +19,14 @@ import { mockExecSync } from './utils/mockExecSync'; import { mockLogger } from './utils/mockLogger'; import { filterOriginalTemplateFiles, getAllFiles } from './utils/templateFiles'; +vi.mock('child_process', async () => { + const mod = await vi.importActual('child_process'); + return { + __esModule: true, + ...mod, + }; +}); + /** * @group node */ diff --git a/packages/create-fuels/test/utils/mockExecSync.ts b/packages/create-fuels/test/utils/mockExecSync.ts index 2e742947435..f31629b6e6c 100644 --- a/packages/create-fuels/test/utils/mockExecSync.ts +++ b/packages/create-fuels/test/utils/mockExecSync.ts @@ -1,19 +1,12 @@ import chalk from 'chalk'; -import type * as childProcessMod from 'child_process'; +import * as childProcessMod from 'child_process'; export const mockExecSync = () => { - vi.mock('child_process', async () => { - const actualChildProcess = await vi.importActual('child_process'); - - return { - ...actualChildProcess, // Preserve other functions in child_process - execSync: (command: string) => { - if (command.includes('prebuild')) { - return chalk('Skipping prebuild command'); - } - // Allow other execSync calls to proceed normally - return actualChildProcess.execSync(command); - }, - }; + vi.spyOn(childProcessMod, 'execSync').mockImplementationOnce((command) => { + if (command.includes('prebuild')) { + return chalk('Skipping prebuild command'); + } + // Allow other execSync calls to proceed normally + return childProcessMod.execSync(command); }); }; From d7147517acb035863184f5b68d9f10825338c2fe Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Thu, 19 Sep 2024 10:50:40 +0530 Subject: [PATCH 21/33] add comments in gitgnore instead of removing completely --- .github/workflows/pr-release.yaml | 2 +- packages/create-fuels/src/cli.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 6eeca1f3f04..593d7fce145 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - if: false + # if: false permissions: write-all steps: - name: Checkout diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 56290ce9a42..eff946e3411 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -143,10 +143,13 @@ export const runScaffoldCli = async ({ const gitignorePath = join(projectPath, '.gitignore'); const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); const newGitIgnoreContents = gitignoreContents - .replace(/src\/sway-api\/contracts\n/g, '') - .replace(/src\/sway-api\/predicates\n/g, '') - .replace(/src\/sway-api\/scripts\n/g, '') - .replace(/src\/sway-api\/index.ts/g, ''); + .replace( + /src\/sway-api\/contracts\n/g, + "# Uncomment the lines below if you don't wish\n# to commit the generated files to git.\n\n# src/sway-api/contracts\n" + ) + .replace(/src\/sway-api\/predicates\n/g, '# src/sway-api/predicates\n') + .replace(/src\/sway-api\/scripts\n/g, '# src/sway-api/scripts\n') + .replace(/src\/sway-api\/index.ts/g, '# src/sway-api/index.ts'); writeFileSync(gitignorePath, newGitIgnoreContents); if (opts.install) { From df3471b1dfe6072bc7b44586e3adb53b94bdae62 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Thu, 19 Sep 2024 11:07:22 +0530 Subject: [PATCH 22/33] disable pr release --- .github/workflows/pr-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 593d7fce145..6eeca1f3f04 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - # if: false + if: false permissions: write-all steps: - name: Checkout From a7d878e70d015c372f4efa073365a663196d98bb Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Tue, 24 Sep 2024 22:23:44 +0530 Subject: [PATCH 23/33] Update templates/nextjs/.gitignore Co-authored-by: Anderson Arboleya --- templates/nextjs/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/nextjs/.gitignore b/templates/nextjs/.gitignore index 87db3ffdb51..e31a7ab8ffb 100644 --- a/templates/nextjs/.gitignore +++ b/templates/nextjs/.gitignore @@ -39,6 +39,8 @@ sway-programs/**/out test-results playwright-report +# Uncomment the lines below if you don't wish +# to commit the generated files to git src/sway-api/contracts src/sway-api/predicates From eae239a74722098b1bb73b7d7c5651ba04645062 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Tue, 24 Sep 2024 22:23:53 +0530 Subject: [PATCH 24/33] update gitignore Co-authored-by: Anderson Arboleya --- templates/vite/gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/vite/gitignore b/templates/vite/gitignore index f5844a2d9e1..84ed5ab729a 100644 --- a/templates/vite/gitignore +++ b/templates/vite/gitignore @@ -30,6 +30,8 @@ sway-programs/**/out test-results playwright-report +# Uncomment the lines below if you don't wish +# to commit the generated files to git src/sway-api/contracts src/sway-api/predicates From 08ca8a4ce7e50d1487db35424c677af996037846 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Tue, 24 Sep 2024 22:24:01 +0530 Subject: [PATCH 25/33] update gitignore Co-authored-by: Anderson Arboleya --- templates/vite/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/vite/.gitignore b/templates/vite/.gitignore index f5844a2d9e1..84ed5ab729a 100644 --- a/templates/vite/.gitignore +++ b/templates/vite/.gitignore @@ -30,6 +30,8 @@ sway-programs/**/out test-results playwright-report +# Uncomment the lines below if you don't wish +# to commit the generated files to git src/sway-api/contracts src/sway-api/predicates From c3bfcfde77feb132c08b7ea8d73fbe2c8fd1e70d Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Tue, 24 Sep 2024 22:24:09 +0530 Subject: [PATCH 26/33] update gitignore Co-authored-by: Anderson Arboleya --- templates/nextjs/gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/nextjs/gitignore b/templates/nextjs/gitignore index 26fa616f1a7..525875ff7c1 100644 --- a/templates/nextjs/gitignore +++ b/templates/nextjs/gitignore @@ -40,6 +40,8 @@ sway-programs/**/out test-results playwright-report +# Uncomment the lines below if you don't wish +# to commit the generated files to git src/sway-api/contracts src/sway-api/predicates From 57b0c1e67aa24b0902cd73aedd74414622da06dc Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Tue, 24 Sep 2024 22:24:25 +0530 Subject: [PATCH 27/33] update gitignore write logic Co-authored-by: Anderson Arboleya --- packages/create-fuels/src/cli.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index eff946e3411..18911850d78 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -143,13 +143,7 @@ export const runScaffoldCli = async ({ const gitignorePath = join(projectPath, '.gitignore'); const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); const newGitIgnoreContents = gitignoreContents - .replace( - /src\/sway-api\/contracts\n/g, - "# Uncomment the lines below if you don't wish\n# to commit the generated files to git.\n\n# src/sway-api/contracts\n" - ) - .replace(/src\/sway-api\/predicates\n/g, '# src/sway-api/predicates\n') - .replace(/src\/sway-api\/scripts\n/g, '# src/sway-api/scripts\n') - .replace(/src\/sway-api\/index.ts/g, '# src/sway-api/index.ts'); + .replace(/^(src\/sway-api\.+)$/mg, '# $1'); writeFileSync(gitignorePath, newGitIgnoreContents); if (opts.install) { From aa2873ba67888c969fe3ff0ddca1ae0b0dcd1707 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 25 Sep 2024 09:21:53 +0530 Subject: [PATCH 28/33] fix lint issue --- packages/create-fuels/src/cli.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 18911850d78..85923dc6fb8 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -142,8 +142,7 @@ export const runScaffoldCli = async ({ // Remove typegen files from gitignore const gitignorePath = join(projectPath, '.gitignore'); const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); - const newGitIgnoreContents = gitignoreContents - .replace(/^(src\/sway-api\.+)$/mg, '# $1'); + const newGitIgnoreContents = gitignoreContents.replace(/^(src\/sway-api\.+)$/gm, '# $1'); writeFileSync(gitignorePath, newGitIgnoreContents); if (opts.install) { From 9367c602d36188ef248131530cb69a282b54fb2e Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 25 Sep 2024 14:55:06 +0530 Subject: [PATCH 29/33] enable pr release --- .github/workflows/pr-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 6eeca1f3f04..593d7fce145 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - if: false + # if: false permissions: write-all steps: - name: Checkout From 2af43a6e28aa607e09038c83fef76dbd0d158f4c Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 25 Sep 2024 15:38:39 +0530 Subject: [PATCH 30/33] disable pr release --- .github/workflows/pr-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 593d7fce145..6eeca1f3f04 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - # if: false + if: false permissions: write-all steps: - name: Checkout From 713a06afd604b12c6c61e35f008d0180c201235a Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 25 Sep 2024 18:29:14 +0530 Subject: [PATCH 31/33] enable pr release again, and add some debug logic --- .github/workflows/pr-release.yaml | 2 +- packages/create-fuels/src/cli.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 6eeca1f3f04..593d7fce145 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - if: false + # if: false permissions: write-all steps: - name: Checkout diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 85923dc6fb8..60f0195f8ba 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -151,7 +151,8 @@ export const runScaffoldCli = async ({ color: 'green', }).start(); process.chdir(projectPath); - execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + // execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); + execSync('pnpm install'); installDepsSpinner.succeed('Installed dependencies!'); } From a591c684d889749fd026cb779b3f6281ef21e2bc Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 25 Sep 2024 19:01:50 +0530 Subject: [PATCH 32/33] fix gitignore regex --- packages/create-fuels/src/cli.ts | 2 +- templates/nextjs/.gitignore | 1 + templates/nextjs/gitignore | 1 + templates/vite/.gitignore | 1 + templates/vite/gitignore | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 60f0195f8ba..73edf4247bf 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -142,7 +142,7 @@ export const runScaffoldCli = async ({ // Remove typegen files from gitignore const gitignorePath = join(projectPath, '.gitignore'); const gitignoreContents = readFileSync(gitignorePath, 'utf-8'); - const newGitIgnoreContents = gitignoreContents.replace(/^(src\/sway-api\.+)$/gm, '# $1'); + const newGitIgnoreContents = gitignoreContents.replace(/^(src\/sway-api\/.+)$/gm, '# $1'); writeFileSync(gitignorePath, newGitIgnoreContents); if (opts.install) { diff --git a/templates/nextjs/.gitignore b/templates/nextjs/.gitignore index e31a7ab8ffb..af7ab5ecd45 100644 --- a/templates/nextjs/.gitignore +++ b/templates/nextjs/.gitignore @@ -39,6 +39,7 @@ sway-programs/**/out test-results playwright-report + # Uncomment the lines below if you don't wish # to commit the generated files to git diff --git a/templates/nextjs/gitignore b/templates/nextjs/gitignore index 525875ff7c1..02f0205c689 100644 --- a/templates/nextjs/gitignore +++ b/templates/nextjs/gitignore @@ -40,6 +40,7 @@ sway-programs/**/out test-results playwright-report + # Uncomment the lines below if you don't wish # to commit the generated files to git diff --git a/templates/vite/.gitignore b/templates/vite/.gitignore index 84ed5ab729a..bfad1ed475f 100644 --- a/templates/vite/.gitignore +++ b/templates/vite/.gitignore @@ -30,6 +30,7 @@ sway-programs/**/out test-results playwright-report + # Uncomment the lines below if you don't wish # to commit the generated files to git diff --git a/templates/vite/gitignore b/templates/vite/gitignore index 84ed5ab729a..bfad1ed475f 100644 --- a/templates/vite/gitignore +++ b/templates/vite/gitignore @@ -30,6 +30,7 @@ sway-programs/**/out test-results playwright-report + # Uncomment the lines below if you don't wish # to commit the generated files to git From 6b3e4feec13c84c6a5455aa8ef7260d42e08fc94 Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Wed, 25 Sep 2024 19:06:40 +0530 Subject: [PATCH 33/33] disable pr release --- .github/workflows/pr-release.yaml | 2 +- packages/create-fuels/src/cli.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 593d7fce145..6eeca1f3f04 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - # if: false + if: false permissions: write-all steps: - name: Checkout diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 73edf4247bf..2f7dd6b7814 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -151,8 +151,7 @@ export const runScaffoldCli = async ({ color: 'green', }).start(); process.chdir(projectPath); - // execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); - execSync('pnpm install'); + execSync(packageManager.install, { stdio: verboseEnabled ? 'inherit' : 'pipe' }); installDepsSpinner.succeed('Installed dependencies!'); }