October 2023 Beta-4 Breaking Changes Update 🌴

Fuel Stack Sept Breaking Changes Update

This guide assumes you have already followed the previous September beta-4 migration guide and are looking to bump to the latest versions of the toolchain below.

Sway

No breaking changes this week! :palm_tree:

TS SDK

Provider is used so widely in our SDK, there are multiple breaking changes that we need to be aware of and need to communicate to our users:

/* BEFORE - v0.57.0 */
const provider = new Provider(url)

/* AFTER - v0.60.0 */
const provider = await Provider.create(url)

All of these methods now require a Provider to be passed in:

  1. Wallet Methods Some of these methods used to accept a URL instead of a Provider object. Note that the provider param has to be a Provider object now.

const provider = await Provider.create(url);

/* BEFORE - v0.57.0 */
WalletUnlocked.fromSeed(seed, path);

WalletUnlocked.fromMnemonic(mnemonic, path, passphrase);

WalletUnlocked.fromExtendedKey(extendedKey);
await WalletUnlocked.fromEncryptedJson(jsonWallet, password);

Wallet.fromAddress(address);

Wallet.fromPrivateKey(pk);

Wallet.generate();

/* AFTER - v0.60.0 */
WalletUnlocked.fromSeed(seed, provider, path);

WalletUnlocked.fromMnemonic(mnemonic, provider, path, passphrase);

WalletUnlocked.fromExtendedKey(extendedKey, provider);
await WalletUnlocked.fromEncryptedJson(jsonWallet, password, provider);

Wallet.fromAddress(address, provider);

Wallet.fromPrivateKey(pk, provider);

Wallet.generate({ provider });
  1. Account Class
/* BEFORE - v0.57.0 */
const account = new Account(address);

/* AFTER - v0.60.0 */
const account = new Account(address, provider);
  1. PrivateKeyVault

These are the options that are accepted by the PrivateKeyVault constructor. provider is now a required input.

/* BEFORE - v0.57.0 */
interface PkVaultOptions {
  secret?: string;
  accounts?: Array<string>;
}

/* AFTER - v0.60.0 */
interface PkVaultOptions {
  secret?: string;
  accounts?: Array<string>;
  provider: Provider;
}
  1. MnemonicVault
/* BEFORE - v0.57.0 */
interface MnemonicVaultOptions {
  secret?: string;
  accounts?: Array<string>;
}

/* AFTER - v0.60.0 */
interface MnemonicVaultOptions {
  secret?: string;
  accounts?: Array<string>;
  provider: Provider;
}
  1. WalletManager
/* BEFORE - v0.57.0 */
export type VaultConfig = {
  type: string;
  title?: string;
  secret?: string;
};

/* AFTER - v0.60.0 */
export type VaultConfig = {
  type: string;
  title?: string;
  secret?: string;
  provider: Provider;
};
  1. Predicates

The provider is no longer optional. Note the change in parameter order, and that chainId is no longer required to be passed.

/* BEFORE - v0.57.0 */ 
const predicate = new Predicate(bytes, chainId, jsonAbi);

/* AFTER - v0.60.0 */ 
const predicate = new Predicate(bytes, provider, jsonAbi);

Rust SDK

No breaking changes this week! :crab:

5 Likes