Skip to content

Releases: FuelLabs/fuels-ts

v0.98.0

10 Jan 16:53
d633eaf
Compare
Choose a tag to compare

Summary

In this release, we:

  • Added method fromInstance to the Predicate class
  • Added auto-detection for the user's package manager of choice for create fuels
  • Made Provider constructor public and sync again
  • Added support for --fuel-core-port flag in fuels init command
  • Added the autoCost method to easily estimate and fund transactions
  • Migrated fundWithRequiredCoins -> autoCost for contract and script calls
  • Improved speed in assembling result for settled transactions
  • Added a guard to sendTransaction to 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-core to 0.40.2
  • Removed unused operations from OperationName enum
  • Remove receipts deprecated properties
  • Removed all receipt coders
  • Removed all instances of Bech32 address format in favour of B256
  • Removed the AbstractAddress in favour of the Address class
  • Improved Getting Started docs and repo README, focusing on Mainnet
  • Added documentation on optimizing frontend apps through transaction pre-loading

Breaking


Features

Fixes

Chores

Docs


Migration Notes

Features

#3514 - Making provider initialization sync again

1. Provider Instantiation

  • Going from async to sync
// 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

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

  • calculateTXFeeForSummary and subsequently the CalculateTXFeeForSummaryParams no longer accept a totalFee property. If you have the totalFee, then there is no need to call the calculateTxFeeForSummary() 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.mint
  • OperationName.predicatecall
  • OperationName.script
  • OperationName.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 co...

Read more

v0.97.2

13 Dec 17:05
41c72fb
Compare
Choose a tag to compare

Summary

In this release, we:

  • Updated forc version to 0.66.5

Fixes

Chores

v0.97.1

10 Dec 11:59
a3842a5
Compare
Choose a tag to compare

Summary

In this release, we:

  • Improved launchTestNode and typegen'd contract factories integration
  • Fixed transferToContract and batchTransferToContracts to accept big number amounts.
  • Fixed issue with fuel-core node cleanup operation failing in Bun.
  • Deprecated the bech32Address type in favour of hexadecimal address format going forward.
  • Upgraded fuel-core to 0.40.1
  • Added a cookbook for deploying and manually upgrading by proxy contract
  • Exported TypeScript recipes of Sway Programs

Features

  • #3398 - Better typegen contract factory integration with launchTestNode, by @nedsalk

Fixes

Chores

Docs

v0.97.0

15 Nov 13:17
537fdc2
Compare
Choose a tag to compare

Summary

In this release, we:

  • Implemented batch transfer to contracts
  • Optimized the getMessageByNonce provider endpoint
  • Upgraded fuel-core to v0.40.0
  • Optimize graphQL query for Provider.getTransactions
  • Limit pagination number for getTransactionsSummaries to 60
  • Upgraded forc to v0.66.4
  • Removed blockId property from responses when listing transactions
  • Upgraded forc to v0.66.2
  • Deprecate and fix multiple receipts properties
  • Optimized the getCoins provider endpoint
  • Revised our code snippets to use a WYSIWYG format

Breaking


Features

Fixes

Chores

Docs


Migration Notes

Features

#3383 - onDeploy fuels config supports all Sway program types

  • Changed the outputted data from the onDeploy callback method for the fuels.config.ts. Instead of just emitting the deployed contracts (as an array), it will now emit an object with contracts, predicates and scripts.
// Before (fuels.config.ts)
import { createConfig, FuelsConfig, DeployedContract } from 'fuels';

export default createConfig({
  output: 'dir/out',
  onDeploy: (config: FuelsConfig, deployedContracts: DeployedContract[]) => {
    console.log('contracts', deployedContracts);
  }
});
// After (fuels.config.ts)
import { createConfig, FuelsConfig, DeployedData } from 'fuels';

export default createConfig({
  output: 'dir/out',
  onDeploy: (config: FuelsConfig, deployed: DeployedData[]) => {
    console.log('contracts', deployed.contracts);
    console.log('predicates', deployed.predicates);
    console.log('scripts', deployed.scripts);
  }
});

Fixes

