Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: upgrade fuel-core to 0.23.0 #1764

Closed
wants to merge 184 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
fef0819
getting fuel-core from master branch
Torres-ssf Feb 15, 2024
87a3fc9
generate new version of graphql fuel-core-schema
Torres-ssf Feb 15, 2024
e507573
ajusting new dryRun operation
Torres-ssf Feb 15, 2024
333ab70
remove receipts from tranction fragment
Torres-ssf Feb 15, 2024
9afd442
skipping version test case
Torres-ssf Feb 15, 2024
6abedc1
made mininal change on dryun to make build works
Torres-ssf Feb 15, 2024
adbcf39
remove peers from node info as it is an advanced feature now
Torres-ssf Feb 15, 2024
0097951
skip fuel core error throw
Torres-ssf Feb 15, 2024
ca32705
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Feb 15, 2024
22ed3e3
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Feb 16, 2024
f8eb39f
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Feb 20, 2024
e526b24
update fuel core schema with last changes
Torres-ssf Feb 20, 2024
61344cf
update graphql operations
Torres-ssf Feb 20, 2024
38c417c
conform with receipts type changes
Torres-ssf Feb 20, 2024
78335df
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Feb 20, 2024
3eb5c3d
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Feb 22, 2024
fa9e2b6
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Feb 27, 2024
a5307ee
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Feb 28, 2024
5da0540
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Feb 29, 2024
f2abe99
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Mar 4, 2024
c2bb30e
handle graphql schema update
Torres-ssf Mar 4, 2024
a526b90
update operations to conform with new graphql schema
Torres-ssf Mar 4, 2024
45d4252
ajusting some fixtures
Torres-ssf Mar 4, 2024
2fcaad3
update graphql fuel core schema with vm-0.47.1 related changes
Torres-ssf Mar 4, 2024
d6f0e54
remove gasPrice from transactionFragment
Torres-ssf Mar 4, 2024
857b435
remove maturity from CoinFragment
Torres-ssf Mar 4, 2024
2ac854a
conform with removel o maturity from Coin type
Torres-ssf Mar 4, 2024
3ad8374
update PolicyGasPrice to PolicyTip
Torres-ssf Mar 4, 2024
7844e42
remove gas price related logic from Provider class
Torres-ssf Mar 4, 2024
92f3fa9
remove gas price related logic from Account class
Torres-ssf Mar 4, 2024
e708e49
remove gas price related logic from BaseInvocationScope class
Torres-ssf Mar 4, 2024
0dc8842
remove gas price related logic from BaseTransactionRequest class
Torres-ssf Mar 4, 2024
084a9be
remove gas price related logic from ContractFactory class
Torres-ssf Mar 4, 2024
da93835
remove remaing gas price entries from the code base
Torres-ssf Mar 4, 2024
f536d5a
temp using 0 for gas price when estimating gas used
Torres-ssf Mar 4, 2024
d8af023
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Mar 5, 2024
eca1504
update graphql fuel-core schema again
Torres-ssf Mar 5, 2024
21f1217
remove maturity from Coin input type
Torres-ssf Mar 6, 2024
d6c2dbe
using fuel core released version 0.23.0
Torres-ssf Mar 6, 2024
2ddead9
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Mar 6, 2024
bc3064a
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Mar 6, 2024
fbc1d2c
remove remaining gas price entries
Torres-ssf Mar 6, 2024
d237faa
remove maturity from INPUT_COIN_FIXED_SIZE
Torres-ssf Mar 6, 2024
7b6798a
set max fee on getTestWallet
Torres-ssf Mar 6, 2024
86c667b
override base asset quantitity on fundWithFakeUtxos
Torres-ssf Mar 6, 2024
5293a3f
using proper max fee when deploying contract
Torres-ssf Mar 6, 2024
ccb706e
update stream data response parsing
Torres-ssf Mar 6, 2024
9d0b776
add v1 to URL paths
Torres-ssf Mar 6, 2024
e53c451
setting dummy maxFee on BaseInvocationScope
Torres-ssf Mar 6, 2024
da9a1e0
setting dummy maxFee on ContractFactory
Torres-ssf Mar 6, 2024
eed3dcb
setting dummy maxFee on Account methods
Torres-ssf Mar 6, 2024
50dfa09
removing remaining maturity entries on InputCoin objects
Torres-ssf Mar 8, 2024
72b52ef
add v1 to graphql URL
Torres-ssf Mar 8, 2024
8a9eb13
refact gasUsedByInputs to improve readability
Torres-ssf Mar 8, 2024
abea1c6
implement calculateGasFee helper
Torres-ssf Mar 8, 2024
b5056a7
update estimation flow on getTransactionCost
Torres-ssf Mar 8, 2024
2663e19
fund tx in the proper way on deployContract
Torres-ssf Mar 8, 2024
5ff24f3
fund tx in the proper way on Account methods
Torres-ssf Mar 8, 2024
dc85856
fund tx in the proper way on BaseInvocationScope
Torres-ssf Mar 8, 2024
c8ebbc6
ajusting calculateTransactionFee
Torres-ssf Mar 8, 2024
821f066
set maxFee on seedTestWallet
Torres-ssf Mar 8, 2024
93cac29
ajusting test case
Torres-ssf Mar 8, 2024
277ead0
fix call for calculateTransactionFee
Torres-ssf Mar 8, 2024
d4078ff
ajusting some tests
Torres-ssf Mar 8, 2024
7b7ab4a
remove remaining gas price entries
Torres-ssf Mar 8, 2024
2010c98
fix extimate gas flow on test utility fundPredicate
Torres-ssf Mar 8, 2024
be078f0
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Mar 8, 2024
3ab3cbb
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Mar 25, 2024
5ad7472
Upgrading `forc` to `0.51.1`
arboleya Mar 28, 2024
c7a87ef
Merge branch 'master' into aa/chore/upgrading-forc-0.51.1
arboleya Mar 28, 2024
8c84082
Merge branch 'master' into aa/chore/upgrading-forc-0.51.1
petertonysmith94 Mar 29, 2024
ccc1505
setting gasLimit as gasUsed on baseInvocationScope
Torres-ssf Mar 29, 2024
dd29917
simplifying some test cases
Torres-ssf Mar 29, 2024
9763b19
make test case use proper tx assemble flow
Torres-ssf Mar 29, 2024
968f671
ajusting test fixture
Torres-ssf Mar 29, 2024
aea8fd2
make test case proper fund TX
Torres-ssf Mar 29, 2024
57138c0
ajust test
Torres-ssf Mar 29, 2024
f30fa49
made test util proper fund TX
Torres-ssf Mar 29, 2024
15b8928
fixing funding at test case
Torres-ssf Mar 29, 2024
9c1acb3
fixing funding at test case
Torres-ssf Mar 29, 2024
dd4b9e1
implement query for getLatestGasPrice
Torres-ssf Mar 29, 2024
172301b
getting lastest gas price on getTransactionCost
Torres-ssf Mar 29, 2024
8c422c9
fix build:schema script on Account package.json
Torres-ssf Mar 29, 2024
3a83ac8
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Mar 29, 2024
4f5bed1
upgrade forc to 0.51.1
Torres-ssf Mar 29, 2024
b75b679
implement estimateTxGasAndFee on provider class
Torres-ssf Mar 29, 2024
3dca3ba
update maxFee when tx request is modified at extimateTxDependencies
Torres-ssf Mar 29, 2024
70d4351
fix maxFess calculation at test fixture
Torres-ssf Mar 29, 2024
7705027
temporarily fix if statement
Torres-ssf Mar 29, 2024
5bfa712
fix test fixtures assertions
Torres-ssf Mar 29, 2024
7b8ed3a
properly funding predicate on test case
Torres-ssf Mar 29, 2024
e833f0d
add TODO to test case
Torres-ssf Mar 29, 2024
16172ec
fix predicate test case
Torres-ssf Mar 29, 2024
5cf2b6e
update assert to new graphql url
Torres-ssf Mar 29, 2024
e6d0a00
fix predicate test case
Torres-ssf Mar 29, 2024
e2dcc70
forcing predicate TX to fail
Torres-ssf Mar 29, 2024
3bed048
properly funding TXs
Torres-ssf Mar 29, 2024
e07dd4e
fix test assertion
Torres-ssf Mar 29, 2024
7d6db7d
refact estimateTxGasAndFee
Torres-ssf Mar 29, 2024
dbff061
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Mar 29, 2024
a8a48f6
Merge branch 'aa/chore/upgrading-forc-0.51.1' into st/chore/update-dr…
Torres-ssf Mar 29, 2024
e2af5bd
skiping testnet tests
Torres-ssf Mar 29, 2024
9671eba
fix test funding
Torres-ssf Mar 29, 2024
50b5aa8
using smaller funding amounts on predicate tests
Torres-ssf Mar 29, 2024
3277f87
uncomment client version validation
Torres-ssf Mar 29, 2024
731dbf1
make linter happy
Torres-ssf Mar 29, 2024
bfbc133
ajusting tests
Torres-ssf Mar 29, 2024
2d7086a
fixing receipts assembling
Torres-ssf Mar 29, 2024
deb6d47
fix receipts tests
Torres-ssf Mar 29, 2024
f80b9de
refact estimateTxGasAndFee
Torres-ssf Mar 31, 2024
eeb5b13
avoid letting maxGas exceeds maxGasPerTx
Torres-ssf Apr 1, 2024
4426407
refact estimateTxGasAndFee
Torres-ssf Apr 1, 2024
c3865c8
set minGasPrice to 1 at launch node
Torres-ssf Apr 1, 2024
09efbd6
ajusting test cases
Torres-ssf Apr 1, 2024
c096072
ajusting more tests
Torres-ssf Apr 1, 2024
5793321
try to fix predicate test
Torres-ssf Apr 1, 2024
335c7a9
refact policies test suite
Torres-ssf Apr 1, 2024
350e225
refact fundWithRequiredCoins at BaseInvocationScope
Torres-ssf Apr 1, 2024
76cb9a5
refact test file
Torres-ssf Apr 1, 2024
75df2b3
ajusting provider test suite
Torres-ssf Apr 1, 2024
e082e23
ajusting test
Torres-ssf Apr 1, 2024
ef5af63
fix amount on predicate test
Torres-ssf Apr 1, 2024
a60b93a
refact logic on gasUsedByInputs
Torres-ssf Apr 1, 2024
61e2f38
fix estimateTxGasAndFee method
Torres-ssf Apr 1, 2024
96bf59a
re-estimate gas and fee after funding the tx
Torres-ssf Apr 1, 2024
19ba952
setting predicateDataBytes when predicate is instantiated
Torres-ssf Apr 1, 2024
a168a52
implement getResourcesToSpend on Predicate class
Torres-ssf Apr 1, 2024
1fd05e4
refact addCoinInput
Torres-ssf Apr 1, 2024
b1271d3
using 66 bytes for UTXOs ids
Torres-ssf Apr 1, 2024
19b02be
create dryRunTransactionStatusFragment fragment
Torres-ssf Apr 1, 2024
9158681
change return type for fund method at AbstractAccount
Torres-ssf Apr 1, 2024
e430f11
linting
Torres-ssf Apr 1, 2024
8cd355b
fix test funding flow
Torres-ssf Apr 1, 2024
315ba79
fix test
Torres-ssf Apr 1, 2024
abd68eb
rename updatePredicateInputs to updatePredicateGasUsed
Torres-ssf Apr 2, 2024
04e071e
conform with last changes
Torres-ssf Apr 2, 2024
aa0985f
add predicate and predicate data to Resources and Tx Inputs
Torres-ssf Apr 2, 2024
9f5dc69
made Predicate getResourcesToSpend to add predicate fields to resources
Torres-ssf Apr 2, 2024
eaacdf9
improve shiftPredicateData on TransactionRequest class
Torres-ssf Apr 2, 2024
58afefd
shifting predicates on fund method
Torres-ssf Apr 2, 2024
1d8b064
update test case
Torres-ssf Apr 2, 2024
47f1c89
add flag optimizeGas to TxParams
Torres-ssf Apr 2, 2024
e1778a3
update test case
Torres-ssf Apr 2, 2024
dfaf343
remove .skip from some tests
Torres-ssf Apr 2, 2024
6998987
fix estimation for txs that carry signed witnesses
Torres-ssf Apr 2, 2024
61a276f
update account fund method
Torres-ssf Apr 2, 2024
a1026c5
not estimate dependencies by default a unlocked wallet
Torres-ssf Apr 2, 2024
977a56b
made addEmptyWitness public
Torres-ssf Apr 2, 2024
30038b2
fix test
Torres-ssf Apr 2, 2024
a0c4c34
refact code
Torres-ssf Apr 2, 2024
146e57b
lint
Torres-ssf Apr 2, 2024
87bb441
slim down propeties returned from getTransactionCost
Torres-ssf Apr 2, 2024
3daca28
remove unused helper calculatePriceWithFactor
Torres-ssf Apr 2, 2024
8c194e6
implement method getLatestGasPrice
Torres-ssf Apr 2, 2024
b9c920e
add query for estimateGasPrice
Torres-ssf Apr 2, 2024
611384e
implement method estimateGasPrice
Torres-ssf Apr 2, 2024
8cf0892
use populateAllPredicatesData in favor of shiftPredicateData
Torres-ssf Apr 2, 2024
528b56d
Revert "use populateAllPredicatesData in favor of shiftPredicateData"
Torres-ssf Apr 2, 2024
2113294
avoid re-estimating gas
Torres-ssf Apr 2, 2024
bcaa241
make lint happy
Torres-ssf Apr 3, 2024
137271f
add changeset
Torres-ssf Apr 3, 2024
93d126a
remove addPredicateResources method
Torres-ssf Apr 3, 2024
e328b50
ajusting dryRun response type
Torres-ssf Apr 3, 2024
c885991
implement estimateMultipleTxDependencies
Torres-ssf Apr 3, 2024
b66dc66
implement dryRunMultipleTransactions
Torres-ssf Apr 3, 2024
12b907e
add test suite
Torres-ssf Apr 3, 2024
03035ef
update predicate fund value
Torres-ssf Apr 3, 2024
0851940
refact params from account fund method
Torres-ssf Apr 3, 2024
5f9b253
implement cacheTxInputsFromOwner
Torres-ssf Apr 3, 2024
be73a49
using cacheTxInputsFromOwner on account fund
Torres-ssf Apr 3, 2024
11b8955
consider assets from other owners when funding
Torres-ssf Apr 3, 2024
406000e
rename helper
Torres-ssf Apr 3, 2024
499d78b
remove uneeded props on get transaction summary
Torres-ssf Apr 3, 2024
8b1c064
remove TODOs
Torres-ssf Apr 3, 2024
0aa0c74
remove unused param
Torres-ssf Apr 3, 2024
d6110d8
refact getTransactionCost params
Torres-ssf Apr 3, 2024
5bb13e0
rename params
Torres-ssf Apr 3, 2024
424510c
linting
Torres-ssf Apr 3, 2024
88bfe14
use different predicate on test
Torres-ssf Apr 4, 2024
6de5b00
Merge branch 'master' into st/chore/update-dry-run-mutation
Torres-ssf Apr 4, 2024
067e662
remove gas price from params
Torres-ssf Apr 4, 2024
b2481f1
add externalContractsAbis to contractCall type
Torres-ssf Apr 4, 2024
5768982
fix test
Torres-ssf Apr 4, 2024
c4144c3
fix changeset name
Torres-ssf Apr 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/kind-maps-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@fuel-ts/abi-coder": minor
"@fuel-ts/abi-typegen": minor
"@fuel-ts/account": minor
"@fuel-ts/contract": minor
"@fuel-ts/forc": minor
"@fuel-ts/fuel-core": minor
"fuels": minor
"@fuel-ts/interfaces": minor
"@fuel-ts/program": minor
"@fuel-ts/script": minor
"@fuel-ts/transactions": minor
"@fuel-ts/versions": minor
---

