diff --git a/.changeset/cyan-chicken-jam.md b/.changeset/cyan-chicken-jam.md new file mode 100644 index 00000000000..6046afdbc10 --- /dev/null +++ b/.changeset/cyan-chicken-jam.md @@ -0,0 +1,4 @@ +--- +--- + +fix: build error for `demo-wallet-sdk-react` diff --git a/.changeset/shaggy-houses-remember.md b/.changeset/shaggy-houses-remember.md new file mode 100644 index 00000000000..225b53e9f43 --- /dev/null +++ b/.changeset/shaggy-houses-remember.md @@ -0,0 +1,5 @@ +--- +"create-fuels": patch +--- + +feat: add testing to `create-fuels` diff --git a/apps/demo-wallet-sdk-react/package.json b/apps/demo-wallet-sdk-react/package.json index 72010cc97b8..5bc31d04509 100644 --- a/apps/demo-wallet-sdk-react/package.json +++ b/apps/demo-wallet-sdk-react/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "@fuels/connectors": "^0.2.2", + "@fuels/connectors": "^0.8.1", "@fuels/react": "^0.20.0", "@tanstack/react-query": "^5.51.1", "fuels": "workspace:*", diff --git a/apps/demo-wallet-sdk-react/pages/_app.tsx b/apps/demo-wallet-sdk-react/pages/_app.tsx index 620a2a8e57c..9076f9d2d83 100644 --- a/apps/demo-wallet-sdk-react/pages/_app.tsx +++ b/apps/demo-wallet-sdk-react/pages/_app.tsx @@ -1,6 +1,12 @@ import "@/styles/globals.css"; // #region wallet-sdk-react-provider -import { defaultConnectors } from '@fuels/connectors'; +import { + BakoSafeConnector, + FueletWalletConnector, + FuelWalletConnector, + FuelWalletDevelopmentConnector, + WalletConnectConnector, +} from "@fuels/connectors"; import { FuelProvider } from "@fuels/react"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import type { AppProps } from "next/app"; @@ -12,13 +18,21 @@ export default function App({ Component, pageProps }: AppProps) { return ( - - + + ); } // #endregion wallet-sdk-react-provider - - diff --git a/apps/docs-snippets/src/guide/contracts/interacting-with-contracts.test.ts b/apps/docs-snippets/src/guide/contracts/interacting-with-contracts.test.ts index e24e2764608..d96b55652f8 100644 --- a/apps/docs-snippets/src/guide/contracts/interacting-with-contracts.test.ts +++ b/apps/docs-snippets/src/guide/contracts/interacting-with-contracts.test.ts @@ -18,7 +18,7 @@ describe(__filename, () => { }); it('should successfully use "get" to read from the blockchain', async () => { - const { waitForResult } = await counterContract.functions.increment_count(1).call(); + const { waitForResult } = await counterContract.functions.increment_counter(1).call(); await waitForResult(); const { id: contractId, interface: abi } = counterContract; @@ -37,7 +37,7 @@ describe(__filename, () => { // #region interacting-with-contracts-2 const contract = new Contract(contractId, abi, provider); - const { value } = await contract.functions.increment_count(1).dryRun(); + const { value } = await contract.functions.increment_counter(1).dryRun(); // #endregion interacting-with-contracts-2 expect(value.toNumber()).toBeGreaterThanOrEqual(1); }); @@ -50,7 +50,7 @@ describe(__filename, () => { // #region interacting-with-contracts-3 const contract = new Contract(contractId, abi, fundedWallet); - const { value } = await contract.functions.increment_count(10).simulate(); + const { value } = await contract.functions.increment_counter(10).simulate(); // #endregion interacting-with-contracts-3 expect(value.toNumber()).toBeGreaterThanOrEqual(10); }); @@ -59,7 +59,7 @@ describe(__filename, () => { const contract = counterContract; // #region interacting-with-contracts-4 - const { transactionId, waitForResult } = await contract.functions.increment_count(10).call(); + const { transactionId, waitForResult } = await contract.functions.increment_counter(10).call(); const { value } = await waitForResult(); // #endregion interacting-with-contracts-4 @@ -72,7 +72,7 @@ describe(__filename, () => { const contract = counterContract; // #region interacting-with-contracts-5 - const { waitForResult } = await contract.functions.increment_count(10).call(); + const { waitForResult } = await contract.functions.increment_counter(10).call(); const { value } = await waitForResult(); // #endregion interacting-with-contracts-5 diff --git a/apps/docs-snippets/src/guide/contracts/multicalls.test.ts b/apps/docs-snippets/src/guide/contracts/multicalls.test.ts index c93f2d2fd88..2ef6bd2e722 100644 --- a/apps/docs-snippets/src/guide/contracts/multicalls.test.ts +++ b/apps/docs-snippets/src/guide/contracts/multicalls.test.ts @@ -61,8 +61,8 @@ describe(__filename, () => { const { waitForResult } = await counterContract .multiCall([ counterContract.functions.get_count(), - counterContract.functions.increment_count(2), - counterContract.functions.increment_count(4), + counterContract.functions.increment_counter(2), + counterContract.functions.increment_counter(4), ]) .call(); @@ -83,7 +83,7 @@ describe(__filename, () => { const chain = echoContract.multiCall([ echoContract.functions.echo_u8(17), counterContract.functions.get_count(), - counterContract.functions.increment_count(5), + counterContract.functions.increment_counter(5), ]); const { waitForResult } = await chain.call(); diff --git a/apps/docs-snippets/src/guide/cookbook/custom-transactions-contract-calls.test.ts b/apps/docs-snippets/src/guide/cookbook/custom-transactions-contract-calls.test.ts index c54befc0472..9cf3d2248a6 100644 --- a/apps/docs-snippets/src/guide/cookbook/custom-transactions-contract-calls.test.ts +++ b/apps/docs-snippets/src/guide/cookbook/custom-transactions-contract-calls.test.ts @@ -41,7 +41,7 @@ describe('Custom Transactions from Contract Calls', () => { // Connect to the contract const contractInstance = new Contract(contract.id, abi, senderWallet); // Create an invocation scope for the contract function you'd like to call in the transaction - const scope = contractInstance.functions.increment_count(amountToRecipient).addTransfer({ + const scope = contractInstance.functions.increment_counter(amountToRecipient).addTransfer({ amount: amountToRecipient, destination: receiverWallet.address, assetId: baseAssetId, diff --git a/apps/docs-snippets/src/guide/create-fuels/decrement_counter.test.ts b/apps/docs-snippets/src/guide/create-fuels/decrement_counter.test.ts new file mode 100644 index 00000000000..6081f6c4d27 --- /dev/null +++ b/apps/docs-snippets/src/guide/create-fuels/decrement_counter.test.ts @@ -0,0 +1,65 @@ +import { launchTestNode } from 'fuels/test-utils'; +import { describe, test, expect } from 'vitest'; + +import { CounterAbi__factory } from '../../../test/typegen'; +import bytecode from '../../../test/typegen/contracts/CounterAbi.hex'; + +/** + * @group node + * @group browser + */ +describe('Counter Contract', () => { + // #region decrement-counter + // #context import { CounterAbi__factory } from './sway-programs-api'; + // #context import bytecode from './sway-programs-api/contracts/CounterAbi.hex'; + + test('calls the decrement_counter function', async () => { + // First, we'll launch a test node, passing the contract factory and bytecode. This will deploy the contract + // to our test node so we can test against it. + using launched = await launchTestNode({ + // The test node will be killed automatically once the `launched` variable goes out of scope, + // because we are instantiating it with the `using` keyword. + contractsConfigs: [ + { + deployer: CounterAbi__factory, + bytecode, + }, + ], + }); + + // We can now destructure the contract from the launched object. + const { + contracts: [contract], + } = launched; + + // Lets setup some values to use in the test. + const initialCount = 0; + const incrementedValue = 5; + const decrementedValue = 2; + + // We can now call the contract functions and test the results. Lets assert the initial value of the counter. + const { waitForResult: initWaitForResult } = await contract.functions.get_count().call(); + const { value: initValue } = await initWaitForResult(); + expect(initValue.toNumber()).toBe(initialCount); + + // Next we'll increment the counter, so that we can decrement it. + const { waitForResult: incWaitForResult } = await contract.functions + .increment_counter(5) + .call(); + const { value: incValue } = await incWaitForResult(); + expect(incValue.toNumber()).toBe(incrementedValue); + + // Next, we'll decrement the counter by 3 and assert the new value. + const { waitForResult: decWaitForResult } = await contract.functions + .decrement_counter(3) + .call(); + const { value: decValue } = await decWaitForResult(); + expect(decValue.toNumber()).toBe(decrementedValue); + + // Finally, we'll test the get count function again to ensure parity. + const { waitForResult: finalWaitForResult } = await contract.functions.get_count().call(); + const { value: finalValue } = await finalWaitForResult(); + expect(finalValue.toNumber()).toBe(decrementedValue); + }); + // #endregion decrement-counter +}); diff --git a/apps/docs-snippets/src/guide/transactions/transaction-parameters.test.ts b/apps/docs-snippets/src/guide/transactions/transaction-parameters.test.ts index 964c53ea4e8..f685ec14af5 100644 --- a/apps/docs-snippets/src/guide/transactions/transaction-parameters.test.ts +++ b/apps/docs-snippets/src/guide/transactions/transaction-parameters.test.ts @@ -93,7 +93,7 @@ describe(__filename, () => { it('executes contract call with txParams', async () => { // #region transaction-parameters-8 const { waitForResult } = await contract.functions - .increment_count(15) + .increment_counter(15) .txParams({ variableOutputs: 1, }) diff --git a/apps/docs-snippets/src/guide/transactions/transaction-response.test.ts b/apps/docs-snippets/src/guide/transactions/transaction-response.test.ts index af003917be6..8bb9495e1e8 100644 --- a/apps/docs-snippets/src/guide/transactions/transaction-response.test.ts +++ b/apps/docs-snippets/src/guide/transactions/transaction-response.test.ts @@ -28,7 +28,7 @@ describe('Transaction Response', () => { it('gets transaction response from contract call', async () => { // #region transaction-response-1 // Call a contract function - const call = await contract.functions.increment_count(15).call(); + const call = await contract.functions.increment_counter(15).call(); // Wait for the result const { transactionResponse } = await call.waitForResult(); diff --git a/apps/docs-snippets/test/fixtures/forc-projects/counter/src/main.sw b/apps/docs-snippets/test/fixtures/forc-projects/counter/src/main.sw index e3e3beddcd5..fe7abebcfab 100644 --- a/apps/docs-snippets/test/fixtures/forc-projects/counter/src/main.sw +++ b/apps/docs-snippets/test/fixtures/forc-projects/counter/src/main.sw @@ -5,7 +5,10 @@ abi Counter { fn get_count() -> u64; #[storage(write, read)] - fn increment_count(amount: u64) -> u64; + fn increment_counter(amount: u64) -> u64; + + #[storage(write, read)] + fn decrement_counter(amount: u64) -> u64; } storage { @@ -19,9 +22,16 @@ impl Counter for Contract { } #[storage(write, read)] - fn increment_count(amount: u64) -> u64 { + fn increment_counter(amount: u64) -> u64 { let current = storage.counter.read(); storage.counter.write(current + amount); storage.counter.read() } + + #[storage(write, read)] + fn decrement_counter(amount: u64) -> u64 { + let current = storage.counter.read(); + storage.counter.write(current - amount); + storage.counter.read() + } } diff --git a/apps/docs/src/guide/creating-a-fuel-dapp/index.md b/apps/docs/src/guide/creating-a-fuel-dapp/index.md index 95ee7502f87..16b1778da12 100644 --- a/apps/docs/src/guide/creating-a-fuel-dapp/index.md +++ b/apps/docs/src/guide/creating-a-fuel-dapp/index.md @@ -183,7 +183,7 @@ Second, we will add a new button to the UI that will call the `onDecrementPresse ``` -Congratulations! That's all. You should now be able to see the counter dApp running at `http://localhost:3000` with our newly added decrement functionality. +Congratulations! You should now be able to see the counter dApp running at `http://localhost:3000` with our newly added decrement functionality. You can find the complete source code of the dApp we built [here](https://github.com/FuelLabs/fuels-ts/tree/master/apps/create-fuels-counter-guide). @@ -191,6 +191,14 @@ You can find the complete source code of the dApp we built [here](https://github Whenever you want to add a new feature to your dApp and quickly prototype things, you can follow the same steps we followed in this guide. +### 3. Extending the Test Suite (Optional) + +Testing the integration with your smart contract isn't essential, but it's good practice to ensure that your application is working as expected. It also gives you the ability to test your application in a controlled environment against a local node. + +We've provided some examples for each program type in the `./test` directory of your project. But let's also add a test for our new `decrement_counter` function in the `./test/contract.test.ts` file: + +<<< @/../../docs-snippets/src/guide/create-fuels/decrement_counter.test.ts#decrement-counter{ts:line-numbers} + ## Next Steps - Now that you have a basic counter dApp running and have the `npm create fuels` workflow powering you, you can start building more complex dApps using the Fuel Stack. A good place to start for ideas and reference code is the [Sway Applications Repo](https://github.com/FuelLabs/sway-applications). @@ -199,6 +207,8 @@ Whenever you want to add a new feature to your dApp and quickly prototype things - If you want to deploy your dApp to the testnet, check out our [Deploying a dApp to Testnet](./deploying-a-dapp-to-testnet.md) guide. +- If you want to further validate the functionality of your dApp and program types, check out the `test` directory in your `create fuels` project. Couple this with our [testing guide](https://docs.fuel.network/docs/fuels-ts/testing/) to get a better understanding of how to test your dApp. + - If you have any questions or need help, feel free to reach out to us on the [Official Fuel Forum](https://forum.fuel.network/). - If you want to learn more about the Fuel Stack, check out the [Fuel Docs](https://docs.fuel.network/). diff --git a/packages/create-fuels/src/bin.ts b/packages/create-fuels/src/bin.ts index 495ef63f4a8..2b99fd3aeb6 100644 --- a/packages/create-fuels/src/bin.ts +++ b/packages/create-fuels/src/bin.ts @@ -5,6 +5,7 @@ import { runScaffoldCli, setupProgram } from './cli'; runScaffoldCli({ program: setupProgram(), + templateName: 'nextjs', args: process.argv, }) .then(() => process.exit(0)) diff --git a/packages/create-fuels/src/cli.ts b/packages/create-fuels/src/cli.ts index 01ce25ad394..eac6298a3cf 100644 --- a/packages/create-fuels/src/cli.ts +++ b/packages/create-fuels/src/cli.ts @@ -38,10 +38,12 @@ function writeEnvFile(envFilePath: string) { export const runScaffoldCli = async ({ program, + templateName = 'nextjs', args = process.argv, }: { program: Command; args: string[]; + templateName: string; }) => { program.parse(args); @@ -84,7 +86,8 @@ export const runScaffoldCli = async ({ await mkdir(projectPath); - await cp(join(__dirname, '../templates/nextjs'), projectPath, { + const templateDir = join(__dirname, '..', 'templates', templateName); + await cp(templateDir, projectPath, { recursive: true, filter: (filename) => !filename.includes('CHANGELOG.md'), }); diff --git a/packages/create-fuels/src/lib/rewriteTemplateFiles.test.ts b/packages/create-fuels/src/lib/rewriteTemplateFiles.test.ts index 1b30e0ca744..cc15c10ed1a 100644 --- a/packages/create-fuels/src/lib/rewriteTemplateFiles.test.ts +++ b/packages/create-fuels/src/lib/rewriteTemplateFiles.test.ts @@ -3,6 +3,7 @@ import { join } from 'path'; import { bootstrapProject, + cleanupFilesystem, copyTemplate, resetFilesystem, type ProjectPaths, @@ -24,19 +25,23 @@ describe('rewriteTemplateFiles', () => { beforeEach(() => { paths = bootstrapProject(__filename); - copyTemplate(paths.sourceTemplate, paths.template, false); + copyTemplate(paths.templateSource, paths.templateRoot, false); }); afterEach(() => { - resetFilesystem(paths.root); - resetFilesystem(paths.template); + resetFilesystem(paths.projectRoot); + resetFilesystem(paths.templateRoot); vi.resetAllMocks(); }); + afterAll(() => { + cleanupFilesystem(); + }); + it('should rewrite the package.json', () => { - const packageJsonPath = join(paths.template, 'package.json'); + const packageJsonPath = join(paths.templateRoot, 'package.json'); - rewriteTemplateFiles(paths.template); + rewriteTemplateFiles(paths.templateRoot); const packageJson = readFileSync(packageJsonPath, 'utf-8'); @@ -49,13 +54,42 @@ describe('rewriteTemplateFiles', () => { }); it('should rewrite the fuels.config.ts', () => { - const fuelsConfigPath = join(paths.template, 'fuels.config.ts'); + const fuelsConfigPath = join(paths.templateRoot, 'fuels.config.ts'); - rewriteTemplateFiles(paths.template); + rewriteTemplateFiles(paths.templateRoot); const fuelsConfig = readFileSync(fuelsConfigPath, 'utf-8'); expect(fuelsConfig).not.toContain(/\n\W+forcPath: 'fuels-forc',/g); expect(fuelsConfig).not.toContain(/\n\W+fuelCorePath: 'fuels-core',/g); }); + + it('should rewrite the test files', () => { + const testDir = join(paths.templateRoot, 'test'); + const programs = [ + { + program: 'contract', + capitalised: 'Contract', + }, + { + program: 'predicate', + capitalised: 'Predicate', + }, + { + program: 'script', + capitalised: 'Script', + }, + ]; + + rewriteTemplateFiles(paths.templateRoot); + + programs.forEach(({ program, capitalised }) => { + const testFilePath = join(testDir, `${program}.test.ts`); + const testFileContents = readFileSync(testFilePath, 'utf-8'); + + expect(testFileContents).not.toContain('@group node'); + expect(testFileContents).not.toContain('@group browser'); + expect(testFileContents).toContain(`${capitalised} Testing`); + }); + }); }); diff --git a/packages/create-fuels/src/lib/rewriteTemplateFiles.ts b/packages/create-fuels/src/lib/rewriteTemplateFiles.ts index 1bc26c49b00..86a487486bd 100644 --- a/packages/create-fuels/src/lib/rewriteTemplateFiles.ts +++ b/packages/create-fuels/src/lib/rewriteTemplateFiles.ts @@ -17,4 +17,16 @@ export const rewriteTemplateFiles = (templateDir: string) => { 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'); + const programs = ['contract', 'predicate', 'script']; + programs.forEach((program) => { + const testFilePath = join(testDir, `${program}.test.ts`); + contents = readFileSync(testFilePath, 'utf-8'); + const capitalisedProgram = program.charAt(0).toUpperCase() + program.slice(1); + contents = contents.replace(/@group node/g, `${capitalisedProgram} Testing`); + contents = contents.replace(/@group browser/g, ''); + writeFileSync(testFilePath, contents); + }); }; diff --git a/packages/create-fuels/test/cli.test.ts b/packages/create-fuels/test/cli.test.ts index fcc721073c6..defd7e96228 100644 --- a/packages/create-fuels/test/cli.test.ts +++ b/packages/create-fuels/test/cli.test.ts @@ -25,12 +25,12 @@ describe('CLI', () => { beforeEach(() => { paths = bootstrapProject(__filename); - copyTemplate(paths.sourceTemplate, paths.template); + copyTemplate(paths.templateSource, paths.templateRoot); }); afterEach(() => { - resetFilesystem(paths.root); - resetFilesystem(paths.template); + resetFilesystem(paths.projectRoot); + resetFilesystem(paths.templateRoot); vi.resetAllMocks(); }); @@ -39,30 +39,32 @@ describe('CLI', () => { }); test('create-fuels extracts the template to the specified directory', async () => { - const args = generateArgv(paths.root); + const args = generateArgv(paths.projectRoot); await runScaffoldCli({ program: setupProgram(), + templateName: paths.templateName, args, }); - let originalTemplateFiles = await getAllFiles(paths.template); + let originalTemplateFiles = await getAllFiles(paths.templateSource); originalTemplateFiles = filterOriginalTemplateFiles(originalTemplateFiles); - const testProjectFiles = await getAllFiles(paths.root); + const testProjectFiles = await getAllFiles(paths.projectRoot); expect(originalTemplateFiles.sort()).toEqual(testProjectFiles.sort()); }); test('create-fuels checks the versions on the fuel-toolchain file', async () => { - const args = generateArgv(paths.root); + const args = generateArgv(paths.projectRoot); await runScaffoldCli({ program: setupProgram(), + templateName: paths.templateName, args, }); - const fuelToolchainPath = join(paths.root, 'sway-programs', 'fuel-toolchain.toml'); + const fuelToolchainPath = join(paths.projectRoot, 'sway-programs', 'fuel-toolchain.toml'); const fuelToolchain = readFileSync(fuelToolchainPath, 'utf-8'); const parsedFuelToolchain = toml.parse(fuelToolchain); @@ -73,39 +75,41 @@ describe('CLI', () => { }); test('should rewrite for the appropriate package manager', async () => { - const args = generateArgv(paths.root, 'bun'); + const args = generateArgv(paths.projectRoot, 'bun'); await runScaffoldCli({ program: setupProgram(), + templateName: paths.templateName, args, }); - const packageJsonPath = join(paths.root, 'package.json'); + const packageJsonPath = join(paths.projectRoot, 'package.json'); const packageJson = readFileSync(packageJsonPath, 'utf-8'); expect(packageJson).toContain('bun run prebuild'); - const readmePath = join(paths.root, 'README.md'); + const readmePath = join(paths.projectRoot, 'README.md'); const readme = readFileSync(readmePath, 'utf-8'); expect(readme).toContain('bun run fuels:dev'); expect(readme).toContain('bun run dev'); }); test('create-fuels reports an error if the project directory already exists', async () => { - const args = generateArgv(paths.root); + const args = generateArgv(paths.projectRoot); // Generate the project once - mkdirSync(paths.root, { recursive: true }); + mkdirSync(paths.projectRoot, { recursive: true }); // Generate the project again await runScaffoldCli({ program: setupProgram(), + templateName: paths.templateName, args, }).catch((e) => { expect(e).toBeInstanceOf(Error); }); expect(error).toHaveBeenCalledWith( - expect.stringContaining(`A folder already exists at ${paths.root}`) + expect.stringContaining(`A folder already exists at ${paths.projectRoot}`) ); }); }); diff --git a/packages/create-fuels/test/utils/bootstrapProject.ts b/packages/create-fuels/test/utils/bootstrapProject.ts index 25c5cda72ce..8aa6da46503 100644 --- a/packages/create-fuels/test/utils/bootstrapProject.ts +++ b/packages/create-fuels/test/utils/bootstrapProject.ts @@ -4,10 +4,14 @@ import { basename, join } from 'path'; import { rewriteTemplateFiles } from '../../src/lib/rewriteTemplateFiles'; export type ProjectPaths = { - root: string; - template: string; - sourceTemplate: string; - packageJson: string; + // Project paths + projectRoot: string; + projectPackageJson: string; + + // Template paths + templateName: string; + templateSource: string; + templateRoot: string; }; /** @@ -15,30 +19,34 @@ export type ProjectPaths = { */ const testDir = join(__dirname, '..'); const createFuelsDir = join(__dirname, '../..'); -const testTemplateDir = join(createFuelsDir, 'templates'); -const templatesDir = join(__dirname, '../../../../templates'); +const sourceTemplatesDir = join(__dirname, '../../../../templates'); export const bootstrapProject = ( testFilepath: string, - templateName: string = 'nextjs' + template: string = 'nextjs' ): ProjectPaths => { - // Template paths - const templateDir = join(templatesDir, templateName); - const localTemplateDir = join(testTemplateDir, templateName); - // Unique name const testFilename = basename(testFilepath.replace(/\./g, '-')); - const projectName = `__temp__${testFilename}_${new Date().getTime()}`; - // Test paths - const root = join(testDir, projectName); - const packageJson = join(root, 'package.json'); + // Project paths + const projectName = `__temp__project_${testFilename}_${new Date().getTime()}`; + const projectRoot = join(testDir, projectName); + const projectPackageJson = join(projectRoot, 'package.json'); + + // Template paths + const templateName = `__temp__template_${template}_${testFilename}_${new Date().getTime()}`; + const templateSource = join(sourceTemplatesDir, template); + const templateRoot = join(createFuelsDir, 'templates', templateName); return { - root, - template: localTemplateDir, - sourceTemplate: templateDir, - packageJson, + // Project paths + projectRoot, + projectPackageJson, + + // Template paths + templateName, + templateSource, + templateRoot, }; }; @@ -58,11 +66,12 @@ export const resetFilesystem = (dirPath: string) => { } }; -export const cleanupFilesystem = (dirPath: string = testDir) => { - const dirs = readdirSync(dirPath).filter((dir) => dir.startsWith('__temp__')); - dirs.forEach((dir) => { - resetFilesystem(join(dirPath, dir)); - }); - - resetFilesystem(testTemplateDir); +export const cleanupFilesystem = (dirPaths: string[] = [testDir, createFuelsDir]) => { + dirPaths + .flatMap((dirPath) => { + const dirsInDir = readdirSync(dirPath); + return dirsInDir.map((dir) => join(dirPath, dir)); + }) + .filter((dir) => dir.startsWith('__temp__')) + .forEach(resetFilesystem); }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d79c6ccd1f3..bd307cddf27 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -413,8 +413,8 @@ importers: apps/demo-wallet-sdk-react: dependencies: '@fuels/connectors': - specifier: ^0.2.2 - version: 0.2.2(fuels@packages+fuels) + specifier: ^0.8.1 + version: 0.8.1(r357fiedv7eoeqny7ldby5u7i4) '@fuels/react': specifier: ^0.20.0 version: 0.20.0(@tanstack/react-query@5.51.1(react@18.3.1))(@types/react-dom@18.2.4)(@types/react@18.3.3)(fuels@packages+fuels)(react-dom@18.2.0(react@18.3.1))(react@18.3.1) @@ -426,7 +426,7 @@ importers: version: link:../../packages/fuels next: specifier: 14.2.5 - version: 14.2.5(@babel/core@7.24.4)(@playwright/test@1.45.1)(react-dom@18.2.0(react@18.3.1))(react@18.3.1) + version: 14.2.5(@babel/core@7.24.7)(@playwright/test@1.45.1)(react-dom@18.2.0(react@18.3.1))(react@18.3.1) react: specifier: ^18.3.1 version: 18.3.1 @@ -1179,7 +1179,7 @@ importers: dependencies: '@fuels/connectors': specifier: ^0.8.1 - version: 0.8.1(cjycyhi4hner6hovr2iowxmmxu) + version: 0.8.1(gzqss7a4va6g6zpnxcim2yt36e) '@fuels/react': specifier: ^0.20.0 version: 0.20.0(@tanstack/react-query@5.51.1(react@18.3.1))(@types/react-dom@18.3.0)(@types/react@18.3.3)(fuels@packages+fuels)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -1225,16 +1225,19 @@ importers: version: 8.54.0 eslint-config-next: specifier: 14.2.5 - version: 14.2.5(eslint@8.54.0)(typescript@5.2.2) + version: 14.2.5(eslint@8.54.0)(typescript@5.4.5) postcss: specifier: ^8 version: 8.4.24 tailwindcss: specifier: ^3.4.4 - version: 3.4.4(ts-node@10.9.1(@types/node@20.10.5)(typescript@5.2.2)) + version: 3.4.4(ts-node@10.9.1(@types/node@20.10.5)(typescript@5.4.5)) typescript: - specifier: ^5 - version: 5.2.2 + specifier: ~5.4.5 + version: 5.4.5 + vitest: + specifier: ^1.6.0 + version: 1.6.0(@types/node@20.10.5)(@vitest/browser@1.6.0)(jsdom@16.7.0(bufferutil@4.0.8)(utf-8-validate@6.0.4))(terser@5.18.2) packages: @@ -3032,11 +3035,6 @@ packages: resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} engines: {node: '>=14'} - '@fuels/connectors@0.2.2': - resolution: {integrity: sha512-TbyJjK3GgyeF6ERZyoh8GfECAVBoI69w4Ee/Osw2Q1zzGIY5/oWwPJxCUzOzd+47eIRWlvtItl1mvkyDyn3aVA==} - peerDependencies: - fuels: '>=0.78.0' - '@fuels/connectors@0.8.1': resolution: {integrity: sha512-y9BUnWdyq7rcBJc3yMp6kAUdJhPOu1D09+/t+c/Ayy+cGuzYiFOfF2H/BMTM37YatlZnpkXmTh1Cf/XHKQfnPw==} peerDependencies: @@ -6972,8 +6970,8 @@ packages: dedent@0.7.0: resolution: {integrity: sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==} - deep-eql@4.1.3: - resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + deep-eql@4.1.4: + resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} engines: {node: '>=6'} deep-equal@2.2.1: @@ -10004,9 +10002,6 @@ packages: engines: {node: '>=10'} hasBin: true - mlly@1.5.0: - resolution: {integrity: sha512-NPVQvAY1xr1QoVeG0cy8yUYC7FQcOx6evl/RjT1wL5FvzPnzOysoqB/jmx/DhssT2dYa8nxECLAaFI/+gVLhDQ==} - mlly@1.7.0: resolution: {integrity: sha512-U9SDaXGEREBYQgfejV97coK0UL1r+qnF2SyO9A3qcI8MzKnsIFKHNVEkrDyNncQTKQQumsasmeq84eNMdBfsNQ==} @@ -10686,9 +10681,6 @@ packages: resolution: {integrity: sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==} engines: {node: '>=10'} - pkg-types@1.0.3: - resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} - pkg-types@1.1.1: resolution: {integrity: sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==} @@ -12677,15 +12669,15 @@ packages: tiny-case@1.0.3: resolution: {integrity: sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==} - tinybench@2.6.0: - resolution: {integrity: sha512-N8hW3PG/3aOoZAN5V/NSAEDz0ZixDSSt5b/a05iqtpgfLWMSVuCo7w0k2vVvEjdrIoeGqZzweX2WlyioNIHchA==} + tinybench@2.8.0: + resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==} tinypool@0.8.4: resolution: {integrity: sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==} engines: {node: '>=14.0.0'} - tinyspy@2.2.0: - resolution: {integrity: sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==} + tinyspy@2.2.1: + resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==} engines: {node: '>=14.0.0'} title-case@3.0.3: @@ -13016,9 +13008,6 @@ packages: uc.micro@2.1.0: resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} - ufo@1.3.2: - resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} - ufo@1.5.3: resolution: {integrity: sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==} @@ -13867,8 +13856,8 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} - yocto-queue@1.0.0: - resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} + yocto-queue@1.1.1: + resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} engines: {node: '>=12.20'} yup@1.4.0: @@ -14087,7 +14076,7 @@ snapshots: '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 - picocolors: 1.0.0 + picocolors: 1.0.1 '@babel/compat-data@7.22.5': {} @@ -16896,16 +16885,58 @@ snapshots: '@fastify/busboy@2.1.1': {} - '@fuels/connectors@0.2.2(fuels@packages+fuels)': + '@fuels/connectors@0.8.1(cjycyhi4hner6hovr2iowxmmxu)': + dependencies: + '@ethereumjs/util': 9.0.3 + '@ethersproject/bytes': 5.7.0 + '@wagmi/core': 2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) + '@web3modal/wagmi': 4.1.11(fhmxtqzeb5uqln7w57atmj6tzu) + fuels: link:packages/fuels + socket.io-client: 4.7.2(bufferutil@4.0.8)(utf-8-validate@6.0.4) + viem: 2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4) + transitivePeerDependencies: + - '@tanstack/query-core' + - '@types/react' + - '@wagmi/connectors' + - bufferutil + - immer + - react + - react-dom + - supports-color + - typescript + - utf-8-validate + - vue + - zod + + '@fuels/connectors@0.8.1(gzqss7a4va6g6zpnxcim2yt36e)': dependencies: + '@ethereumjs/util': 9.0.3 + '@ethersproject/bytes': 5.7.0 + '@wagmi/core': 2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) + '@web3modal/wagmi': 4.1.11(ysallm3vwthzbhacxfkokrrei4) fuels: link:packages/fuels + socket.io-client: 4.7.2(bufferutil@4.0.8)(utf-8-validate@6.0.4) + viem: 2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + transitivePeerDependencies: + - '@tanstack/query-core' + - '@types/react' + - '@wagmi/connectors' + - bufferutil + - immer + - react + - react-dom + - supports-color + - typescript + - utf-8-validate + - vue + - zod - '@fuels/connectors@0.8.1(cjycyhi4hner6hovr2iowxmmxu)': + '@fuels/connectors@0.8.1(r357fiedv7eoeqny7ldby5u7i4)': dependencies: '@ethereumjs/util': 9.0.3 '@ethersproject/bytes': 5.7.0 '@wagmi/core': 2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) - '@web3modal/wagmi': 4.1.11(fhmxtqzeb5uqln7w57atmj6tzu) + '@web3modal/wagmi': 4.1.11(ucvbvgcqlomag3pwek5uktxpsy) fuels: link:packages/fuels socket.io-client: 4.7.2(bufferutil@4.0.8)(utf-8-validate@6.0.4) viem: 2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4) @@ -17916,6 +17947,16 @@ snapshots: transitivePeerDependencies: - supports-color + '@metamask/sdk-install-modal-web@0.20.2(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)': + dependencies: + i18next: 22.5.1 + qr-code-styling: 1.6.0-rc.1 + react-i18next: 13.5.0(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1) + optionalDependencies: + react: 18.3.1 + react-dom: 18.2.0(react@18.3.1) + react-native: 0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4) + '@metamask/sdk-install-modal-web@0.20.2(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)': dependencies: i18next: 22.5.1 @@ -17926,6 +17967,42 @@ snapshots: react-dom: 18.3.1(react@18.3.1) react-native: 0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4) + '@metamask/sdk@0.20.3(bufferutil@4.0.8)(react-dom@18.2.0(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(utf-8-validate@6.0.4)': + dependencies: + '@metamask/onboarding': 1.0.1 + '@metamask/providers': 15.0.0 + '@metamask/sdk-communication-layer': 0.20.2(cross-fetch@4.0.0)(eciesjs@0.3.18)(eventemitter2@6.4.9)(readable-stream@3.6.2)(socket.io-client@4.7.5(bufferutil@4.0.8)(utf-8-validate@6.0.4)) + '@metamask/sdk-install-modal-web': 0.20.2(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1) + '@types/dom-screen-wake-lock': 1.0.3 + bowser: 2.11.0 + cross-fetch: 4.0.0 + debug: 4.3.5(supports-color@5.5.0) + eciesjs: 0.3.18 + eth-rpc-errors: 4.0.3 + eventemitter2: 6.4.9 + i18next: 22.5.1 + i18next-browser-languagedetector: 7.1.0 + obj-multiplex: 1.0.0 + pump: 3.0.0 + qrcode-terminal-nooctal: 0.12.1 + react-native-webview: 11.26.1(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1) + readable-stream: 3.6.2 + rollup-plugin-visualizer: 5.12.0(rollup@4.16.4) + socket.io-client: 4.7.5(bufferutil@4.0.8)(utf-8-validate@6.0.4) + util: 0.12.5 + uuid: 8.3.2 + optionalDependencies: + react: 18.3.1 + react-dom: 18.2.0(react@18.3.1) + transitivePeerDependencies: + - bufferutil + - encoding + - react-i18next + - react-native + - rollup + - supports-color + - utf-8-validate + '@metamask/sdk@0.20.3(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(utf-8-validate@6.0.4)': dependencies: '@metamask/onboarding': 1.0.1 @@ -19013,6 +19090,16 @@ snapshots: - utf-8-validate - zod + '@safe-global/safe-apps-provider@0.18.1(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4)': + dependencies: + '@safe-global/safe-apps-sdk': 8.1.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + events: 3.3.0 + transitivePeerDependencies: + - bufferutil + - typescript + - utf-8-validate + - zod + '@safe-global/safe-apps-sdk@8.1.0(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4)': dependencies: '@safe-global/safe-gateway-typescript-sdk': 3.21.1 @@ -19023,6 +19110,16 @@ snapshots: - utf-8-validate - zod + '@safe-global/safe-apps-sdk@8.1.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4)': + dependencies: + '@safe-global/safe-gateway-typescript-sdk': 3.21.1 + viem: 1.21.4(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + transitivePeerDependencies: + - bufferutil + - typescript + - utf-8-validate + - zod + '@safe-global/safe-gateway-typescript-sdk@3.21.1': {} '@scure/base@1.1.6': {} @@ -19491,7 +19588,7 @@ snapshots: '@types/eslint-scope@3.7.4': dependencies: '@types/eslint': 8.40.2 - '@types/estree': 1.0.1 + '@types/estree': 1.0.5 '@types/eslint@8.40.2': dependencies: @@ -19816,6 +19913,19 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5)': + dependencies: + '@typescript-eslint/scope-manager': 6.9.1 + '@typescript-eslint/types': 6.9.1 + '@typescript-eslint/typescript-estree': 6.9.1(typescript@5.4.5) + '@typescript-eslint/visitor-keys': 6.9.1 + debug: 4.3.5(supports-color@5.5.0) + eslint: 8.54.0 + optionalDependencies: + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/parser@6.9.1(eslint@8.57.0)(typescript@5.4.5)': dependencies: '@typescript-eslint/scope-manager': 6.9.1 @@ -20046,13 +20156,13 @@ snapshots: '@vitest/snapshot@1.6.0': dependencies: - magic-string: 0.30.5 + magic-string: 0.30.10 pathe: 1.1.2 pretty-format: 29.7.0 '@vitest/spy@1.6.0': dependencies: - tinyspy: 2.2.0 + tinyspy: 2.2.1 '@vitest/utils@1.6.0': dependencies: @@ -20175,6 +20285,46 @@ snapshots: - '@vue/composition-api' - vue + '@wagmi/connectors@5.0.7(@types/react@18.3.3)(@wagmi/core@2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4))(bufferutil@4.0.8)(react-dom@18.2.0(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4)': + dependencies: + '@coinbase/wallet-sdk': 4.0.2 + '@metamask/sdk': 0.20.3(bufferutil@4.0.8)(react-dom@18.2.0(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(utf-8-validate@6.0.4) + '@safe-global/safe-apps-provider': 0.18.1(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4) + '@safe-global/safe-apps-sdk': 8.1.0(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4) + '@wagmi/core': 2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) + '@walletconnect/ethereum-provider': 2.13.0(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4) + '@walletconnect/modal': 2.6.2(@types/react@18.3.3)(react@18.3.1) + cbw-sdk: '@coinbase/wallet-sdk@3.9.3' + viem: 2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4) + optionalDependencies: + typescript: 5.2.2 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - ioredis + - react + - react-dom + - react-i18next + - react-native + - rollup + - supports-color + - uWebSockets.js + - utf-8-validate + - zod + '@wagmi/connectors@5.0.7(@types/react@18.3.3)(@wagmi/core@2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4)': dependencies: '@coinbase/wallet-sdk': 4.0.2 @@ -20215,6 +20365,46 @@ snapshots: - utf-8-validate - zod + '@wagmi/connectors@5.0.7(@types/react@18.3.3)(@wagmi/core@2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(typescript@5.4.5)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4)': + dependencies: + '@coinbase/wallet-sdk': 4.0.2 + '@metamask/sdk': 0.20.3(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(utf-8-validate@6.0.4) + '@safe-global/safe-apps-provider': 0.18.1(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + '@safe-global/safe-apps-sdk': 8.1.0(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + '@wagmi/core': 2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) + '@walletconnect/ethereum-provider': 2.13.0(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4) + '@walletconnect/modal': 2.6.2(@types/react@18.3.3)(react@18.3.1) + cbw-sdk: '@coinbase/wallet-sdk@3.9.3' + viem: 2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + optionalDependencies: + typescript: 5.4.5 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - ioredis + - react + - react-dom + - react-i18next + - react-native + - rollup + - supports-color + - uWebSockets.js + - utf-8-validate + - zod + '@wagmi/core@2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4)': dependencies: eventemitter3: 5.0.1 @@ -20232,6 +20422,23 @@ snapshots: - utf-8-validate - zod + '@wagmi/core@2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4)': + dependencies: + eventemitter3: 5.0.1 + mipd: 0.0.5(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + viem: 2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + zustand: 4.4.1(@types/react@18.3.3)(immer@9.0.21)(react@18.3.1) + optionalDependencies: + '@tanstack/query-core': 5.51.1 + typescript: 5.4.5 + transitivePeerDependencies: + - '@types/react' + - bufferutil + - immer + - react + - utf-8-validate + - zod + '@walletconnect/core@2.13.0(bufferutil@4.0.8)(utf-8-validate@6.0.4)': dependencies: '@walletconnect/heartbeat': 1.2.2 @@ -20615,6 +20822,15 @@ snapshots: dependencies: buffer: 6.0.3 + '@web3modal/scaffold-react@4.1.11(@types/react@18.3.3)(react-dom@18.2.0(react@18.3.1))(react@18.3.1)': + dependencies: + '@web3modal/scaffold': 4.1.11(@types/react@18.3.3)(react@18.3.1) + optionalDependencies: + react: 18.3.1 + react-dom: 18.2.0(react@18.3.1) + transitivePeerDependencies: + - '@types/react' + '@web3modal/scaffold-react@4.1.11(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@web3modal/scaffold': 4.1.11(@types/react@18.3.3)(react@18.3.1) @@ -20642,6 +20858,15 @@ snapshots: - '@types/react' - react + '@web3modal/scaffold-vue@4.1.11(@types/react@18.3.3)(react@18.3.1)(vue@3.4.31(typescript@5.4.5))': + dependencies: + '@web3modal/scaffold': 4.1.11(@types/react@18.3.3)(react@18.3.1) + optionalDependencies: + vue: 3.4.31(typescript@5.4.5) + transitivePeerDependencies: + - '@types/react' + - react + '@web3modal/scaffold@4.1.11(@types/react@18.3.3)(react@18.3.1)': dependencies: '@web3modal/common': 4.1.11 @@ -20687,6 +20912,42 @@ snapshots: transitivePeerDependencies: - '@types/react' + '@web3modal/wagmi@4.1.11(ucvbvgcqlomag3pwek5uktxpsy)': + dependencies: + '@wagmi/connectors': 5.0.7(@types/react@18.3.3)(@wagmi/core@2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4))(bufferutil@4.0.8)(react-dom@18.2.0(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) + '@wagmi/core': 2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.2.2)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) + '@web3modal/polyfills': 4.1.11 + '@web3modal/scaffold': 4.1.11(@types/react@18.3.3)(react@18.3.1) + '@web3modal/scaffold-react': 4.1.11(@types/react@18.3.3)(react-dom@18.2.0(react@18.3.1))(react@18.3.1) + '@web3modal/scaffold-utils': 4.1.11(@types/react@18.3.3)(react@18.3.1) + '@web3modal/scaffold-vue': 4.1.11(@types/react@18.3.3)(react@18.3.1)(vue@3.4.31(typescript@5.2.2)) + '@web3modal/siwe': 4.1.11(@types/react@18.3.3)(react@18.3.1) + viem: 2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4) + optionalDependencies: + react: 18.3.1 + react-dom: 18.2.0(react@18.3.1) + vue: 3.4.31(typescript@5.2.2) + transitivePeerDependencies: + - '@types/react' + + '@web3modal/wagmi@4.1.11(ysallm3vwthzbhacxfkokrrei4)': + dependencies: + '@wagmi/connectors': 5.0.7(@types/react@18.3.3)(@wagmi/core@2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1)(rollup@4.16.4)(typescript@5.4.5)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) + '@wagmi/core': 2.9.1(@tanstack/query-core@5.51.1)(@types/react@18.3.3)(bufferutil@4.0.8)(immer@9.0.21)(react@18.3.1)(typescript@5.4.5)(utf-8-validate@6.0.4)(viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4))(zod@3.22.4) + '@web3modal/polyfills': 4.1.11 + '@web3modal/scaffold': 4.1.11(@types/react@18.3.3)(react@18.3.1) + '@web3modal/scaffold-react': 4.1.11(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@web3modal/scaffold-utils': 4.1.11(@types/react@18.3.3)(react@18.3.1) + '@web3modal/scaffold-vue': 4.1.11(@types/react@18.3.3)(react@18.3.1)(vue@3.4.31(typescript@5.4.5)) + '@web3modal/siwe': 4.1.11(@types/react@18.3.3)(react@18.3.1) + viem: 2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + optionalDependencies: + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + vue: 3.4.31(typescript@5.4.5) + transitivePeerDependencies: + - '@types/react' + '@web3modal/wallet@4.1.11': dependencies: '@web3modal/polyfills': 4.1.11 @@ -20818,11 +21079,21 @@ snapshots: typescript: 5.2.2 zod: 3.22.4 + abitype@0.9.8(typescript@5.4.5)(zod@3.22.4): + optionalDependencies: + typescript: 5.4.5 + zod: 3.22.4 + abitype@1.0.0(typescript@5.2.2)(zod@3.22.4): optionalDependencies: typescript: 5.2.2 zod: 3.22.4 + abitype@1.0.0(typescript@5.4.5)(zod@3.22.4): + optionalDependencies: + typescript: 5.4.5 + zod: 3.22.4 + abort-controller@3.0.0: dependencies: event-target-shim: 5.0.1 @@ -21789,7 +22060,7 @@ snapshots: dependencies: assertion-error: 1.1.0 check-error: 1.0.3 - deep-eql: 4.1.3 + deep-eql: 4.1.4 get-func-name: 2.0.2 loupe: 2.3.7 pathval: 1.1.1 @@ -22480,7 +22751,7 @@ snapshots: dedent@0.7.0: {} - deep-eql@4.1.3: + deep-eql@4.1.4: dependencies: type-detect: 4.0.8 @@ -23150,6 +23421,24 @@ snapshots: - eslint-import-resolver-webpack - supports-color + eslint-config-next@14.2.5(eslint@8.54.0)(typescript@5.4.5): + dependencies: + '@next/eslint-plugin-next': 14.2.5 + '@rushstack/eslint-patch': 1.6.1 + '@typescript-eslint/parser': 6.9.1(eslint@8.54.0)(typescript@5.4.5) + eslint: 8.54.0 + eslint-import-resolver-node: 0.3.9 + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.54.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + eslint-plugin-jsx-a11y: 6.9.0(eslint@8.54.0) + eslint-plugin-react: 7.34.4(eslint@8.54.0) + eslint-plugin-react-hooks: 4.6.2(eslint@8.54.0) + optionalDependencies: + typescript: 5.4.5 + transitivePeerDependencies: + - eslint-import-resolver-webpack + - supports-color + eslint-config-prettier@9.1.0(eslint@8.57.0): dependencies: eslint: 8.57.0 @@ -23206,6 +23495,23 @@ snapshots: - eslint-import-resolver-webpack - supports-color + eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.54.0): + dependencies: + debug: 4.3.5(supports-color@5.5.0) + enhanced-resolve: 5.15.0 + eslint: 8.54.0 + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.54.0))(eslint@8.54.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0) + fast-glob: 3.3.2 + get-tsconfig: 4.7.5 + is-core-module: 2.13.1 + is-glob: 4.0.3 + transitivePeerDependencies: + - '@typescript-eslint/parser' + - eslint-import-resolver-node + - eslint-import-resolver-webpack + - supports-color + eslint-module-utils@2.8.0(@typescript-eslint/parser@5.59.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): dependencies: debug: 3.2.7 @@ -23227,6 +23533,17 @@ snapshots: transitivePeerDependencies: - supports-color + eslint-module-utils@2.8.0(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.54.0))(eslint@8.54.0): + dependencies: + debug: 3.2.7 + optionalDependencies: + '@typescript-eslint/parser': 6.9.1(eslint@8.54.0)(typescript@5.4.5) + eslint: 8.54.0 + eslint-import-resolver-node: 0.3.9 + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.54.0) + transitivePeerDependencies: + - supports-color + eslint-module-utils@2.8.0(@typescript-eslint/parser@6.9.1(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint@8.54.0): dependencies: debug: 3.2.7 @@ -23284,6 +23601,33 @@ snapshots: - eslint-import-resolver-webpack - supports-color + eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-typescript@3.6.1)(eslint@8.54.0): + dependencies: + array-includes: 3.1.7 + array.prototype.findlastindex: 1.2.3 + array.prototype.flat: 1.3.2 + array.prototype.flatmap: 1.3.2 + debug: 3.2.7 + doctrine: 2.1.0 + eslint: 8.54.0 + eslint-import-resolver-node: 0.3.9 + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.9.1(eslint@8.54.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.54.0))(eslint@8.54.0) + hasown: 2.0.0 + is-core-module: 2.13.1 + is-glob: 4.0.3 + minimatch: 3.1.2 + object.fromentries: 2.0.7 + object.groupby: 1.0.1 + object.values: 1.1.7 + semver: 6.3.1 + tsconfig-paths: 3.15.0 + optionalDependencies: + '@typescript-eslint/parser': 6.9.1(eslint@8.54.0)(typescript@5.4.5) + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.9.1(eslint@8.57.0)(typescript@5.4.5))(eslint@8.54.0): dependencies: array-includes: 3.1.7 @@ -26050,8 +26394,8 @@ snapshots: local-pkg@0.5.0: dependencies: - mlly: 1.5.0 - pkg-types: 1.0.3 + mlly: 1.7.0 + pkg-types: 1.1.1 locate-app@2.2.13: dependencies: @@ -26673,6 +27017,16 @@ snapshots: - utf-8-validate - zod + mipd@0.0.5(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4): + dependencies: + viem: 1.21.4(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4) + optionalDependencies: + typescript: 5.4.5 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + mitt@3.0.0: {} mitt@3.0.1: {} @@ -26685,13 +27039,6 @@ snapshots: mkdirp@1.0.4: {} - mlly@1.5.0: - dependencies: - acorn: 8.11.3 - pathe: 1.1.2 - pkg-types: 1.0.3 - ufo: 1.3.2 - mlly@1.7.0: dependencies: acorn: 8.11.3 @@ -26762,7 +27109,7 @@ snapshots: netmask@2.0.2: {} - next@14.2.5(@babel/core@7.24.4)(@playwright/test@1.45.1)(react-dom@18.2.0(react@18.3.1))(react@18.3.1): + next@14.2.5(@babel/core@7.24.4)(@playwright/test@1.45.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@next/env': 14.2.5 '@swc/helpers': 0.5.5 @@ -26771,7 +27118,7 @@ snapshots: graceful-fs: 4.2.11 postcss: 8.4.31 react: 18.3.1 - react-dom: 18.2.0(react@18.3.1) + react-dom: 18.3.1(react@18.3.1) styled-jsx: 5.1.1(@babel/core@7.24.4)(react@18.3.1) optionalDependencies: '@next/swc-darwin-arm64': 14.2.5 @@ -26788,7 +27135,7 @@ snapshots: - '@babel/core' - babel-plugin-macros - next@14.2.5(@babel/core@7.24.4)(@playwright/test@1.45.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@14.2.5(@babel/core@7.24.7)(@playwright/test@1.45.1)(react-dom@18.2.0(react@18.3.1))(react@18.3.1): dependencies: '@next/env': 14.2.5 '@swc/helpers': 0.5.5 @@ -26797,8 +27144,8 @@ snapshots: graceful-fs: 4.2.11 postcss: 8.4.31 react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - styled-jsx: 5.1.1(@babel/core@7.24.4)(react@18.3.1) + react-dom: 18.2.0(react@18.3.1) + styled-jsx: 5.1.1(@babel/core@7.24.7)(react@18.3.1) optionalDependencies: '@next/swc-darwin-arm64': 14.2.5 '@next/swc-darwin-x64': 14.2.5 @@ -27231,7 +27578,7 @@ snapshots: p-limit@5.0.0: dependencies: - yocto-queue: 1.0.0 + yocto-queue: 1.1.1 p-locate@2.0.0: dependencies: @@ -27501,12 +27848,6 @@ snapshots: dependencies: find-up: 5.0.0 - pkg-types@1.0.3: - dependencies: - jsonc-parser: 3.2.0 - mlly: 1.5.0 - pathe: 1.1.2 - pkg-types@1.1.1: dependencies: confbox: 0.1.7 @@ -27703,13 +28044,13 @@ snapshots: postcss: 8.4.38 ts-node: 10.9.1(@types/node@16.18.34)(typescript@5.4.5) - postcss-load-config@4.0.1(postcss@8.4.38)(ts-node@10.9.1(@types/node@20.10.5)(typescript@5.2.2)): + postcss-load-config@4.0.1(postcss@8.4.38)(ts-node@10.9.1(@types/node@20.10.5)(typescript@5.4.5)): dependencies: lilconfig: 2.1.0 yaml: 2.3.1 optionalDependencies: postcss: 8.4.38 - ts-node: 10.9.1(@types/node@20.10.5)(typescript@5.2.2) + ts-node: 10.9.1(@types/node@20.10.5)(typescript@5.4.5) postcss-load-config@4.0.1(postcss@8.4.38)(ts-node@10.9.1(@types/node@20.11.13)(typescript@5.2.2)): dependencies: @@ -28346,6 +28687,16 @@ snapshots: transitivePeerDependencies: - csstype + react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.2.0(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1): + dependencies: + '@babel/runtime': 7.24.7 + html-parse-stringify: 3.0.1 + i18next: 22.5.1 + react: 18.3.1 + optionalDependencies: + react-dom: 18.2.0(react@18.3.1) + react-native: 0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4) + react-i18next@13.5.0(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.1(@babel/core@7.24.7)(@babel/preset-env@7.22.5(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@6.0.4))(react@18.3.1): dependencies: '@babel/runtime': 7.24.7 @@ -29756,7 +30107,7 @@ snapshots: transitivePeerDependencies: - ts-node - tailwindcss@3.4.4(ts-node@10.9.1(@types/node@20.10.5)(typescript@5.2.2)): + tailwindcss@3.4.4(ts-node@10.9.1(@types/node@20.10.5)(typescript@5.4.5)): dependencies: '@alloc/quick-lru': 5.2.0 arg: 5.0.2 @@ -29775,7 +30126,7 @@ snapshots: postcss: 8.4.38 postcss-import: 15.1.0(postcss@8.4.38) postcss-js: 4.0.1(postcss@8.4.38) - postcss-load-config: 4.0.1(postcss@8.4.38)(ts-node@10.9.1(@types/node@20.10.5)(typescript@5.2.2)) + postcss-load-config: 4.0.1(postcss@8.4.38)(ts-node@10.9.1(@types/node@20.10.5)(typescript@5.4.5)) postcss-nested: 6.0.1(postcss@8.4.38) postcss-selector-parser: 6.0.13 resolve: 1.22.8 @@ -29961,11 +30312,11 @@ snapshots: tiny-case@1.0.3: {} - tinybench@2.6.0: {} + tinybench@2.8.0: {} tinypool@0.8.4: {} - tinyspy@2.2.0: {} + tinyspy@2.2.1: {} title-case@3.0.3: dependencies: @@ -30096,7 +30447,7 @@ snapshots: yn: 3.1.1 optional: true - ts-node@10.9.1(@types/node@20.10.5)(typescript@5.2.2): + ts-node@10.9.1(@types/node@20.10.5)(typescript@5.4.5): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.9 @@ -30110,7 +30461,7 @@ snapshots: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.2.2 + typescript: 5.4.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 optional: true @@ -30349,8 +30700,6 @@ snapshots: uc.micro@2.1.0: {} - ufo@1.3.2: {} - ufo@1.5.3: {} uglify-js@3.17.4: @@ -30504,13 +30853,13 @@ snapshots: dependencies: browserslist: 4.22.1 escalade: 3.1.1 - picocolors: 1.0.0 + picocolors: 1.0.1 update-browserslist-db@1.0.13(browserslist@4.23.0): dependencies: browserslist: 4.23.0 escalade: 3.1.1 - picocolors: 1.0.0 + picocolors: 1.0.1 upper-case-first@2.0.2: dependencies: @@ -30647,6 +30996,23 @@ snapshots: - utf-8-validate - zod + viem@1.21.4(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4): + dependencies: + '@adraffy/ens-normalize': 1.10.0 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@scure/bip32': 1.3.2 + '@scure/bip39': 1.2.1 + abitype: 0.9.8(typescript@5.4.5)(zod@3.22.4) + isows: 1.0.3(ws@8.13.0(bufferutil@4.0.8)(utf-8-validate@6.0.4)) + ws: 8.13.0(bufferutil@4.0.8)(utf-8-validate@6.0.4) + optionalDependencies: + typescript: 5.4.5 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + viem@2.10.2(bufferutil@4.0.8)(typescript@5.2.2)(utf-8-validate@6.0.4)(zod@3.22.4): dependencies: '@adraffy/ens-normalize': 1.10.0 @@ -30664,12 +31030,29 @@ snapshots: - utf-8-validate - zod + viem@2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)(zod@3.22.4): + dependencies: + '@adraffy/ens-normalize': 1.10.0 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@scure/bip32': 1.3.2 + '@scure/bip39': 1.2.1 + abitype: 1.0.0(typescript@5.4.5)(zod@3.22.4) + isows: 1.0.3(ws@8.13.0(bufferutil@4.0.8)(utf-8-validate@6.0.4)) + ws: 8.13.0(bufferutil@4.0.8)(utf-8-validate@6.0.4) + optionalDependencies: + typescript: 5.4.5 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + vite-node@1.6.0(@types/node@18.15.3)(terser@5.18.2): dependencies: cac: 6.7.14 debug: 4.3.5(supports-color@5.5.0) pathe: 1.1.2 - picocolors: 1.0.0 + picocolors: 1.0.1 vite: 5.3.3(@types/node@18.15.3)(terser@5.18.2) transitivePeerDependencies: - '@types/node' @@ -30681,12 +31064,29 @@ snapshots: - supports-color - terser + vite-node@1.6.0(@types/node@20.10.5)(terser@5.18.2): + dependencies: + cac: 6.7.14 + debug: 4.3.5(supports-color@5.5.0) + pathe: 1.1.2 + picocolors: 1.0.1 + vite: 5.3.3(@types/node@20.10.5)(terser@5.18.2) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + vite-node@1.6.0(@types/node@20.11.13)(terser@5.18.2): dependencies: cac: 6.7.14 debug: 4.3.5(supports-color@5.5.0) pathe: 1.1.2 - picocolors: 1.0.0 + picocolors: 1.0.1 vite: 5.3.3(@types/node@20.11.13)(terser@5.18.2) transitivePeerDependencies: - '@types/node' @@ -30728,6 +31128,16 @@ snapshots: fsevents: 2.3.3 terser: 5.18.2 + vite@5.3.3(@types/node@20.10.5)(terser@5.18.2): + dependencies: + esbuild: 0.21.5 + postcss: 8.4.39 + rollup: 4.16.4 + optionalDependencies: + '@types/node': 20.10.5 + fsevents: 2.3.3 + terser: 5.18.2 + vite@5.3.3(@types/node@20.11.13)(terser@5.18.2): dependencies: esbuild: 0.21.5 @@ -30803,15 +31213,15 @@ snapshots: '@vitest/utils': 1.6.0 acorn-walk: 8.3.2 chai: 4.4.1 - debug: 4.3.4 + debug: 4.3.5(supports-color@5.5.0) execa: 8.0.1 local-pkg: 0.5.0 - magic-string: 0.30.5 + magic-string: 0.30.10 pathe: 1.1.2 - picocolors: 1.0.0 + picocolors: 1.0.1 std-env: 3.7.0 strip-literal: 2.1.0 - tinybench: 2.6.0 + tinybench: 2.8.0 tinypool: 0.8.4 vite: 5.3.3(@types/node@18.15.3)(terser@5.18.2) vite-node: 1.6.0(@types/node@18.15.3)(terser@5.18.2) @@ -30829,6 +31239,41 @@ snapshots: - supports-color - terser + vitest@1.6.0(@types/node@20.10.5)(@vitest/browser@1.6.0)(jsdom@16.7.0(bufferutil@4.0.8)(utf-8-validate@6.0.4))(terser@5.18.2): + dependencies: + '@vitest/expect': 1.6.0 + '@vitest/runner': 1.6.0 + '@vitest/snapshot': 1.6.0 + '@vitest/spy': 1.6.0 + '@vitest/utils': 1.6.0 + acorn-walk: 8.3.2 + chai: 4.4.1 + debug: 4.3.5(supports-color@5.5.0) + execa: 8.0.1 + local-pkg: 0.5.0 + magic-string: 0.30.10 + pathe: 1.1.2 + picocolors: 1.0.1 + std-env: 3.7.0 + strip-literal: 2.1.0 + tinybench: 2.8.0 + tinypool: 0.8.4 + vite: 5.3.3(@types/node@20.10.5)(terser@5.18.2) + vite-node: 1.6.0(@types/node@20.10.5)(terser@5.18.2) + why-is-node-running: 2.2.2 + optionalDependencies: + '@types/node': 20.10.5 + '@vitest/browser': 1.6.0(playwright@1.45.1)(vitest@1.6.0)(webdriverio@8.39.1(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.4)) + jsdom: 16.7.0(bufferutil@4.0.8)(utf-8-validate@6.0.4) + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + vitest@1.6.0(@types/node@20.11.13)(@vitest/browser@1.6.0)(jsdom@16.7.0(bufferutil@4.0.8)(utf-8-validate@6.0.4))(terser@5.18.2): dependencies: '@vitest/expect': 1.6.0 @@ -30838,15 +31283,15 @@ snapshots: '@vitest/utils': 1.6.0 acorn-walk: 8.3.2 chai: 4.4.1 - debug: 4.3.4 + debug: 4.3.5(supports-color@5.5.0) execa: 8.0.1 local-pkg: 0.5.0 - magic-string: 0.30.5 + magic-string: 0.30.10 pathe: 1.1.2 - picocolors: 1.0.0 + picocolors: 1.0.1 std-env: 3.7.0 strip-literal: 2.1.0 - tinybench: 2.6.0 + tinybench: 2.8.0 tinypool: 0.8.4 vite: 5.3.3(@types/node@20.11.13)(terser@5.18.2) vite-node: 1.6.0(@types/node@20.11.13)(terser@5.18.2) @@ -31479,7 +31924,7 @@ snapshots: yocto-queue@0.1.0: {} - yocto-queue@1.0.0: {} + yocto-queue@1.1.1: {} yup@1.4.0: dependencies: diff --git a/scripts/tests-find.sh b/scripts/tests-find.sh index fb83e6e31ed..b6a808a4162 100755 --- a/scripts/tests-find.sh +++ b/scripts/tests-find.sh @@ -2,16 +2,16 @@ ROOT=$(cd "$(dirname "$0")/.."; pwd) -FILES=$(find $ROOT/{apps,packages,internal} -name '*.test.ts') +FILES=$(find $ROOT/{apps,packages,internal,templates} -name '*.test.ts') if [[ $* == *--all* ]]; then - grep -lE "@group\s+(node|browser|e2e)" $FILES + grep -lE "\*\s+@group\s+(node|browser|e2e)" $FILES elif [[ $* == *--node* ]]; then - grep -lE "@group\s+node" $FILES + grep -lE "\*\s+@group\s+node" $FILES elif [[ $* == *--browser* ]]; then - grep -lE "@group\s+browser" $FILES + grep -lE "\*\s+@group\s+browser" $FILES elif [[ $* == *--e2e* ]]; then - grep -lE "@group\s+e2e" $FILES + grep -lE "\*\s+@group\s+e2e" $FILES elif [[ $* == *--integration* ]]; then - grep -lE "@group\s+integration" $FILES + grep -lE "\*\s+@group\s+integration" $FILES fi diff --git a/templates/nextjs/package.json b/templates/nextjs/package.json index e96de49aa80..b1623ee6946 100644 --- a/templates/nextjs/package.json +++ b/templates/nextjs/package.json @@ -8,7 +8,8 @@ "dev": "next dev", "build": "pnpm run xprebuild && next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "test": "vitest" }, "dependencies": { "@fuels/connectors": "^0.8.1", @@ -31,6 +32,7 @@ "eslint-config-next": "14.2.5", "postcss": "^8", "tailwindcss": "^3.4.4", - "typescript": "^5" + "typescript": "~5.4.5", + "vitest": "^1.6.0" } } diff --git a/templates/nextjs/test/contract.test.ts b/templates/nextjs/test/contract.test.ts new file mode 100644 index 00000000000..947ef4563dc --- /dev/null +++ b/templates/nextjs/test/contract.test.ts @@ -0,0 +1,62 @@ +import { launchTestNode } from 'fuels/test-utils'; + +import { describe, test, expect } from 'vitest'; + +/** + * Imports for the contract factory and bytecode, so that we can use them in the test. + * + * Can't find these imports? Make sure you've run `fuels build` to generate these with typegen. + */ +import { TestContractAbi__factory } from '../src/sway-api'; +import bytecode from '../src/sway-api/contracts/TestContractAbi.hex'; + +/** + * @group node + * @group browser + * + * Tests for the contract program type within the TS SDK. Here we will test the deployment of + * our contract, and the result of call it's functions. + */ +describe('Contract', () => { + test('Deploy and Call', async () => { + // First, we'll launch a test node, passing the contract factory and bytecode. This will deploy the contract + // to our test node so we can test against it. + using launched = await launchTestNode({ + // The test node will be killed automatically once the `launched` variable goes out of scope, + // because we are instantiating it with the `using` keyword. + contractsConfigs: [ + { + deployer: TestContractAbi__factory, + bytecode, + }, + ], + }); + + // We can now destructure the contract from the launched object. + const { + contracts: [contract], + } = launched; + + // Lets setup some values to use in the test. + const initialCount = 0; + const incrementedCount = 5; + + // We can now call the contract functions and test the results. Lets assert the initial value of the counter. + const { waitForResult: initWaitForResult } = await contract.functions.get_count().call(); + const { value: initValue } = await initWaitForResult(); + expect(initValue.toNumber()).toBe(initialCount); + + // Next, we'll increment the counter by 5 and assert the new value. + const { waitForResult: incrementWaitForResult } = await contract.functions + .increment_counter(incrementedCount) + .call(); + const { value: incrementValue } = await incrementWaitForResult(); + expect(incrementValue.toNumber()).toBe(incrementedCount); + + // Finally, we'll test the get count function again to ensure parity. + const { waitForResult: finalWaitForResult } = await contract.functions.get_count().call(); + const { value: finalValue } = await finalWaitForResult(); + expect(finalValue.toNumber()).toBe(incrementedCount); + expect(initValue.toNumber()).toBeLessThan(finalValue.toNumber()); + }); +}); diff --git a/templates/nextjs/test/predicate.test.ts b/templates/nextjs/test/predicate.test.ts new file mode 100644 index 00000000000..8550ebb049a --- /dev/null +++ b/templates/nextjs/test/predicate.test.ts @@ -0,0 +1,66 @@ +import { launchTestNode } from 'fuels/test-utils'; + +import { describe, test, expect } from 'vitest'; + +/** + * Import for the predicate factory and input data type, so that we can use them in the test. + * + * Can't find these imports? Make sure you've run `fuels build` to generate these with typegen. + */ +import { TestPredicateAbi__factory, TestPredicateAbiInputs } from '../src/sway-api'; + +/** + * @group node + * @group browser + * + * Tests for the predicate program type within the TS SDK. Here we will test the use of our predicate + * in a transaction. + */ +describe('Predicate', () => { + test('Transaction', async () => { + // First, we'll launch a test node to use for our predicate transaction. + using launched = await launchTestNode(); + // The test node will be killed automatically once the `launched` variable goes out of scope, + // because we are instantiating it with the `using` keyword. + + // We can now destructure the provider and the sender and receiver wallet from the launched object. + const { + wallets: [sender, receiver], + provider, + } = launched; + + // For a predicate, we need to pass in an argument to evaluate the predicate. + const predicateData: TestPredicateAbiInputs = [1337]; + + // Now, we can instantiate our predicate. + const predicate = TestPredicateAbi__factory.createInstance(provider, predicateData); + + // Lets also setup some transfer values to assert against. + const amountToPredicate = 250_000; + const amountToReceiver = 50_000; + + // Lets also get the initial balance of the receiver wallet to assert against. + const initialReceiverBalance = await receiver.getBalance(); + + // We can now transfer some assets to the predicate. + const setupTx = await sender.transfer(predicate.address, amountToPredicate); + await setupTx.waitForResult(); + + // And we'll assert it's value to confirm success of the transfer. + const predicateBalance = await predicate.getBalance(); + expect(predicateBalance.toNumber()).toBe(amountToPredicate); + + // Now we can transfer assets from the predicate to the receiver. + const tx = await predicate.transfer(receiver.address, amountToReceiver); + const { isStatusSuccess } = await tx.waitForResult(); + expect(isStatusSuccess).toBe(true); + + // Then get our receivers final balance. + const finalReceiverBalance = await receiver.getBalance(); + + // And lastly we'll assert all the values to confirm the success of the predicate transfer. + expect(finalReceiverBalance.toNumber()).toBe( + initialReceiverBalance.add(amountToReceiver).toNumber() + ); + }); +}); diff --git a/templates/nextjs/test/script.test.ts b/templates/nextjs/test/script.test.ts new file mode 100644 index 00000000000..0378b07d780 --- /dev/null +++ b/templates/nextjs/test/script.test.ts @@ -0,0 +1,42 @@ +import { launchTestNode } from 'fuels/test-utils'; + +import { describe, test, expect } from 'vitest'; + +/** + * Import for the script factory, so that we can use them in the test. + * + * Can't find these imports? Make sure you've run `fuels build` to generate these with typegen. + */ +import { TestScriptAbi__factory } from '../src/sway-api'; + +/** + * @group node + * @group browser + * + * Tests for the script program type within the TS SDK. Here we will test the use of our script + * function call. + */ +describe('Script', () => { + test('Call', async () => { + // First, we'll launch a test node to use for our script transaction. + using launched = await launchTestNode(); + // The test node will be killed automatically once the `launched` variable goes out of scope, + // because we are instantiating it with the `using` keyword. + + // We can now destructure the sender wallet from the launched object. + const { + wallets: [sender], + } = launched; + + // Now, we can instantiate our script. + const script = TestScriptAbi__factory.createInstance(sender); + + // Lets also setup a value to use in the test. + const expectedValue = 1337; + + // We can now call the script function and assert the result. + const { waitForResult } = await script.functions.main(expectedValue).call(); + const { value } = await waitForResult(); + expect(value.toNumber()).toBe(expectedValue); + }); +}); diff --git a/templates/nextjs/vitest.config.mts b/templates/nextjs/vitest.config.mts new file mode 100644 index 00000000000..a6ca0394a34 --- /dev/null +++ b/templates/nextjs/vitest.config.mts @@ -0,0 +1,5 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + esbuild: { target: "es2022" }, +});