diff --git a/.changeset/tame-cats-heal.md b/.changeset/tame-cats-heal.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/tame-cats-heal.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/apps/docs-snippets/src/guide/contracts/call-parameters.test.ts b/apps/docs-snippets/src/guide/contracts/call-parameters.test.ts index e8ba21812be..e042341c605 100644 --- a/apps/docs-snippets/src/guide/contracts/call-parameters.test.ts +++ b/apps/docs-snippets/src/guide/contracts/call-parameters.test.ts @@ -1,22 +1,14 @@ import type { Contract } from 'fuels'; -import { BN, NativeAssetId, ContractFactory } from 'fuels'; +import { BN, NativeAssetId } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.RETURN_CONTEXT - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.RETURN_CONTEXT); }); it('should successfully execute contract call with forwarded amount', async () => { diff --git a/apps/docs-snippets/src/guide/contracts/calls-with-different-wallets.test.ts b/apps/docs-snippets/src/guide/contracts/calls-with-different-wallets.test.ts index 914ff9d8281..68b9a6b7260 100644 --- a/apps/docs-snippets/src/guide/contracts/calls-with-different-wallets.test.ts +++ b/apps/docs-snippets/src/guide/contracts/calls-with-different-wallets.test.ts @@ -1,22 +1,14 @@ import type { Contract } from 'fuels'; -import { Provider, WalletUnlocked, ContractFactory } from 'fuels'; +import { Provider, WalletUnlocked } from 'fuels'; -import { SnippetProjectEnum, getSnippetProjectArtifacts } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let deployedContract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.RETURN_CONTEXT - ); - - const contractFactory = new ContractFactory(binHelixfied, abiContents, wallet); - - deployedContract = await contractFactory.deployContract(); + deployedContract = await createAndDeployContractFromProject(SnippetProjectEnum.RETURN_CONTEXT); }); it('should successfully update contract instace wallet', () => { diff --git a/apps/docs-snippets/src/guide/contracts/configurable-constants.test.ts b/apps/docs-snippets/src/guide/contracts/configurable-constants.test.ts index 09db0e57ade..dbfc7d3e17f 100644 --- a/apps/docs-snippets/src/guide/contracts/configurable-constants.test.ts +++ b/apps/docs-snippets/src/guide/contracts/configurable-constants.test.ts @@ -7,7 +7,7 @@ import { getTestWallet } from '../../utils'; describe(__filename, () => { let wallet: WalletUnlocked; - const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts( + const { abiContents: abi, binHexlified: bin } = getSnippetProjectArtifacts( SnippetProjectEnum.ECHO_CONFIGURABLES ); diff --git a/apps/docs-snippets/src/guide/contracts/contract-balance.test.ts b/apps/docs-snippets/src/guide/contracts/contract-balance.test.ts index 2a641ff3a14..02aa0f8f5f7 100644 --- a/apps/docs-snippets/src/guide/contracts/contract-balance.test.ts +++ b/apps/docs-snippets/src/guide/contracts/contract-balance.test.ts @@ -1,22 +1,14 @@ import type { Contract } from 'fuels'; -import { Wallet, BN, ContractFactory, NativeAssetId } from 'fuels'; +import { Wallet, BN, NativeAssetId } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.TRANSFER_TO_ADDRESS - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.TRANSFER_TO_ADDRESS); }); it('should successfully get a contract balance', async () => { diff --git a/apps/docs-snippets/src/guide/contracts/cost-estimation.test.ts b/apps/docs-snippets/src/guide/contracts/cost-estimation.test.ts index 175e9878470..6d658c99cad 100644 --- a/apps/docs-snippets/src/guide/contracts/cost-estimation.test.ts +++ b/apps/docs-snippets/src/guide/contracts/cost-estimation.test.ts @@ -1,22 +1,14 @@ import type { Contract } from 'fuels'; -import { ContractFactory, NativeAssetId } from 'fuels'; +import { NativeAssetId } from 'fuels'; -import { SnippetProjectEnum, getSnippetProjectArtifacts } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.RETURN_CONTEXT - ); - - const contractFactory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await contractFactory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.RETURN_CONTEXT); }); it('should successfully get transaction cost estimate for a single contract call', async () => { diff --git a/apps/docs-snippets/src/guide/contracts/index.test.ts b/apps/docs-snippets/src/guide/contracts/index.test.ts index 9777f2de242..96de99159a6 100644 --- a/apps/docs-snippets/src/guide/contracts/index.test.ts +++ b/apps/docs-snippets/src/guide/contracts/index.test.ts @@ -1,22 +1,13 @@ import type { Contract } from 'fuels'; -import { ContractFactory } from 'fuels'; -import { SnippetProjectEnum, getSnippetProjectArtifacts } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.ECHO_VALUES - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_VALUES); }); it('should successfully call contract and echo values', async () => { diff --git a/apps/docs-snippets/src/guide/contracts/inter-contract-calls.test.ts b/apps/docs-snippets/src/guide/contracts/inter-contract-calls.test.ts index 04b2ef80697..ec1b1d10710 100644 --- a/apps/docs-snippets/src/guide/contracts/inter-contract-calls.test.ts +++ b/apps/docs-snippets/src/guide/contracts/inter-contract-calls.test.ts @@ -17,13 +17,13 @@ describe(__filename, () => { const depositorArtifacts = getSnippetProjectArtifacts(SnippetProjectEnum.TOKEN_DEPOSITOR); simpleToken = await new ContractFactory( - tokenArtifacts.binHelixfied, + tokenArtifacts.binHexlified, tokenArtifacts.abiContents, wallet ).deployContract(); tokenDepositor = await new ContractFactory( - depositorArtifacts.binHelixfied, + depositorArtifacts.binHexlified, depositorArtifacts.abiContents, wallet ).deployContract(); diff --git a/apps/docs-snippets/src/guide/contracts/logs.test.ts b/apps/docs-snippets/src/guide/contracts/logs.test.ts index ff314af2047..1bee2a960b2 100644 --- a/apps/docs-snippets/src/guide/contracts/logs.test.ts +++ b/apps/docs-snippets/src/guide/contracts/logs.test.ts @@ -1,20 +1,14 @@ import type { Contract } from 'fuels'; -import { BN, ContractFactory } from 'fuels'; +import { BN } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts(SnippetProjectEnum.LOG_VALUES); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.LOG_VALUES); }); it('should successfully execute contract call with forwarded amount', async () => { diff --git a/apps/docs-snippets/src/guide/contracts/managing-deployed-contracts.test.ts b/apps/docs-snippets/src/guide/contracts/managing-deployed-contracts.test.ts index 8c236664b30..b90755cb4e0 100644 --- a/apps/docs-snippets/src/guide/contracts/managing-deployed-contracts.test.ts +++ b/apps/docs-snippets/src/guide/contracts/managing-deployed-contracts.test.ts @@ -8,7 +8,7 @@ describe(__filename, () => { let contract: Contract; let contractId: AbstractAddress; let wallet: WalletUnlocked; - const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts( + const { abiContents: abi, binHexlified: bin } = getSnippetProjectArtifacts( SnippetProjectEnum.ECHO_VALUES ); diff --git a/apps/docs-snippets/src/guide/contracts/multicalls.test.ts b/apps/docs-snippets/src/guide/contracts/multicalls.test.ts index 1eaad0ac821..d15396dc888 100644 --- a/apps/docs-snippets/src/guide/contracts/multicalls.test.ts +++ b/apps/docs-snippets/src/guide/contracts/multicalls.test.ts @@ -17,17 +17,17 @@ describe(__filename, () => { const contextArtifacts = getSnippetProjectArtifacts(SnippetProjectEnum.RETURN_CONTEXT); const factory1 = new ContractFactory( - echoArtifacts.binHelixfied, + echoArtifacts.binHexlified, echoArtifacts.abiContents, wallet ); const factory2 = new ContractFactory( - counterArtifacts.binHelixfied, + counterArtifacts.binHexlified, counterArtifacts.abiContents, wallet ); const factory3 = new ContractFactory( - contextArtifacts.binHelixfied, + contextArtifacts.binHexlified, contextArtifacts.abiContents, wallet ); diff --git a/apps/docs-snippets/src/guide/contracts/read-only-calls.test.ts b/apps/docs-snippets/src/guide/contracts/read-only-calls.test.ts index d97de0f5e3c..1ef6d4aa42b 100644 --- a/apps/docs-snippets/src/guide/contracts/read-only-calls.test.ts +++ b/apps/docs-snippets/src/guide/contracts/read-only-calls.test.ts @@ -1,22 +1,13 @@ import type { Contract } from 'fuels'; -import { ContractFactory } from 'fuels'; -import { SnippetProjectEnum, getSnippetProjectArtifacts } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.ECHO_VALUES - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_VALUES); }); it('should successfully execute a read only call', async () => { diff --git a/apps/docs-snippets/src/guide/contracts/transaction-parameters.test.ts b/apps/docs-snippets/src/guide/contracts/transaction-parameters.test.ts index 1cb0f8b3cd6..57b46349c85 100644 --- a/apps/docs-snippets/src/guide/contracts/transaction-parameters.test.ts +++ b/apps/docs-snippets/src/guide/contracts/transaction-parameters.test.ts @@ -1,20 +1,14 @@ import type { Contract } from 'fuels'; -import { BN, ContractFactory } from 'fuels'; +import { BN } from 'fuels'; -import { SnippetProjectEnum, getSnippetProjectArtifacts } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts(SnippetProjectEnum.COUNTER); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.COUNTER); }); it('should successfully execute contract call with txParams', async () => { diff --git a/apps/docs-snippets/src/guide/predicates/index.test.ts b/apps/docs-snippets/src/guide/predicates/index.test.ts index 09600959f2a..17f6d5aa5c4 100644 --- a/apps/docs-snippets/src/guide/predicates/index.test.ts +++ b/apps/docs-snippets/src/guide/predicates/index.test.ts @@ -3,7 +3,7 @@ import { FUEL_NETWORK_URL, Provider, Predicate } from 'fuels'; import { SnippetProjectEnum, getSnippetProjectArtifacts } from '../../../projects'; describe(__filename, () => { - const { abiContents: jsonAbi, binHelixfied: binary } = getSnippetProjectArtifacts( + const { abiContents: jsonAbi, binHexlified: binary } = getSnippetProjectArtifacts( SnippetProjectEnum.RETURN_TRUE_PREDICATE ); diff --git a/apps/docs-snippets/src/guide/predicates/predicate-with-configurable.test.ts b/apps/docs-snippets/src/guide/predicates/predicate-with-configurable.test.ts index 721ee6f0079..80b5253cc02 100644 --- a/apps/docs-snippets/src/guide/predicates/predicate-with-configurable.test.ts +++ b/apps/docs-snippets/src/guide/predicates/predicate-with-configurable.test.ts @@ -6,7 +6,7 @@ import { getTestWallet } from '../../utils'; describe(__filename, () => { let wallet: WalletUnlocked; - const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts( + const { abiContents: abi, binHexlified: bin } = getSnippetProjectArtifacts( SnippetProjectEnum.WHITELISTED_ADDRESS_PREDICATE ); diff --git a/apps/docs-snippets/src/guide/predicates/send-and-spend-funds-from-predicates.test.ts b/apps/docs-snippets/src/guide/predicates/send-and-spend-funds-from-predicates.test.ts index 681bae89873..28f85432954 100644 --- a/apps/docs-snippets/src/guide/predicates/send-and-spend-funds-from-predicates.test.ts +++ b/apps/docs-snippets/src/guide/predicates/send-and-spend-funds-from-predicates.test.ts @@ -7,7 +7,7 @@ import { getTestWallet } from '../../utils'; describe(__filename, () => { let walletWithFunds: WalletUnlocked; - const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts( + const { abiContents: abi, binHexlified: bin } = getSnippetProjectArtifacts( SnippetProjectEnum.SIMPLE_PREDICATE ); diff --git a/apps/docs-snippets/src/guide/scripts/script-custom-transaction.test.ts b/apps/docs-snippets/src/guide/scripts/script-custom-transaction.test.ts index 27c86a88f40..d86a20b03e0 100644 --- a/apps/docs-snippets/src/guide/scripts/script-custom-transaction.test.ts +++ b/apps/docs-snippets/src/guide/scripts/script-custom-transaction.test.ts @@ -17,11 +17,11 @@ describe(__filename, () => { const assetIdB = '0x0101010101010101010101010101010101010101010101010101010101010101'; const assetIdA = '0x0202020202020202020202020202020202020202020202020202020202020202'; - const { binHelixfied: scriptBin, abiContents } = getSnippetProjectArtifacts( + const { binHexlified: scriptBin, abiContents } = getSnippetProjectArtifacts( SnippetProjectEnum.SCRIPT_TRANSFER_TO_CONTRACT ); - const { abiContents: contractAbi, binHelixfied: contractBin } = getSnippetProjectArtifacts( + const { abiContents: contractAbi, binHexlified: contractBin } = getSnippetProjectArtifacts( SnippetProjectEnum.ECHO_VALUES ); diff --git a/apps/docs-snippets/src/guide/scripts/script-with-configurable.test.ts b/apps/docs-snippets/src/guide/scripts/script-with-configurable.test.ts index 27cace1a2af..5f9b652a67e 100644 --- a/apps/docs-snippets/src/guide/scripts/script-with-configurable.test.ts +++ b/apps/docs-snippets/src/guide/scripts/script-with-configurable.test.ts @@ -7,7 +7,7 @@ import { getTestWallet } from '../../utils'; describe(__filename, () => { let wallet: WalletUnlocked; - const { abiContents, binHelixfied } = getSnippetProjectArtifacts(SnippetProjectEnum.SUM_SCRIPT); + const { abiContents, binHexlified } = getSnippetProjectArtifacts(SnippetProjectEnum.SUM_SCRIPT); beforeAll(async () => { wallet = await getTestWallet(); @@ -15,7 +15,7 @@ describe(__filename, () => { it('should successfully sum setted configurable constant with inpputed value', async () => { // #region script-with-configurable-contants-2 - const script = new Script(binHelixfied, abiContents, wallet); + const script = new Script(binHexlified, abiContents, wallet); const configurableConstants = { AMOUNT: 81, diff --git a/apps/docs-snippets/src/guide/types/arrays.test.ts b/apps/docs-snippets/src/guide/types/arrays.test.ts index f43773feda6..72c07c1b95e 100644 --- a/apps/docs-snippets/src/guide/types/arrays.test.ts +++ b/apps/docs-snippets/src/guide/types/arrays.test.ts @@ -1,22 +1,14 @@ import type { Contract } from 'fuels'; -import { BN, ContractFactory } from 'fuels'; +import { BN } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.ECHO_U64_ARRAY - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_U64_ARRAY); }); it('should successfully demonstrate typed arrays examples', () => { diff --git a/apps/docs-snippets/src/guide/types/bits512.test.ts b/apps/docs-snippets/src/guide/types/bits512.test.ts index 176c9d5b36b..0bff2ad9a79 100644 --- a/apps/docs-snippets/src/guide/types/bits512.test.ts +++ b/apps/docs-snippets/src/guide/types/bits512.test.ts @@ -1,22 +1,14 @@ import type { Contract } from 'fuels'; -import { ContractFactory, Wallet } from 'fuels'; +import { Wallet } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.ECHO_VALUES - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_VALUES); }); it('should successfully call contract function and validate b512', async () => { diff --git a/apps/docs-snippets/src/guide/types/enums.test.ts b/apps/docs-snippets/src/guide/types/enums.test.ts index 168210859d9..52bdb069351 100644 --- a/apps/docs-snippets/src/guide/types/enums.test.ts +++ b/apps/docs-snippets/src/guide/types/enums.test.ts @@ -1,22 +1,13 @@ import type { Contract } from 'fuels'; -import { ContractFactory } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; - + beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents: abi, binHelixfied: bin } = getSnippetProjectArtifacts( - SnippetProjectEnum.ECHO_ENUM - ); - - const factory = new ContractFactory(bin, abi, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_ENUM); }); it('should successfully echo a simple enum in a contract call', async () => { diff --git a/apps/docs-snippets/src/guide/types/options.test.ts b/apps/docs-snippets/src/guide/types/options.test.ts index 1bbaa20b3bd..3b18b20324e 100644 --- a/apps/docs-snippets/src/guide/types/options.test.ts +++ b/apps/docs-snippets/src/guide/types/options.test.ts @@ -1,22 +1,13 @@ import type { Contract } from 'fuels'; -import { ContractFactory } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.SUM_OPTION_U8 - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.SUM_OPTION_U8); }); it('should successfully execute contract call to sum 2 option inputs (2 INPUTS)', async () => { diff --git a/apps/docs-snippets/src/guide/types/string.test.ts b/apps/docs-snippets/src/guide/types/string.test.ts index b6d3d1c714e..113d5193290 100644 --- a/apps/docs-snippets/src/guide/types/string.test.ts +++ b/apps/docs-snippets/src/guide/types/string.test.ts @@ -1,22 +1,13 @@ import type { Contract } from 'fuels'; -import { ContractFactory } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.ECHO_VALUES - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_VALUES); }); it('should validate string', () => { diff --git a/apps/docs-snippets/src/guide/types/tuples.test.ts b/apps/docs-snippets/src/guide/types/tuples.test.ts index eab905754db..39a40a1accb 100644 --- a/apps/docs-snippets/src/guide/types/tuples.test.ts +++ b/apps/docs-snippets/src/guide/types/tuples.test.ts @@ -1,22 +1,14 @@ import type { Contract } from 'fuels'; -import { BN, ContractFactory } from 'fuels'; +import { BN } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( - SnippetProjectEnum.ECHO_VALUES - ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); + contract = await createAndDeployContractFromProject(SnippetProjectEnum.ECHO_VALUES); }); it('should successfully echo tuple in a contract call', async () => { diff --git a/apps/docs-snippets/src/guide/types/vector.test.ts b/apps/docs-snippets/src/guide/types/vector.test.ts index cf458ef389b..eef85d909ee 100644 --- a/apps/docs-snippets/src/guide/types/vector.test.ts +++ b/apps/docs-snippets/src/guide/types/vector.test.ts @@ -1,22 +1,16 @@ import type { Contract } from 'fuels'; -import { BN, getRandomB256, ContractFactory } from 'fuels'; +import { BN, getRandomB256 } from 'fuels'; -import { getSnippetProjectArtifacts, SnippetProjectEnum } from '../../../projects'; -import { getTestWallet } from '../../utils'; +import { SnippetProjectEnum } from '../../../projects'; +import { createAndDeployContractFromProject } from '../../utils'; describe(__filename, () => { let contract: Contract; beforeAll(async () => { - const wallet = await getTestWallet(); - - const { abiContents, binHelixfied } = getSnippetProjectArtifacts( + contract = await createAndDeployContractFromProject( SnippetProjectEnum.ECHO_EMPLOYEE_DATA_VECTOR ); - - const factory = new ContractFactory(binHelixfied, abiContents, wallet); - - contract = await factory.deployContract(); }); it('should successfully execute and validate contract call', async () => { diff --git a/apps/docs-snippets/src/guide/wallets/transferring-assets.test.ts b/apps/docs-snippets/src/guide/wallets/transferring-assets.test.ts index e6df4420536..3c2a1af980d 100644 --- a/apps/docs-snippets/src/guide/wallets/transferring-assets.test.ts +++ b/apps/docs-snippets/src/guide/wallets/transferring-assets.test.ts @@ -11,9 +11,9 @@ describe(__filename, () => { beforeAll(async () => { senderWallet = await getTestWallet(); - const { abiContents, binHelixfied } = getSnippetProjectArtifacts(SnippetProjectEnum.COUNTER); + const { abiContents, binHexlified } = getSnippetProjectArtifacts(SnippetProjectEnum.COUNTER); - const factory = new ContractFactory(binHelixfied, abiContents, senderWallet); + const factory = new ContractFactory(binHexlified, abiContents, senderWallet); deployedContract = await factory.deployContract(); }); diff --git a/apps/docs-snippets/src/utils.ts b/apps/docs-snippets/src/utils.ts index eba0a4f33d9..d49864ed83c 100644 --- a/apps/docs-snippets/src/utils.ts +++ b/apps/docs-snippets/src/utils.ts @@ -62,9 +62,9 @@ export const createAndDeployContractFromProject = async ( project: SnippetProjectEnum ): Promise => { const wallet = await getTestWallet(); - const { abiContents, binHelixfied } = getSnippetProjectArtifacts(project); + const { abiContents, binHexlified } = getSnippetProjectArtifacts(project); - const contractFactory = new ContractFactory(binHelixfied, abiContents, wallet); + const contractFactory = new ContractFactory(binHexlified, abiContents, wallet); return contractFactory.deployContract(); }; diff --git a/packages/utils/src/test-utils/getForcProject.test.ts b/packages/utils/src/test-utils/getForcProject.test.ts index 823f40b8aff..963b2dbbaed 100644 --- a/packages/utils/src/test-utils/getForcProject.test.ts +++ b/packages/utils/src/test-utils/getForcProject.test.ts @@ -30,7 +30,7 @@ describe('getForcProject.js', () => { expect(project.abiContents).toBeTruthy(); expect(project.binPath).toEqual(binPath); - expect(project.binHelixfied).toEqual( + expect(project.binHexlified).toEqual( '0x900000044700000000000000000000345dfcc00110fff3005d4060495d47f000134904407348000c72f0007b36f0000024040000000000002151bd4b' ); diff --git a/packages/utils/src/test-utils/getForcProject.ts b/packages/utils/src/test-utils/getForcProject.ts index 4ca319ee91f..9f4e69b910b 100644 --- a/packages/utils/src/test-utils/getForcProject.ts +++ b/packages/utils/src/test-utils/getForcProject.ts @@ -43,7 +43,7 @@ export const getForcProject = (projectDir: string) => { const debugDir = getProjectDebugDir(params); const tempDir = getProjectTempDir(params); const binPath = getProjectBinPath(params); - const binHelixfied = hexlify(readFileSync(binPath)); + const binHexlified = hexlify(readFileSync(binPath)); const abiPath = getProjectAbiPath(params); const abiName = getProjectAbiName(params); const abiContents: T = getProjectAbi(params); @@ -57,7 +57,7 @@ export const getForcProject = (projectDir: string) => { debugDir, tempDir, binPath, - binHelixfied, + binHexlified, abiPath, abiName, abiContents,