Skip to content

Releases: FuelLabs/fuels-ts

v0.100.2

03 Apr 20:20
e210797
Compare
Choose a tag to compare

Summary

In this release, we:

  • Adjusted feature detection for balances indexation

Fixes

Chores

v0.100.1

19 Mar 15:32
3746f6c
Compare
Choose a tag to compare

Summary

In this release, we:

  • Avoid decoding logs from inter-called contracts without a JSON ABI
  • Eliminated duplicate chain requests across multiple concurrent provider instances

Fixes

Chores

v0.100.0

17 Mar 22:57
a071dce
Compare
Choose a tag to compare

Summary

In this release, we:

  • Consider assetId on isUserAccount and getAddressType methods
  • Enabled hashing + signing of bytes via personalMessage as per EIP-191
  • Support customizing TX request from BaseInvocationScope
  • Improved JSON RPC interface between SDK and Connectors, reducing HTTP requests
  • Added the corresponding receipt to the operation in the Tx summary
  • Improved directory detection for fuels init
  • Introduced decodeScriptData to decode the the values from a contract call script
  • Merge gas price and predicate estimation on a single request
  • Adapted ResourceCache to conform with new coinsToSpend limitations
  • Upgraded fuel-core to 0.41.9
  • Upgraded fuel-core to 0.41.7
  • Made getBlockWithTransactions and getBlock supports BN parameter
  • Upgraded forc to 0.67.0
  • Upgraded forc to 0.66.7

Breaking


Features

Fixes

Chores


Migration Notes

Chores

#3697 - Made ResourceCache consider resource owner

//before
provider.cache?.getActiveData();
provider.cache?.isCached(key);
//after
const owner = wallet.address.toB256();

provider.cache?.getActiveData(owner)
provider.cache?.isCached(owner, key);

#3590 - Upgrade fuel-core to 0.41.7

Because of the latest fuel-core changes, TS SDK does not throw the following error codes and messages anymore:

  1. NOT_ENOUGH_FUNDS
// before
"The account(s) sending the transaction don't have enough funds to cover the transaction."
// after
"Insufficient funds or too many small value coins. Consider combining UTXOs."
  1. MAX_COINS_REACHED
// before
"The account retrieving coins has exceeded the maximum number of coins per asset. Please consider combining your coins into a single UTXO."
// after
"Insufficient funds or too many small value coins. Consider combining UTXOs."

Both error codes were removed in favor of INSUFFICIENT_FUNDS_OR_MAX_COINS

v0.99.0

04 Feb 20:44
01375ce
Compare
Choose a tag to compare

Summary

In this release, we:

  • Upgraded forc to 0.66.6
  • Upgraded fuel-core to 0.40.4
  • Updated how we calculate Blob ID so that it mirrors Bytecode ID
  • Introduced bytecode helpers to compute the Bytecode ID and Legacy Blob ID
  • Removed pageInfo from provider.operations.getBalances response
  • Fixed a de-structuring issue when calling waitForResult on a submitted transaction
  • Fixed incorrect offset usage for Interface.decodeArguments() function
  • Improved DX of the Address class constructor
  • Added methods to allow querying the Explorer Asset API
  • Migrated CDN host from cdn.fuel.network to assets.fuel.network
  • Fixed a bug where fuels dev would hang after a Sway compilation error
  • Enable fuels callbacks to be asynchronous
  • Embedded node incompatibility warnings in GQL errors
  • Added forc tests to the template
  • Allowed passing gasPrice to getTransactionCost functions to reduce possible network calls

Breaking


Features

Fixes

Chores


Migration Notes

Chores

#3652 - Remove pageInfo from getBalances GraphQl operations

The pageInfo field has been removed from the response of the provider.operations.getBalances query.

// before
const { balances, pageInfo } = await provider.operations.getBalances({
  first: 100,
  filter: { owner: wallet.address.toB256() },
});
// after
const { balances } = await provider.operations.getBalances({
  first: 100,
  filter: { owner: wallet.address.toB256() },
});

The getBalances method of the Provider class remains unchanged, as it never returned pageInfo:

// not affected
const { balances } = await provider.getBalances();

#3570 - Remove ContractUtils namespaced export

  • ContractUtils was removed and the underlying functions (getContractRoot(), getContractStorageRoot(), getContractId(), hexlifyWithPrefix() are now exported directly from fuels.
// before
import { ContractUtils } from 'fuels';
// after
import { getContractRoot, getContractStorageRoot, getContractId, hexlifyWithPrefix } from 'fuels';

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.