v0.98.0
Summary
In this release, we:
- Added method
fromInstanceto thePredicateclass - Added auto-detection for the user's package manager of choice for
create fuels - Made
Providerconstructorpublicandsyncagain - Added support for
--fuel-core-portflag infuels initcommand - Added the
autoCostmethod to easily estimate and fund transactions - Migrated
fundWithRequiredCoins->autoCostfor contract and script calls - Improved speed in assembling result for settled transactions
- Added a guard to
sendTransactionto ensure that we prevent implicit asset burns - Fixed an issue when using multiple paths (or globals) in
fuels init - Improved validation and handling of unsafe integers in
BigNumberCoder - Upgraded
fuel-coreto0.40.2 - Removed unused operations from
OperationNameenum - Remove receipts deprecated properties
- Removed all receipt coders
- Removed all instances of
Bech32address format in favour ofB256 - Removed the
AbstractAddressin favour of theAddressclass - Improved
Getting Starteddocs and repoREADME, focusing on Mainnet - Added documentation on optimizing frontend apps through transaction pre-loading
Breaking
- Features
- #3514 - Making
providerinitializationsyncagain, by @arboleya - #3539 -
autoCostfor transaction estimation and funding, by @danielbate - #3559 - Remove redundant gas price call for tx summary, by @danielbate
- #3540 - Prevent implicit asset burn, by @petertonysmith94
- #3514 - Making
- Chores
- #3553 - Remove unused operations, by @Torres-ssf
- #3552 - Remove receipts deprecated properties, by @Torres-ssf
- #3551 - Remove receipt coders, by @Torres-ssf
- #3548 - Remove deprecated
submitAndAwaitoperation, by @nedsalk - #3493 - Remove Bech32 address, by @petertonysmith94
- #3492 - Redistributed the
@fuel-ts/interfacespackage, by @petertonysmith94
- Docs
- #3573 - Optimizing frontend apps, by @danielbate
Features
- #3432 - Added method to duplicate predicate, by @YaTut1901
- #3503 - Auto-detect package manager in
create fuels, by @Dhaiwat10 - #3531 - Add support for
--fuel-core-portflag infuels init, by @nedsalk - #3487 - Added
onBeforeSendhook to the connector interface, by @petertonysmith94
Fixes
- #3486 - Adjust test ui script in package's json, by @arboleya
- #3510 - Adjust paths and globals in
fuels init, by @arboleya - #3491 - Validation and handling of unsafe integers, by @petertonysmith94
- #3537 - Resolve
punycodedeprecation notice, by @petertonysmith94 - #3528 - Usage of
providerUrlinfuels devcommand, by @nedsalk - #3508 - Unable to kill
fuels devwithpnpm, by @petertonysmith94
Chores
- #3511 - Bumped
@fuels/*deps to0.36.1, by @petertonysmith94 - #3449 - Dependency pinning and auditing, by @danielbate
- #3470 - Upgrade
fuel-coreto0.40.2, by @Torres-ssf - #3550 - Added
useBaseAssetIdhook to templates, by @petertonysmith94 - #3556 - Removing obsolete
Provider.createmethod, by @arboleya - #3554 - Remove unused deps + update knip config, by @maschad
Docs
Migration Notes
Features
#3514 - Making provider initialization sync again
1. Provider Instantiation
- Going from
asynctosync
// before
const provider = await Provider.create(NETWORK_URL);// after
const provider = new Provider(NETWORK_URL);2. Provider methods
- The following methods are now
async
// before
provider.getNode();
provider.getChain();
provider.getChainId();
provider.getBaseAssetId();
provider.getGasConfig();
provider.validateTransaction();// after
await provider.getNode();
await provider.getChain();
await provider.getChainId();
await provider.getBaseAssetId();
await provider.getGasConfig();
await provider.validateTransaction();3. TransferParams and ContractTransferParams
- Property
assetIdis now required byTransferParamsandContractTransferParams
export type TransferParams = {
destination: string | AbstractAddress;
amount: BigNumberish;
- assetId?: BytesLike;
+ assetId: BytesLike;
};
export type ContractTransferParams = {
contractId: string | AbstractAddress;
amount: BigNumberish;
- assetId?: BytesLike;
+ assetId: BytesLike;
};4. Transaction Response
- The constructor now requires a
chainId
// before
new TransactionResponse('0x..', provider);// after
new TransactionResponse('0x..', provider, chainId);#3539 - autoCost for transaction estimation and funding
To be brought inline with autoCost, funding a contract and script call has been migrated from fundWithRequiredCoins to autoCost:
// before
const request: ScriptTransactionRequest = contract.functions.add(1).fundWithRequiredCoins();// after
const request: ScriptTransactionRequest = contract.functions.add(1).autoCost();#3559 - Remove redundant gas price call for tx summary
calculateTXFeeForSummaryand subsequently theCalculateTXFeeForSummaryParamsno longer accept atotalFeeproperty. If you have thetotalFee, then there is no need to call thecalculateTxFeeForSummary()function.
// before
const totalFee = bn(..):
calculateTXFeeForSummary({ ..., totalFee } as CalculateTXFeeForSummaryParams);// after
calculateTXFeeForSummary({ ... } as CalculateTXFeeForSummaryParams);#3540 - Prevent implicit asset burn
// before
const transactionRequest = new ScriptTransactionRequest();
transactionRequest.inputs.push({ ... });
// since outputs weren't added, assets would be burned
await sender.sendTransaction(transactionRequest);// after
const transactionRequest = new ScriptTransactionRequest();
transactionRequest.inputs.push({ ... });
// now, an error will be thrown unless `enableAssetBurn`is true,
// in which case, assets can still be burned
await sender.sendTransaction(transactionRequest, {
enableAssetBurn: true,
});Chores
#3553 - Remove unused operations
The following operations have been removed from the OperationName enum, as they were never used to assemble operations:
OperationName.mintOperationName.predicatecallOperationName.scriptOperationName.sent
#3552 - Remove receipts deprecated properties
All receipts deprecated properties were removed:
// before
ReceiptCall.from
ReceiptLog.val0
ReceiptLog.val1
ReceiptLog.val2
ReceiptLog.val3
ReceiptLogData.val0
ReceiptLogData.val1
ReceiptTransfer.from
ReceiptTransferOut.from// after
ReceiptCall.id
ReceiptLog.ra
ReceiptLog.rb
ReceiptLog.rc
ReceiptLog.rd
ReceiptLogData.ra
ReceiptLogData.rb
ReceiptTransfer.id
ReceiptTransferOut.id#3551 - Remove receipt coders
All previously deprecated receipt coders have been removed. These classes were barely used aside from a few internal helpers, which were converted to utility functions.
// before
const messageId = ReceiptMessageOutCoder.getMessageId({
sender,
recipient,
nonce,
amount,
data,
});
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);// after
import { getMessageId, getAssetId } from 'fuels'
const messageId = getMessageId({
sender,
recipient,
nonce,
amount,
data,
});
const assetId = getAssetId(contractId, subId);#3548 - Remove deprecated submitAndAwait operation
submitAndAwaitoperation was removed
After being deprecated since #3101, we have removed this operation altogether. Please use the submitAndAwaitStatus method instead which gives the same results as submitAndAwait. If you are interested in the deprecation/removal reasons, please refer to FuelLabs/fuel-core#2108.
// before
const response = await provider.operations.submitAndAwait(txRequest);// after
const response = await provider.operations.submitAndAwaitStatus(txRequest);#3493 - Remove Bech32 address
- We no longer support Bech32 addresses
// before
import { Address, Bech32Address } from "fuels";
const bech32Address: Bech32Address = "fuel1234";
const address = new Address(bech32Address);// after
import { Address, B256Address } from "fuels";
const b256Address: B256Address = "0x1234";
const address = new Address(b256Address);-
Removed
INVALID_BECH32_ADDRESSerror code. -
Removed associated Bech32 helper functions.
normalizeBech32isBech32toB256getBytesFromBech32toBech32clearFirst12BytesFromB256
#3492 - Redistributed the @fuel-ts/interfaces package
- Removed the
AbstractAddressclass; use theAddressclass instead.
// before
import { AbstractAddress } from 'fuels';// after
import { Address } from 'fuels';- Removed the
@fuel-ts/interfacespackage; use thefuelspackage instead.
// before
import { BytesLike } from '@fuel-ts/interfaces'// after
import { BytesLike } from 'fuels'Docs
#3573 - Optimizing frontend apps
ScriptTransactionRequest.autoCost()has been renamed toScriptTransactionRequest.estimateAndFund(), initially introduced by #3535
// before
await request.autoCost(wallet);// after
await request.estimateAndFund(wallet);BaseInvocationScope.autoCost()has been renamed back toBaseInvocationScope.fundWithRequiredCoins(), initially introduced by #3535
// before
const request = await contract.functions.increment().autoCost();// after
const request = await contract.functions.increment().fundWithRequiredCoins();