#3298 - Remove unnecessary nonce from message gql queries

  • Removed the nonce property from Provider.operations.getMessageByNonce(). This can still be retrieved by Provider.getMessageByNonce().

Chores

#3389 - Refactor predicate and script deployment

ContractFactory.deployAsBlobTxForScript has been removed in favor of Predicate.deploy and Script.deploy:

// before
const factory = new ContractFactory(scriptBytecode, scriptAbi, wallet);
const { waitForResult } = await factory.deployAsBlobTxForScript();
const { loaderBytecode, configurableOffsetDiff } = await waitForResult();

// after
const script = new Script(scriptBytecode, scriptAbi, wallet);
const { blobId, waitForResult } = await script.deploy(deployerWallet);
const loaderScript = await waitForResult();

const predicate = new Predicate({ bytecode, abi, provider });
const { blobId, waitForResult } = await predicate.deploy(deployerWallet);
const loaderPredicate = await waitForResult();

#3387 - Mandate abi in Predicate constructor

Instantiating a Predicate now requires providing its abi. If you want to use the Predicate as an Account, please instantiate it via the Account class

// before
const predicate = new Predicate({ provider, bytecode }); // worked even though abi is missing

// after
const predicate = new Predicate({ abi, provider, bytecode }); // abi is now mandatory

// predicate as account
const account = new Account(predicateAddress, provider);

#3336 - Optimize getTransactions query

The response format for Provider.getTransactions remains the same. However, the response format for the query Provider.operations.getTransactions has been modified.

// before
query getTransactions {
  id
  rawPayload
  status {
    ...
  }
}
// after
query getTransactions {
  rawPayload
}

#3400 - Limit TX pagination number for getTransactionsSummaries

The pagination number for getTransactionsSummaries is limited to 60 now

// before
const { transactions } = await getTransactionsSummaries({
  provider,
  filters: {
    owner: account.address.toB256(),
    first: 200,
  },
});
// after
const { transactions } = await getTransactionsSummaries({
  provider,
  filters: {
    owner: account.address.toB256(),
    first: 60, // Limit is 60 now. A higher value will result in an error
  },
});

#3379 - Remove blockId in transaction list responses

The blockId property has been removed from the following GraphQL queries used to list past transactions:

const { transactions } = await getTransactionsSummaries({ ... });

const { transactionsByOwner } = await provider.operations.getTransactionsByOwner({ ... });

If the blockId is required for a given transaction, it needs to be queried separately with getTransactionSummary helper:

import { getTransactionSummary } from 'fuels';

const transaction = await getTransactionSummary({
  id,
  provider,
});

Note: The blockId is still available in the result for a submitted transaction.

#3301 - Optimize coin gql queries

  • The Provider.operations.getCoins() and Provider.operations.getCoinsToSpend function no longer return the owner. These methods shouldn't be called directly but are used internally to formulate responses from the SDK.

  • Removed the property owner from the Provider.operations.getCoinsToSpend() function. Suggest to use the owner from the input parameters.

v0.96.1

14 Oct 02:29
9ebd6c2
Compare
Choose a tag to compare

Summary

In this release, we:

  • Improved Provider cache to self-clean on TX dry-run/estimation
  • Use a modifier of 20% for estimated gas
  • Fixed the listener setup for the current connector
  • Fixed a bug where bn.parseUnits wouldn't work as expected with units = 0
  • Upgraded fuel-core to 0.39.0

Features

Fixes

Chores

v0.96.0

13 Oct 02:32
48598be
Compare
Choose a tag to compare

Summary

In this release, we:

  • Fixed checksum utility to correctly remove 0x before hashing

Breaking


Migration Notes

Fixes

#3313 - Checksum method to remove 0x before hashing

We fixed the checksum utilities:

  • Address.toChecksum()
  • Address.isChecksumValid()

Now, we correctly remove the leading 0x before hashing the address.

Because of this, previous values were invalid, and the update is required.

v0.95.0

10 Oct 21:30
ffd3d6c
Compare
Choose a tag to compare

Summary

