From 19a861002bb40d0e024918e152859e24f8777cfd Mon Sep 17 00:00:00 2001 From: chad Date: Tue, 24 Sep 2024 13:01:58 -0500 Subject: [PATCH 1/7] chore: deprecate bech32 addresses --- CONTRIBUTING.md | 3 ++ .../contracts/managing-deployed-contracts.md | 3 ++ apps/docs/src/guide/types/address.md | 3 ++ apps/docs/src/guide/types/bech32.md | 3 ++ .../src/guide/utilities/address-conversion.md | 3 ++ packages/address/README.md | 3 ++ packages/address/src/address.ts | 31 +++++++++++++------ packages/address/src/utils.ts | 9 ++++-- packages/errors/src/error-codes.ts | 5 +++ packages/interfaces/src/index.ts | 4 +++ 10 files changed, 55 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d7a7547429..80f1835d302 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -167,6 +167,9 @@ The e2e test can be found at: The Bech32 address of this wallet is `fuel1x33ajpj0jy5p2wcqqu45e32r75zrwfeh6hwqfv5un670rv4p0mns58enjg`. This address can be funded via the [faucet](https://faucet-testnet.fuel.network/). +> [!NOTE] Note +> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + If you want to run an e2e test locally, you can provide your own wallet address and private key. For obvious security reasons, the private key should not be shared. These can be overridden by generating an environment file: diff --git a/apps/docs/src/guide/contracts/managing-deployed-contracts.md b/apps/docs/src/guide/contracts/managing-deployed-contracts.md index dc13f7a19a0..f00adb3cffb 100644 --- a/apps/docs/src/guide/contracts/managing-deployed-contracts.md +++ b/apps/docs/src/guide/contracts/managing-deployed-contracts.md @@ -8,6 +8,9 @@ The `contractId` property from the [`Contract`](../../api/Program/Contract.md) c The [`Address`](../../api/Address/Address.md) class wraps all methods from the [`AbstractAddress`](../../api/Interfaces/AbstractAddress.md) class and adds a single property: `bech32Address`. This property is a string encoded in [`Bech32`](../types/bech32.md) format, recognizable by the human-readable prefix `fuel` followed by the separator `1`. +> [!NOTE] Note +> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + When you log the `contractId` property of an instantiated Contract using `console.log`, the output appears as follows: ```console diff --git a/apps/docs/src/guide/types/address.md b/apps/docs/src/guide/types/address.md index af446f25e22..491506af218 100644 --- a/apps/docs/src/guide/types/address.md +++ b/apps/docs/src/guide/types/address.md @@ -24,6 +24,9 @@ To create an [`Address`](../../api/Address/Address.md) from a `Bech32` address, <<< @/../../docs-snippets/src/guide/types/address.test.ts#address-2{ts:line-numbers} +> [!NOTE] Note +> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + ### From a Public Key To create an [`Address`](../../api/Address/Address.md) from a public key, use the following code snippet: diff --git a/apps/docs/src/guide/types/bech32.md b/apps/docs/src/guide/types/bech32.md index cd9fb847c1b..3dadee476da 100644 --- a/apps/docs/src/guide/types/bech32.md +++ b/apps/docs/src/guide/types/bech32.md @@ -1,5 +1,8 @@ # `Bech32` +> [!NOTE] Note +> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + The SDK uses the `Bech32` type as the core property of the [`Address`](../../api/Address/Address.md) class, specifically through the `bech32Address` property. Originally designed for Bitcoin, the `Bech32` format offers numerous advantages such as enhanced error detection, simplified integrations, and improved compatibility with future upgrades. Given these benefits, the [`Address`](../../api/Address/Address.md) class is constructed around the `Bech32` type. diff --git a/apps/docs/src/guide/utilities/address-conversion.md b/apps/docs/src/guide/utilities/address-conversion.md index 230af22f5e4..758f6016fec 100644 --- a/apps/docs/src/guide/utilities/address-conversion.md +++ b/apps/docs/src/guide/utilities/address-conversion.md @@ -6,6 +6,9 @@ The Fuel Network uses the [`Bech32`](../types/bech32.md) address format for its <<< @/../../docs-snippets/src/guide/types/bech32.test.ts#addresses-1{ts:line-numbers} +> [!NOTE] Note +> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + However, a hexlified [Bits256](../types/bits256.md) (hex) is another common address format; an example can be seen below: <<< @/../../docs-snippets/src/guide/types/bits256.test.ts#addresses-2{ts:line-numbers} diff --git a/packages/address/README.md b/packages/address/README.md index 1bc2595404c..9dae933d670 100644 --- a/packages/address/README.md +++ b/packages/address/README.md @@ -4,6 +4,9 @@ This module contains the utilities for encoding and decoding address and contract ids between Bech32 and other address formats. +> [!NOTE] Note +> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + # Table of contents - [Documentation](#documentation) diff --git a/packages/address/src/address.ts b/packages/address/src/address.ts index 8eb4c88ac00..70e52791447 100644 --- a/packages/address/src/address.ts +++ b/packages/address/src/address.ts @@ -24,6 +24,10 @@ import { */ export default class Address extends AbstractAddress { // #region address-2 + /** + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + */ readonly bech32Address: Bech32Address; // #endregion address-2 @@ -44,7 +48,8 @@ export default class Address extends AbstractAddress { /** * Returns the `bech32Address` property - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @returns The `bech32Address` property */ toAddress(): Bech32Address { @@ -53,7 +58,8 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property to a 256 bit hash string - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @returns The `bech32Address` property as a 256 bit hash string */ toB256(): B256Address { @@ -62,7 +68,8 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property to a byte array - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @returns The `bech32Address` property as a byte array */ toBytes(): Uint8Array { @@ -71,7 +78,8 @@ export default class Address extends AbstractAddress { /** * Converts - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @returns The `bech32Address` property as a 256 bit hash string */ toHexString(): B256Address { @@ -89,7 +97,8 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property as a string - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @returns The `bech32Address` property as a string */ toJSON(): string { @@ -98,7 +107,8 @@ export default class Address extends AbstractAddress { /** * Clears the first 12 bytes of the `bech32Address` property and returns it as a `EvmAddress` - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @returns The `bech32Address` property as an {@link EvmAddress | `EvmAddress`} */ toEvmAddress(): EvmAddress { @@ -111,7 +121,8 @@ export default class Address extends AbstractAddress { /** * Wraps the `bech32Address` property and returns as an `AssetId`. - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @returns The `bech32Address` property as an {@link AssetId | `AssetId`} */ toAssetId(): AssetId { @@ -122,7 +133,8 @@ export default class Address extends AbstractAddress { /** * Returns the value of the `bech32Address` property - * + *@deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @returns The value of `bech32Address` property */ valueOf(): string { @@ -131,7 +143,8 @@ export default class Address extends AbstractAddress { /** * Compares this the `bech32Address` property to another for direct equality - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @param other - Another address to compare against * @returns The equality of the comparison */ diff --git a/packages/address/src/utils.ts b/packages/address/src/utils.ts index 0f3b4eeb850..c84fd3f4fa5 100644 --- a/packages/address/src/utils.ts +++ b/packages/address/src/utils.ts @@ -23,7 +23,8 @@ export const FUEL_BECH32_HRP_PREFIX = 'fuel'; /** * Decodes a Bech32 address string into Decoded - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @hidden */ export function fromBech32(address: Bech32Address): Decoded { @@ -32,7 +33,8 @@ export function fromBech32(address: Bech32Address): Decoded { /** * Converts a B256 address string into Bech32 - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @hidden */ export function toBech32(address: B256Address): Bech32Address { @@ -44,7 +46,8 @@ export function toBech32(address: B256Address): Bech32Address { /** * Determines if a given string is Bech32 format - * + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. * @hidden */ export function isBech32(address: BytesLike): boolean { diff --git a/packages/errors/src/error-codes.ts b/packages/errors/src/error-codes.ts index 151235770bd..1bf5c0621b2 100644 --- a/packages/errors/src/error-codes.ts +++ b/packages/errors/src/error-codes.ts @@ -25,7 +25,12 @@ export enum ErrorCode { WORKSPACE_NOT_DETECTED = 'workspace-not-detected', // address + /** + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + */ INVALID_BECH32_ADDRESS = 'invalid-bech32-address', + INVALID_EVM_ADDRESS = 'invalid-evm-address', INVALID_B256_ADDRESS = 'invalid-b256-address', diff --git a/packages/interfaces/src/index.ts b/packages/interfaces/src/index.ts index 527027fb7ef..61dbe8701b4 100644 --- a/packages/interfaces/src/index.ts +++ b/packages/interfaces/src/index.ts @@ -8,6 +8,10 @@ */ // #region bech32-1 +/** + * @deprecated + * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + */ export type Bech32Address = `fuel${string}`; // #endregion bech32-1 export type B256Address = string; From 85ff2d569df6bbaed599a41bf2c81a3e1a8da050 Mon Sep 17 00:00:00 2001 From: chad Date: Tue, 24 Sep 2024 13:03:00 -0500 Subject: [PATCH 2/7] docs: add changeset --- .changeset/late-pugs-carry.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/late-pugs-carry.md diff --git a/.changeset/late-pugs-carry.md b/.changeset/late-pugs-carry.md new file mode 100644 index 00000000000..202b2028f3a --- /dev/null +++ b/.changeset/late-pugs-carry.md @@ -0,0 +1,7 @@ +--- +"@fuel-ts/interfaces": patch +"@fuel-ts/address": patch +"@fuel-ts/errors": patch +--- + +chore: deprecate bech32 addresses From 9d2580723612eff2d879d17ae687e3b9e121b4a2 Mon Sep 17 00:00:00 2001 From: chad Date: Tue, 24 Sep 2024 15:28:19 -0500 Subject: [PATCH 3/7] docs: update language of deprecation notice --- CONTRIBUTING.md | 2 +- .../contracts/managing-deployed-contracts.md | 2 +- apps/docs/src/guide/types/address.md | 2 +- apps/docs/src/guide/types/bech32.md | 2 +- .../src/guide/utilities/address-conversion.md | 2 +- packages/address/README.md | 2 +- packages/address/src/address.ts | 20 +++++++++---------- packages/address/src/utils.ts | 6 +++--- packages/errors/src/error-codes.ts | 2 +- packages/interfaces/src/index.ts | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80f1835d302..933549847c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -168,7 +168,7 @@ The e2e test can be found at: The Bech32 address of this wallet is `fuel1x33ajpj0jy5p2wcqqu45e32r75zrwfeh6hwqfv5un670rv4p0mns58enjg`. This address can be funded via the [faucet](https://faucet-testnet.fuel.network/). > [!NOTE] Note -> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. If you want to run an e2e test locally, you can provide your own wallet address and private key. For obvious security reasons, the private key should not be shared. diff --git a/apps/docs/src/guide/contracts/managing-deployed-contracts.md b/apps/docs/src/guide/contracts/managing-deployed-contracts.md index f00adb3cffb..4afa3735e15 100644 --- a/apps/docs/src/guide/contracts/managing-deployed-contracts.md +++ b/apps/docs/src/guide/contracts/managing-deployed-contracts.md @@ -9,7 +9,7 @@ The `contractId` property from the [`Contract`](../../api/Program/Contract.md) c The [`Address`](../../api/Address/Address.md) class wraps all methods from the [`AbstractAddress`](../../api/Interfaces/AbstractAddress.md) class and adds a single property: `bech32Address`. This property is a string encoded in [`Bech32`](../types/bech32.md) format, recognizable by the human-readable prefix `fuel` followed by the separator `1`. > [!NOTE] Note -> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. When you log the `contractId` property of an instantiated Contract using `console.log`, the output appears as follows: diff --git a/apps/docs/src/guide/types/address.md b/apps/docs/src/guide/types/address.md index 491506af218..2d5cd42e2b0 100644 --- a/apps/docs/src/guide/types/address.md +++ b/apps/docs/src/guide/types/address.md @@ -25,7 +25,7 @@ To create an [`Address`](../../api/Address/Address.md) from a `Bech32` address, <<< @/../../docs-snippets/src/guide/types/address.test.ts#address-2{ts:line-numbers} > [!NOTE] Note -> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. ### From a Public Key diff --git a/apps/docs/src/guide/types/bech32.md b/apps/docs/src/guide/types/bech32.md index 3dadee476da..245dee931f6 100644 --- a/apps/docs/src/guide/types/bech32.md +++ b/apps/docs/src/guide/types/bech32.md @@ -1,7 +1,7 @@ # `Bech32` > [!NOTE] Note -> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. The SDK uses the `Bech32` type as the core property of the [`Address`](../../api/Address/Address.md) class, specifically through the `bech32Address` property. diff --git a/apps/docs/src/guide/utilities/address-conversion.md b/apps/docs/src/guide/utilities/address-conversion.md index 758f6016fec..8804cae1477 100644 --- a/apps/docs/src/guide/utilities/address-conversion.md +++ b/apps/docs/src/guide/utilities/address-conversion.md @@ -7,7 +7,7 @@ The Fuel Network uses the [`Bech32`](../types/bech32.md) address format for its <<< @/../../docs-snippets/src/guide/types/bech32.test.ts#addresses-1{ts:line-numbers} > [!NOTE] Note -> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. However, a hexlified [Bits256](../types/bits256.md) (hex) is another common address format; an example can be seen below: diff --git a/packages/address/README.md b/packages/address/README.md index 9dae933d670..934de637a9a 100644 --- a/packages/address/README.md +++ b/packages/address/README.md @@ -5,7 +5,7 @@ This module contains the utilities for encoding and decoding address and contract ids between Bech32 and other address formats. > [!NOTE] Note -> The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. # Table of contents diff --git a/packages/address/src/address.ts b/packages/address/src/address.ts index 70e52791447..52dd607ce96 100644 --- a/packages/address/src/address.ts +++ b/packages/address/src/address.ts @@ -26,7 +26,7 @@ export default class Address extends AbstractAddress { // #region address-2 /** * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. */ readonly bech32Address: Bech32Address; // #endregion address-2 @@ -49,7 +49,7 @@ export default class Address extends AbstractAddress { /** * Returns the `bech32Address` property * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @returns The `bech32Address` property */ toAddress(): Bech32Address { @@ -59,7 +59,7 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property to a 256 bit hash string * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @returns The `bech32Address` property as a 256 bit hash string */ toB256(): B256Address { @@ -69,7 +69,7 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property to a byte array * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @returns The `bech32Address` property as a byte array */ toBytes(): Uint8Array { @@ -79,7 +79,7 @@ export default class Address extends AbstractAddress { /** * Converts * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @returns The `bech32Address` property as a 256 bit hash string */ toHexString(): B256Address { @@ -98,7 +98,7 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property as a string * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @returns The `bech32Address` property as a string */ toJSON(): string { @@ -108,7 +108,7 @@ export default class Address extends AbstractAddress { /** * Clears the first 12 bytes of the `bech32Address` property and returns it as a `EvmAddress` * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @returns The `bech32Address` property as an {@link EvmAddress | `EvmAddress`} */ toEvmAddress(): EvmAddress { @@ -122,7 +122,7 @@ export default class Address extends AbstractAddress { /** * Wraps the `bech32Address` property and returns as an `AssetId`. * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @returns The `bech32Address` property as an {@link AssetId | `AssetId`} */ toAssetId(): AssetId { @@ -134,7 +134,7 @@ export default class Address extends AbstractAddress { /** * Returns the value of the `bech32Address` property *@deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @returns The value of `bech32Address` property */ valueOf(): string { @@ -144,7 +144,7 @@ export default class Address extends AbstractAddress { /** * Compares this the `bech32Address` property to another for direct equality * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @param other - Another address to compare against * @returns The equality of the comparison */ diff --git a/packages/address/src/utils.ts b/packages/address/src/utils.ts index c84fd3f4fa5..125ae1dc4ef 100644 --- a/packages/address/src/utils.ts +++ b/packages/address/src/utils.ts @@ -24,7 +24,7 @@ export const FUEL_BECH32_HRP_PREFIX = 'fuel'; /** * Decodes a Bech32 address string into Decoded * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @hidden */ export function fromBech32(address: Bech32Address): Decoded { @@ -34,7 +34,7 @@ export function fromBech32(address: Bech32Address): Decoded { /** * Converts a B256 address string into Bech32 * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @hidden */ export function toBech32(address: B256Address): Bech32Address { @@ -47,7 +47,7 @@ export function toBech32(address: B256Address): Bech32Address { /** * Determines if a given string is Bech32 format * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. * @hidden */ export function isBech32(address: BytesLike): boolean { diff --git a/packages/errors/src/error-codes.ts b/packages/errors/src/error-codes.ts index 1bf5c0621b2..346526f5636 100644 --- a/packages/errors/src/error-codes.ts +++ b/packages/errors/src/error-codes.ts @@ -27,7 +27,7 @@ export enum ErrorCode { // address /** * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. */ INVALID_BECH32_ADDRESS = 'invalid-bech32-address', diff --git a/packages/interfaces/src/index.ts b/packages/interfaces/src/index.ts index 61dbe8701b4..8282ec7676d 100644 --- a/packages/interfaces/src/index.ts +++ b/packages/interfaces/src/index.ts @@ -10,7 +10,7 @@ // #region bech32-1 /** * @deprecated - * The `bech32Address` is now deprecated. Hexadecimal will be the only address format from this point onward. + * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. */ export type Bech32Address = `fuel${string}`; // #endregion bech32-1 From 43ae00549b2d8243ad20837f4c691b156682419c Mon Sep 17 00:00:00 2001 From: chad Date: Tue, 24 Sep 2024 21:15:22 -0500 Subject: [PATCH 4/7] docs: update deprecation notice language --- .../src/guide/utilities/address-conversion.md | 4 ++-- packages/address/src/address.ts | 24 +++++++++---------- packages/address/src/utils.ts | 12 ++++++---- packages/errors/src/error-codes.ts | 2 +- packages/interfaces/src/index.ts | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/apps/docs/src/guide/utilities/address-conversion.md b/apps/docs/src/guide/utilities/address-conversion.md index 8804cae1477..0edb61ddc95 100644 --- a/apps/docs/src/guide/utilities/address-conversion.md +++ b/apps/docs/src/guide/utilities/address-conversion.md @@ -31,7 +31,7 @@ By instantiating an [`Address`](../../api/Address/Address.md), we can validate a <<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-5{ts:line-numbers} -Or, if you'd prefer to use utility functions directly for validation and conversion, you can use `isBech32` and `toB256`: +Or, if you'd prefer to use utility functions directly for validation and conversion, you can use `isBech32` and B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details): <<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-6{ts:line-numbers} @@ -47,7 +47,7 @@ And by using the `isB256` and `toBech32` utilities: ## Converting a Contract ID -The Contract `id` property has the [`AbstractAddress`](../types/address.md#abstractaddress-class) type. Therefore, it can be converted using the [`Address`](../../api/Address/Address.md) class functions such as `toAddress` and `toB256`: +The Contract `id` property has the [`AbstractAddress`](../types/address.md#abstractaddress-class) type. Therefore, it can be converted using the [`Address`](../../api/Address/Address.md) class functions such as `toAddress` and B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details): <<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-2{ts:line-numbers} diff --git a/packages/address/src/address.ts b/packages/address/src/address.ts index 52dd607ce96..66c6d0b80aa 100644 --- a/packages/address/src/address.ts +++ b/packages/address/src/address.ts @@ -26,7 +26,7 @@ export default class Address extends AbstractAddress { // #region address-2 /** * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. */ readonly bech32Address: Bech32Address; // #endregion address-2 @@ -49,7 +49,7 @@ export default class Address extends AbstractAddress { /** * Returns the `bech32Address` property * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property */ toAddress(): Bech32Address { @@ -59,7 +59,7 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property to a 256 bit hash string * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property as a 256 bit hash string */ toB256(): B256Address { @@ -69,7 +69,7 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property to a byte array * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property as a byte array */ toBytes(): Uint8Array { @@ -79,7 +79,7 @@ export default class Address extends AbstractAddress { /** * Converts * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property as a 256 bit hash string */ toHexString(): B256Address { @@ -98,7 +98,7 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property as a string * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property as a string */ toJSON(): string { @@ -108,7 +108,7 @@ export default class Address extends AbstractAddress { /** * Clears the first 12 bytes of the `bech32Address` property and returns it as a `EvmAddress` * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property as an {@link EvmAddress | `EvmAddress`} */ toEvmAddress(): EvmAddress { @@ -120,10 +120,8 @@ export default class Address extends AbstractAddress { } /** - * Wraps the `bech32Address` property and returns as an `AssetId`. - * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. - * @returns The `bech32Address` property as an {@link AssetId | `AssetId`} + * Wraps the B256 property and returns as an `AssetId`. + * @returns The B256 property as an {@link AssetId | `AssetId`} */ toAssetId(): AssetId { return { @@ -134,7 +132,7 @@ export default class Address extends AbstractAddress { /** * Returns the value of the `bech32Address` property *@deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The value of `bech32Address` property */ valueOf(): string { @@ -144,7 +142,7 @@ export default class Address extends AbstractAddress { /** * Compares this the `bech32Address` property to another for direct equality * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @param other - Another address to compare against * @returns The equality of the comparison */ diff --git a/packages/address/src/utils.ts b/packages/address/src/utils.ts index 125ae1dc4ef..334cfab2e25 100644 --- a/packages/address/src/utils.ts +++ b/packages/address/src/utils.ts @@ -24,7 +24,7 @@ export const FUEL_BECH32_HRP_PREFIX = 'fuel'; /** * Decodes a Bech32 address string into Decoded * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @hidden */ export function fromBech32(address: Bech32Address): Decoded { @@ -34,7 +34,7 @@ export function fromBech32(address: Bech32Address): Decoded { /** * Converts a B256 address string into Bech32 * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @hidden */ export function toBech32(address: B256Address): Bech32Address { @@ -47,7 +47,7 @@ export function toBech32(address: B256Address): Bech32Address { /** * Determines if a given string is Bech32 format * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @hidden */ export function isBech32(address: BytesLike): boolean { @@ -87,7 +87,8 @@ export function isEvmAddress(address: string): boolean { /** * Takes a Bech32 address and returns the byte data - * + * @deprecated + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @hidden */ export function getBytesFromBech32(address: Bech32Address): Uint8Array { @@ -96,7 +97,8 @@ export function getBytesFromBech32(address: Bech32Address): Uint8Array { /** * Converts a Bech32 address string into B256 - * + * @deprecated + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @hidden */ export function toB256(address: Bech32Address): B256Address { diff --git a/packages/errors/src/error-codes.ts b/packages/errors/src/error-codes.ts index 346526f5636..21d8e42ee6a 100644 --- a/packages/errors/src/error-codes.ts +++ b/packages/errors/src/error-codes.ts @@ -27,7 +27,7 @@ export enum ErrorCode { // address /** * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. */ INVALID_BECH32_ADDRESS = 'invalid-bech32-address', diff --git a/packages/interfaces/src/index.ts b/packages/interfaces/src/index.ts index 8282ec7676d..ef6c0a6b066 100644 --- a/packages/interfaces/src/index.ts +++ b/packages/interfaces/src/index.ts @@ -10,7 +10,7 @@ // #region bech32-1 /** * @deprecated - * The `bech32Address` is now deprecated. Please migrate to `toB256` as this will be the standard going forward. + * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. */ export type Bech32Address = `fuel${string}`; // #endregion bech32-1 From 33607a9305166b2c7a1fedc80a9cd09528cedb64 Mon Sep 17 00:00:00 2001 From: chad Date: Tue, 24 Sep 2024 21:20:42 -0500 Subject: [PATCH 5/7] docs: update READMEs --- CONTRIBUTING.md | 2 +- .../docs/src/guide/contracts/managing-deployed-contracts.md | 2 +- apps/docs/src/guide/types/address.md | 2 +- apps/docs/src/guide/types/bech32.md | 2 +- apps/docs/src/guide/utilities/address-conversion.md | 6 +++--- packages/address/README.md | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 933549847c4..96184f75393 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -168,7 +168,7 @@ The e2e test can be found at: The Bech32 address of this wallet is `fuel1x33ajpj0jy5p2wcqqu45e32r75zrwfeh6hwqfv5un670rv4p0mns58enjg`. This address can be funded via the [faucet](https://faucet-testnet.fuel.network/). > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). If you want to run an e2e test locally, you can provide your own wallet address and private key. For obvious security reasons, the private key should not be shared. diff --git a/apps/docs/src/guide/contracts/managing-deployed-contracts.md b/apps/docs/src/guide/contracts/managing-deployed-contracts.md index 4afa3735e15..489356ba201 100644 --- a/apps/docs/src/guide/contracts/managing-deployed-contracts.md +++ b/apps/docs/src/guide/contracts/managing-deployed-contracts.md @@ -9,7 +9,7 @@ The `contractId` property from the [`Contract`](../../api/Program/Contract.md) c The [`Address`](../../api/Address/Address.md) class wraps all methods from the [`AbstractAddress`](../../api/Interfaces/AbstractAddress.md) class and adds a single property: `bech32Address`. This property is a string encoded in [`Bech32`](../types/bech32.md) format, recognizable by the human-readable prefix `fuel` followed by the separator `1`. > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). When you log the `contractId` property of an instantiated Contract using `console.log`, the output appears as follows: diff --git a/apps/docs/src/guide/types/address.md b/apps/docs/src/guide/types/address.md index 2d5cd42e2b0..fffc7d68d57 100644 --- a/apps/docs/src/guide/types/address.md +++ b/apps/docs/src/guide/types/address.md @@ -25,7 +25,7 @@ To create an [`Address`](../../api/Address/Address.md) from a `Bech32` address, <<< @/../../docs-snippets/src/guide/types/address.test.ts#address-2{ts:line-numbers} > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). ### From a Public Key diff --git a/apps/docs/src/guide/types/bech32.md b/apps/docs/src/guide/types/bech32.md index 245dee931f6..c331434e644 100644 --- a/apps/docs/src/guide/types/bech32.md +++ b/apps/docs/src/guide/types/bech32.md @@ -1,7 +1,7 @@ # `Bech32` > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). The SDK uses the `Bech32` type as the core property of the [`Address`](../../api/Address/Address.md) class, specifically through the `bech32Address` property. diff --git a/apps/docs/src/guide/utilities/address-conversion.md b/apps/docs/src/guide/utilities/address-conversion.md index 0edb61ddc95..54a3a0eec5c 100644 --- a/apps/docs/src/guide/utilities/address-conversion.md +++ b/apps/docs/src/guide/utilities/address-conversion.md @@ -7,7 +7,7 @@ The Fuel Network uses the [`Bech32`](../types/bech32.md) address format for its <<< @/../../docs-snippets/src/guide/types/bech32.test.ts#addresses-1{ts:line-numbers} > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). However, a hexlified [Bits256](../types/bits256.md) (hex) is another common address format; an example can be seen below: @@ -31,7 +31,7 @@ By instantiating an [`Address`](../../api/Address/Address.md), we can validate a <<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-5{ts:line-numbers} -Or, if you'd prefer to use utility functions directly for validation and conversion, you can use `isBech32` and B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details): +Or, if you'd prefer to use utility functions directly for validation and conversion, you can use `isBech32` and `toB256`: <<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-6{ts:line-numbers} @@ -47,7 +47,7 @@ And by using the `isB256` and `toBech32` utilities: ## Converting a Contract ID -The Contract `id` property has the [`AbstractAddress`](../types/address.md#abstractaddress-class) type. Therefore, it can be converted using the [`Address`](../../api/Address/Address.md) class functions such as `toAddress` and B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details): +The Contract `id` property has the [`AbstractAddress`](../types/address.md#abstractaddress-class) type. Therefore, it can be converted using the [`Address`](../../api/Address/Address.md) class functions such as `toAddress` and `toB256`: <<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-2{ts:line-numbers} diff --git a/packages/address/README.md b/packages/address/README.md index 934de637a9a..3db33c1d907 100644 --- a/packages/address/README.md +++ b/packages/address/README.md @@ -5,7 +5,7 @@ This module contains the utilities for encoding and decoding address and contract ids between Bech32 and other address formats. > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to hexadecimals like `0x..`. +> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). # Table of contents From 5b81dd644483ce0443dda35ad8417bf351c2b171 Mon Sep 17 00:00:00 2001 From: chad Date: Wed, 25 Sep 2024 21:20:09 -0500 Subject: [PATCH 6/7] chore: update deprecated methods + notice --- CONTRIBUTING.md | 2 +- apps/docs/src/guide/types/address.md | 2 +- apps/docs/src/guide/types/bech32.md | 2 +- .../src/guide/utilities/address-conversion.md | 2 +- packages/address/README.md | 2 +- packages/address/src/address.ts | 22 +++++-------------- packages/address/src/utils.ts | 8 +++---- packages/errors/src/error-codes.ts | 2 +- 8 files changed, 15 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 96184f75393..ec41d5007af 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -168,7 +168,7 @@ The e2e test can be found at: The Bech32 address of this wallet is `fuel1x33ajpj0jy5p2wcqqu45e32r75zrwfeh6hwqfv5un670rv4p0mns58enjg`. This address can be funded via the [faucet](https://faucet-testnet.fuel.network/). > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). +> `Bech32` addresses like `fuel1..` are now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) If you want to run an e2e test locally, you can provide your own wallet address and private key. For obvious security reasons, the private key should not be shared. diff --git a/apps/docs/src/guide/types/address.md b/apps/docs/src/guide/types/address.md index fffc7d68d57..37a7af2a80a 100644 --- a/apps/docs/src/guide/types/address.md +++ b/apps/docs/src/guide/types/address.md @@ -25,7 +25,7 @@ To create an [`Address`](../../api/Address/Address.md) from a `Bech32` address, <<< @/../../docs-snippets/src/guide/types/address.test.ts#address-2{ts:line-numbers} > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). +> `Bech32` addresses like `fuel1..` are now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) ### From a Public Key diff --git a/apps/docs/src/guide/types/bech32.md b/apps/docs/src/guide/types/bech32.md index c331434e644..48b4838fb5f 100644 --- a/apps/docs/src/guide/types/bech32.md +++ b/apps/docs/src/guide/types/bech32.md @@ -1,7 +1,7 @@ # `Bech32` > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). +> `Bech32` addresses like `fuel1..` are now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) The SDK uses the `Bech32` type as the core property of the [`Address`](../../api/Address/Address.md) class, specifically through the `bech32Address` property. diff --git a/apps/docs/src/guide/utilities/address-conversion.md b/apps/docs/src/guide/utilities/address-conversion.md index 54a3a0eec5c..7fcc3a3464d 100644 --- a/apps/docs/src/guide/utilities/address-conversion.md +++ b/apps/docs/src/guide/utilities/address-conversion.md @@ -7,7 +7,7 @@ The Fuel Network uses the [`Bech32`](../types/bech32.md) address format for its <<< @/../../docs-snippets/src/guide/types/bech32.test.ts#addresses-1{ts:line-numbers} > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). +> `Bech32` addresses like `fuel1..` are now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) However, a hexlified [Bits256](../types/bits256.md) (hex) is another common address format; an example can be seen below: diff --git a/packages/address/README.md b/packages/address/README.md index 3db33c1d907..73b0cb482f7 100644 --- a/packages/address/README.md +++ b/packages/address/README.md @@ -5,7 +5,7 @@ This module contains the utilities for encoding and decoding address and contract ids between Bech32 and other address formats. > [!NOTE] Note -> `Bech32` addresses like `fuel1..` are now deprecated; please switch to B256 format, for more details see [here](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256). +> `Bech32` addresses like `fuel1..` are now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) # Table of contents diff --git a/packages/address/src/address.ts b/packages/address/src/address.ts index 66c6d0b80aa..5e5b8defcfa 100644 --- a/packages/address/src/address.ts +++ b/packages/address/src/address.ts @@ -49,7 +49,7 @@ export default class Address extends AbstractAddress { /** * Returns the `bech32Address` property * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Type `Bech32Address` is now deprecated, as is this property. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @returns The `bech32Address` property */ toAddress(): Bech32Address { @@ -58,8 +58,6 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property to a 256 bit hash string - * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property as a 256 bit hash string */ toB256(): B256Address { @@ -68,8 +66,6 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property to a byte array - * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property as a byte array */ toBytes(): Uint8Array { @@ -77,9 +73,7 @@ export default class Address extends AbstractAddress { } /** - * Converts - * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Converts the `bech32Address` property to a 256 bit hash string * @returns The `bech32Address` property as a 256 bit hash string */ toHexString(): B256Address { @@ -97,9 +91,7 @@ export default class Address extends AbstractAddress { /** * Converts and returns the `bech32Address` property as a string - * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. - * @returns The `bech32Address` property as a string + * @returns The `bech32Address` property as a JSON string */ toJSON(): string { return this.bech32Address; @@ -107,8 +99,6 @@ export default class Address extends AbstractAddress { /** * Clears the first 12 bytes of the `bech32Address` property and returns it as a `EvmAddress` - * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @returns The `bech32Address` property as an {@link EvmAddress | `EvmAddress`} */ toEvmAddress(): EvmAddress { @@ -131,8 +121,8 @@ export default class Address extends AbstractAddress { /** * Returns the value of the `bech32Address` property - *@deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * @deprecated + * Type `Bech32Address` is now deprecated, as is this property. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @returns The value of `bech32Address` property */ valueOf(): string { @@ -142,7 +132,7 @@ export default class Address extends AbstractAddress { /** * Compares this the `bech32Address` property to another for direct equality * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Type `Bech32Address` is now deprecated, as is this property. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @param other - Another address to compare against * @returns The equality of the comparison */ diff --git a/packages/address/src/utils.ts b/packages/address/src/utils.ts index 334cfab2e25..188e1670cec 100644 --- a/packages/address/src/utils.ts +++ b/packages/address/src/utils.ts @@ -24,7 +24,7 @@ export const FUEL_BECH32_HRP_PREFIX = 'fuel'; /** * Decodes a Bech32 address string into Decoded * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Type `Bech32Address` is now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @hidden */ export function fromBech32(address: Bech32Address): Decoded { @@ -34,7 +34,7 @@ export function fromBech32(address: Bech32Address): Decoded { /** * Converts a B256 address string into Bech32 * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Type `Bech32Address` is now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @hidden */ export function toBech32(address: B256Address): Bech32Address { @@ -47,7 +47,7 @@ export function toBech32(address: B256Address): Bech32Address { /** * Determines if a given string is Bech32 format * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Type `Bech32Address` is now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @hidden */ export function isBech32(address: BytesLike): boolean { @@ -97,8 +97,6 @@ export function getBytesFromBech32(address: Bech32Address): Uint8Array { /** * Converts a Bech32 address string into B256 - * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. * @hidden */ export function toB256(address: Bech32Address): B256Address { diff --git a/packages/errors/src/error-codes.ts b/packages/errors/src/error-codes.ts index 21d8e42ee6a..45f26a4cc08 100644 --- a/packages/errors/src/error-codes.ts +++ b/packages/errors/src/error-codes.ts @@ -27,7 +27,7 @@ export enum ErrorCode { // address /** * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Type `Bech32Address` is now deprecated, as is this constant. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) */ INVALID_BECH32_ADDRESS = 'invalid-bech32-address', From 8967ed703900cae67d54ee2666e7281a6128c196 Mon Sep 17 00:00:00 2001 From: chad Date: Wed, 25 Sep 2024 21:25:45 -0500 Subject: [PATCH 7/7] docs: update language --- packages/address/src/address.ts | 8 +++----- packages/address/src/utils.ts | 6 +++--- packages/interfaces/src/index.ts | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/address/src/address.ts b/packages/address/src/address.ts index 5e5b8defcfa..081b083bce1 100644 --- a/packages/address/src/address.ts +++ b/packages/address/src/address.ts @@ -26,7 +26,7 @@ export default class Address extends AbstractAddress { // #region address-2 /** * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Type `Bech32Address` is now deprecated, as is this property. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) */ readonly bech32Address: Bech32Address; // #endregion address-2 @@ -49,7 +49,7 @@ export default class Address extends AbstractAddress { /** * Returns the `bech32Address` property * @deprecated - * Type `Bech32Address` is now deprecated, as is this property. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) + * Type `Bech32Address` is now deprecated, as is this method. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @returns The `bech32Address` property */ toAddress(): Bech32Address { @@ -122,7 +122,7 @@ export default class Address extends AbstractAddress { /** * Returns the value of the `bech32Address` property * @deprecated - * Type `Bech32Address` is now deprecated, as is this property. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) + * Type `Bech32Address` is now deprecated, as is this method. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @returns The value of `bech32Address` property */ valueOf(): string { @@ -131,8 +131,6 @@ export default class Address extends AbstractAddress { /** * Compares this the `bech32Address` property to another for direct equality - * @deprecated - * Type `Bech32Address` is now deprecated, as is this property. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @param other - Another address to compare against * @returns The equality of the comparison */ diff --git a/packages/address/src/utils.ts b/packages/address/src/utils.ts index 188e1670cec..8123b22c8f9 100644 --- a/packages/address/src/utils.ts +++ b/packages/address/src/utils.ts @@ -24,7 +24,7 @@ export const FUEL_BECH32_HRP_PREFIX = 'fuel'; /** * Decodes a Bech32 address string into Decoded * @deprecated - * Type `Bech32Address` is now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) + * Type `Bech32Address` is now deprecated, as is this function. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @hidden */ export function fromBech32(address: Bech32Address): Decoded { @@ -34,7 +34,7 @@ export function fromBech32(address: Bech32Address): Decoded { /** * Converts a B256 address string into Bech32 * @deprecated - * Type `Bech32Address` is now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) + * Type `Bech32Address` is now deprecated, as is this function. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @hidden */ export function toBech32(address: B256Address): Bech32Address { @@ -47,7 +47,7 @@ export function toBech32(address: B256Address): Bech32Address { /** * Determines if a given string is Bech32 format * @deprecated - * Type `Bech32Address` is now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) + * Type `Bech32Address` is now deprecated, as is this function. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) * @hidden */ export function isBech32(address: BytesLike): boolean { diff --git a/packages/interfaces/src/index.ts b/packages/interfaces/src/index.ts index ef6c0a6b066..27eaf920eb2 100644 --- a/packages/interfaces/src/index.ts +++ b/packages/interfaces/src/index.ts @@ -10,7 +10,7 @@ // #region bech32-1 /** * @deprecated - * The `bech32Address` is now deprecated. Please migrate to B256 format (see https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256 for more details) as this will be the standard going forward. + * Type `Bech32Address` is now deprecated. Use `B256` addresses instead. ([help](https://docs.fuel.network/docs/specs/abi/argument-encoding/#b256)) */ export type Bech32Address = `fuel${string}`; // #endregion bech32-1