chore!: upgrade `fuel-core` to `0.23.0`
7 changes: 7 additions & 0 deletions .changeset/tidy-olives-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@fuel-ts/abi-typegen": patch
"@fuel-ts/forc": patch
"@fuel-ts/versions": patch
---

chore: upgrading `forc` to `0.51.1`
9 changes: 3 additions & 6 deletions apps/demo-fuels/fuels.config.full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export default createConfig({
// #endregion privateKey

// #region providerUrl
// Default: http://127.0.0.1:4000/graphql
providerUrl: 'http://network:port/graphql',
// Default: http://127.0.0.1:4000/v1/graphql
providerUrl: 'http://network:port/v1/graphql',
// #endregion providerUrl

// #region chainConfig
Expand Down Expand Up @@ -70,7 +70,6 @@ export default createConfig({
}

return {
gasPrice: 1,
storageSlots: [
{
key: '0x..',
Expand Down Expand Up @@ -112,8 +111,6 @@ export const simpleDeployConfig = createConfig({
workspace: './sway-programs',
output: './src/sway-programs-api',
// #region deployConfig-obj
deployConfig: {
gasPrice: 1,
},
deployConfig: {},
// #endregion deployConfig-obj
});
18 changes: 5 additions & 13 deletions apps/demo-fuels/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,22 @@

import { generateTestWallet } from '@fuel-ts/account/test-utils';
import { safeExec } from '@fuel-ts/errors/test-utils';
import type { BN } from 'fuels';
import { ContractFactory, Provider, toHex, BaseAssetId, Wallet, FUEL_NETWORK_URL } from 'fuels';

import { SampleAbi__factory } from './sway-programs-api';
import bytecode from './sway-programs-api/contracts/SampleAbi.hex';

let gasPrice: BN;

/**
* @group node
*/
describe('ExampleContract', () => {
beforeAll(async () => {
const provider = await Provider.create(FUEL_NETWORK_URL);
({ minGasPrice: gasPrice } = provider.getGasConfig());
});

it('should return the input', async () => {
const provider = await Provider.create(FUEL_NETWORK_URL);
const wallet = await generateTestWallet(provider, [[500_000, BaseAssetId]]);

// Deploy
const factory = new ContractFactory(bytecode, SampleAbi__factory.abi, wallet);
const contract = await factory.deployContract({ gasPrice });
const contract = await factory.deployContract();

// Call
const { value } = await contract.functions.return_input(1337).call();
Expand All @@ -49,7 +41,7 @@ describe('ExampleContract', () => {
const wallet = await generateTestWallet(provider, [[500_000, BaseAssetId]]);

// Deploy
const contract = await SampleAbi__factory.deployContract(bytecode, wallet, { gasPrice });
const contract = await SampleAbi__factory.deployContract(bytecode, wallet);

// Call
const { value } = await contract.functions.return_input(1337).call();
Expand All @@ -64,7 +56,7 @@ describe('ExampleContract', () => {
const unfundedWallet = Wallet.generate({ provider });

const factory = new ContractFactory(bytecode, SampleAbi__factory.abi, fundedWallet);
const contract = await factory.deployContract({ gasPrice });
const contract = await factory.deployContract();
const contractInstance = SampleAbi__factory.connect(contract.id, unfundedWallet);

const { error } = await safeExec(() =>
Expand All @@ -80,7 +72,7 @@ describe('ExampleContract', () => {
const unfundedWallet = Wallet.generate({ provider });

const factory = new ContractFactory(bytecode, SampleAbi__factory.abi, fundedWallet);
const contract = await factory.deployContract({ gasPrice });
const contract = await factory.deployContract();
const contractInstance = SampleAbi__factory.connect(contract.id, unfundedWallet);

await expect(contractInstance.functions.return_input(1337).dryRun()).resolves.not.toThrow();
Expand All @@ -89,7 +81,7 @@ describe('ExampleContract', () => {
it('should demo how to use generated files just fine', async () => {
const provider = await Provider.create(FUEL_NETWORK_URL);
const wallet = await generateTestWallet(provider, [[500_000, BaseAssetId]]);
const depoloyed = await SampleAbi__factory.deployContract(bytecode, wallet, { gasPrice });
const depoloyed = await SampleAbi__factory.deployContract(bytecode, wallet);
const contractsIds = {
sample: depoloyed.id,
};
Expand Down
21 changes: 5 additions & 16 deletions apps/demo-typegen/src/demo.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// #region Testing-in-ts-ts
import { generateTestWallet } from '@fuel-ts/account/test-utils';
import { safeExec } from '@fuel-ts/errors/test-utils';
import type { BN } from 'fuels';
import {
ContractFactory,
Provider,
Expand All @@ -20,16 +19,10 @@ import type { PredicateAbiInputs } from './predicate-types';
import { PredicateAbi__factory } from './predicate-types';
import { ScriptAbi__factory } from './script-types';

let gasPrice: BN;

/**
* @group node
*/
describe('ExampleContract', () => {
beforeAll(async () => {
const provider = await Provider.create(FUEL_NETWORK_URL);
({ minGasPrice: gasPrice } = provider.getGasConfig());
});
it('with imported storage slots', async () => {
const provider = await Provider.create(FUEL_NETWORK_URL);
const wallet = await generateTestWallet(provider, [[500_000, BaseAssetId]]);
Expand All @@ -39,7 +32,6 @@ describe('ExampleContract', () => {

const contract = await DemoContractAbi__factory.deployContract(bytecode, wallet, {
storageSlots,
gasPrice,
});
// #endregion typegen-demo-contract-storage-slots

Expand All @@ -51,7 +43,7 @@ describe('ExampleContract', () => {

// Deploy
const factory = new ContractFactory(bytecode, DemoContractAbi__factory.abi, wallet);
const contract = await factory.deployContract({ gasPrice });
const contract = await factory.deployContract();
const contractId = contract.id;

// Call
Expand Down Expand Up @@ -79,7 +71,7 @@ describe('ExampleContract', () => {
// #context import bytecode from './types/DemoContractAbi.hex';

// Deploy
const contract = await DemoContractAbi__factory.deployContract(bytecode, wallet, { gasPrice });
const contract = await DemoContractAbi__factory.deployContract(bytecode, wallet);
// #endregion typegen-demo-contract-factory-deploy

// Call
Expand All @@ -97,7 +89,7 @@ it('should throw when simulating via contract factory with wallet with no resour
const unfundedWallet = Wallet.generate({ provider });

const factory = new ContractFactory(bytecode, DemoContractAbi__factory.abi, fundedWallet);
const contract = await factory.deployContract({ gasPrice });
const contract = await factory.deployContract();
const contractInstance = DemoContractAbi__factory.connect(contract.id, unfundedWallet);

const { error } = await safeExec(() => contractInstance.functions.return_input(1337).simulate());
Expand All @@ -111,7 +103,7 @@ it('should not throw when dry running via contract factory with wallet with no r
const unfundedWallet = Wallet.generate({ provider });

const factory = new ContractFactory(bytecode, DemoContractAbi__factory.abi, fundedWallet);
const contract = await factory.deployContract({ gasPrice });
const contract = await factory.deployContract();
const contractInstance = DemoContractAbi__factory.connect(contract.id, unfundedWallet);

await expect(contractInstance.functions.return_input(1337).dryRun()).resolves.not.toThrow();
Expand Down Expand Up @@ -150,10 +142,7 @@ test('Example predicate', async () => {
const initialPredicateBalance = await predicate.getBalance();

// Then we are transferring some coins from the predicate to a random address (receiver)
const tx2 = await predicate.transfer(receiver.address, 50_000, BaseAssetId, {
gasPrice: provider.getGasConfig().minGasPrice,
gasLimit: 50,
});
const tx2 = await predicate.transfer(receiver.address, 50_000, BaseAssetId);
await tx2.wait();

expect((await receiver.getBalance()).toNumber()).toEqual(50_000);
Expand Down
14 changes: 2 additions & 12 deletions apps/docs-snippets/src/guide/contracts/call-parameters.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Contract, Provider } from 'fuels';
import type { Contract } from 'fuels';
import { BN, BaseAssetId } from 'fuels';

import { DocSnippetProjectsEnum } from '../../../test/fixtures/forc-projects';
Expand All @@ -9,10 +9,8 @@ import { createAndDeployContractFromProject } from '../../utils';
*/
describe(__filename, () => {
let contract: Contract;
let provider: Provider;
beforeAll(async () => {
contract = await createAndDeployContractFromProject(DocSnippetProjectsEnum.RETURN_CONTEXT);
provider = contract.provider;
});

it('should successfully execute contract call with forwarded amount', async () => {
Expand All @@ -32,7 +30,6 @@ describe(__filename, () => {

it('should throw error due not enough gas', async () => {
// #region call-params-2
const { minGasPrice } = provider.getGasConfig();

await expect(
contract.functions
Expand All @@ -41,15 +38,13 @@ describe(__filename, () => {
forward: [10, BaseAssetId],
gasLimit: 1,
})
.txParams({ gasPrice: minGasPrice })
.call()
).rejects.toThrow(/Gas limit '1' is lower than the required: /);
// #endregion call-params-2
});

it('should successfully execute transaction with `txParams` and `callParams`', async () => {
// #region call-params-3
const { minGasPrice } = provider.getGasConfig();
const amountToForward = 10;
const contractCallGasLimit = 100;
const transactionGasLimit = 3_000_000;
Expand All @@ -62,17 +57,12 @@ describe(__filename, () => {
})
.txParams({
gasLimit: transactionGasLimit,
gasPrice: minGasPrice,
})
.call();

const {
transactionResult: { transaction },
value,
} = result;
const { value } = result;

expect(new BN(value).toNumber()).toBe(10);
expect(new BN(transaction.scriptGasLimit).toNumber()).toBe(transactionGasLimit);
// #endregion call-params-3
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Provider, WalletUnlocked } from 'fuels';
import type { WalletUnlocked } from 'fuels';
import { ContractFactory } from 'fuels';

import {
Expand Down Expand Up @@ -28,10 +28,8 @@ describe('configurable-constants', () => {
},
};

let provider: Provider;
beforeAll(async () => {
wallet = await getTestWallet();
provider = wallet.provider;
});

it('should successfully set new values for all configurable constants', async () => {
Expand All @@ -49,11 +47,8 @@ describe('configurable-constants', () => {

const factory = new ContractFactory(bin, abi, wallet);

const { minGasPrice } = provider.getGasConfig();

const contract = await factory.deployContract({
configurableConstants,
gasPrice: minGasPrice,
});
// #endregion configurable-constants-2

Expand All @@ -73,11 +68,8 @@ describe('configurable-constants', () => {

const factory = new ContractFactory(bin, abi, wallet);

const { minGasPrice } = provider.getGasConfig();

const contract = await factory.deployContract({
configurableConstants,
gasPrice: minGasPrice,
});
// #endregion configurable-constants-3

Expand All @@ -99,12 +91,9 @@ describe('configurable-constants', () => {

const factory = new ContractFactory(bin, abi, wallet);

const { minGasPrice } = provider.getGasConfig();

await expect(
factory.deployContract({
configurableConstants,
gasPrice: minGasPrice,
})
).rejects.toThrowError();
// #endregion configurable-constants-4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe(__filename, () => {
expect(cost.maxFee).toBeDefined();
expect(cost.gasPrice).toBeDefined();
expect(cost.gasUsed).toBeDefined();
expect(cost.minGasPrice).toBeDefined();
expect(cost.gasPrice).toBeDefined();
// #endregion cost-estimation-1
});

Expand All @@ -48,7 +48,7 @@ describe(__filename, () => {
expect(cost.maxFee).toBeDefined();
expect(cost.gasPrice).toBeDefined();
expect(cost.gasUsed).toBeDefined();
expect(cost.minGasPrice).toBeDefined();
expect(cost.gasPrice).toBeDefined();
// #endregion cost-estimation-2
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ describe(__filename, () => {
// #region contract-setup-3
const factory = new ContractFactory(byteCode, abi, wallet);

const { minGasPrice: gasPrice } = wallet.provider.getGasConfig();

const contract = await factory.deployContract({ gasPrice });
const contract = await factory.deployContract();
// #endregion contract-setup-3

// #region contract-setup-4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Contract, Provider, WalletUnlocked } from 'fuels';
import type { Contract, WalletUnlocked } from 'fuels';
import { BN, ContractFactory } from 'fuels';

import {
Expand All @@ -14,12 +14,9 @@ describe(__filename, () => {
let wallet: WalletUnlocked;
let simpleToken: Contract;
let tokenDepositor: Contract;
let provider: Provider;

beforeAll(async () => {
wallet = await getTestWallet();
provider = wallet.provider;
const { minGasPrice } = provider.getGasConfig();

const tokenArtifacts = getDocsSnippetsForcProject(DocSnippetProjectsEnum.SIMPLE_TOKEN);
const depositorArtifacts = getDocsSnippetsForcProject(DocSnippetProjectsEnum.TOKEN_DEPOSITOR);
Expand All @@ -28,13 +25,13 @@ describe(__filename, () => {
tokenArtifacts.binHexlified,
tokenArtifacts.abiContents,
wallet
).deployContract({ gasPrice: minGasPrice });
).deployContract();

tokenDepositor = await new ContractFactory(
depositorArtifacts.binHexlified,
depositorArtifacts.abiContents,
wallet
).deployContract({ gasPrice: minGasPrice });
).deployContract();
});

it('should successfully make call to another contract', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ describe(__filename, () => {
beforeAll(async () => {
wallet = await getTestWallet();
const factory = new ContractFactory(bin, abi, wallet);
const { minGasPrice: gasPrice } = wallet.provider.getGasConfig();
contract = await factory.deployContract({ gasPrice });
contract = await factory.deployContract();

contractId = contract.id;
});
Expand Down
Loading
Loading