In this release, we:

  • Added new checksum utility to the Address class
  • Added Provider methods isUserAccount and getAddressType which indicate the type of the hex passed
  • Added a new header for GraphQL requests with the fuels version used
  • Added a limit of 30 transactions to the provider.getTransactions() method.
  • fixed an issue where formatting with 0 in the bn class returned an incorrect value
  • Fixed caching of chain and node data in Provider.
  • Fixed typegen template for ContractFactory
  • Updated to [email protected]
  • Updated to [email protected]
  • Updated create-fuels toolchain file
  • Updated to [email protected]
  • Made Address.toString and Address.valueOf returns the Address checksum
  • Updated fuel-core to 0.38.0
  • Optimised the provider balance queries
  • Optimize the getBlockWithTransactions query

Breaking


Features

Fixes

Chores


Migration Notes

Features

#3306 - Bump transaction pagination limit to 60

  • A limit was added of 60 transactions to the provider.getTransactions() method.

Chores

#3310 - Made Address toString and valueOf returns checksum

The return of both Address.toString() and Address.valueOf was modified to return the address checksum instead of the Bech32 string

// before
const address = new Address('fuel1elnmzsav56dqnp95sx4e2pckq36cvae9ser44m5zlvgtwxw49fmqd7e42e');

address.toString()
// fuel1elnmzsav56dqnp95sx4e2pckq36cvae9ser44m5zlvgtwxw49fmqd7e42e

address.valueOf()
// fuel1elnmzsav56dqnp95sx4e2pckq36cvae9ser44m5zlvgtwxw49fmqd7e42e
// after
const address = new Address('fuel1elnmzsav56dqnp95sx4e2pckq36cvae9ser44m5zlvgtwxw49fmqd7e42e');

address.toString()
// 0xEf86aFa9696Cf0dc6385e2C407A6e159A1103cEfB7E2Ae0636FB33d3cb2A9E4A

address.valueOf()
// 0xEf86aFa9696Cf0dc6385e2C407A6e159A1103cEfB7E2Ae0636FB33d3cb2A9E4A

#3286 - Slim down chainInfoFragment and GasCostsFragment

  • latestBlock is no longer part of the ChainInfo return of provider.getChain(). You can fetch it via provider.getBlock('latest').
  • ChainInfo['consensusParameters']['gasCosts'] has been slimmed down to only contain data necessary for the operation of the SDK. Up until now, the SDK was fetching more than it needed. If this change affects you, you will have to create a custom graphql query for gasCosts for the additional data you need.

#3296 - Optimize balance queries

  • Removed the owner and assetId properties from the response of Provider.operations.getBalance(). These properties are also required arguments to execute the function so are redundant in the response. Should you require these values, you should take them from the values that you passed to the function.
  • Removed the owner property from the response of Provider.operations.getBalances(). This property is a required argument to execute the function so is redundant in the response. Should you require this value, you should take it from the value that you passed to the function.

v0.94.9

07 Oct 02:39
1991f97
Compare
Choose a tag to compare

Summary

In this release, we:

  • Added support for deploying scripts and predicates
  • Upgraded to [email protected]
  • Upgraded to [email protected]
  • Fixed contracts containing storage deployed with a proxy via fuels deploy

Features

Fixes

Chores

v0.94.8

27 Sep 15:46
8321098
Compare
Choose a tag to compare

Summary

In this release, we:

  • Revamped the UX for fuels default template

Features

Fixes

  • #3219 - Reduce flakiness by favoring port 0 over portfinder dependency, by @nedsalk

Chores

v0.94.7

27 Sep 09:23
e6f6965
Compare
Choose a tag to compare

Summary

In this release, we:

  • Upgraded fuel-core to v0.36.0
  • Upgraded forc to v0.63.6 and v0.64.0
  • Added support for SRC-14 proxy contracts in fuels deploy
  • Removed assets from sepolia / testnet network
  • Fixed decimals of some assets on fuel network side
  • Added flag to indicate whether a connector is external
  • Added a banner for users running an outdated fuels version
  • Fixed the usage of fuel-toolchain.toml for fuels templates

Features

Fixes

Chores