Skip to content

Commit 84cab17

Browse files
authored
docs: add API ref links (FuelLabs#1664)
1 parent 261c641 commit 84cab17

18 files changed

+60
-53
lines changed

.changeset/silent-schools-accept.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

apps/docs/spell-check-custom-words.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,9 @@ cryptographically
288288
Config
289289
config
290290
configs
291-
WSL
291+
WSL
292+
WalletUnlocked
293+
WalletLocked
294+
AbstractAddress
295+
ContractFactory
296+
ScriptTransactionRequest

apps/docs/src/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ A Provider is a Class that provides an abstraction for a connection to a Fuel no
1212

1313
## Wallet and signer
1414

15-
A `Wallet` is a Class with direct or indirect access to a private key. You can use a `Wallet` to sign messages and transactions to authorize the network to charge your account to perform operations. The terms wallet and signer in the SDK are often used interchangeably, but, technically, a `Signer` enables the signing of transactions and messages; the `Wallet` implements the `Signer` functionality.
15+
A [`Wallet`](./api/Wallet/Wallet.md) is a Class with direct or indirect access to a private key. You can use a [`Wallet`](./api/Wallet/Wallet.md) to sign messages and transactions to authorize the network to charge your account to perform operations. The terms wallet and signer in the SDK are often used interchangeably, but, technically, a `Signer` enables the signing of transactions and messages; the [`Wallet`](./api/Wallet/Wallet.md) implements the `Signer` functionality.

apps/docs/src/guide/addresses/conversion.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This guide demonstrates how to convert between address formats and Sway Standard
44

55
## From `Bech32` to `b256`
66

7-
By instantiating an `Address`, we can validate a `Bech32` address and easily convert it to a `b256`:
7+
By instantiating an [`Address`](../../api/Address/Address.md), we can validate a `Bech32` address and easily convert it to a `b256`:
88

99
<<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-5{ts:line-numbers}
1010

@@ -14,7 +14,7 @@ Or, if you'd prefer to use utility functions directly for validation and convers
1414

1515
## From `b256` to `Bech32`
1616

17-
In a similar fashion, we have both class functions on the `Address` and utilities available for `b256` validation and conversion:
17+
In a similar fashion, we have both class functions on the [`Address`](../../api/Address/Address.md) and utilities available for `b256` validation and conversion:
1818

1919
<<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-7{ts:line-numbers}
2020

@@ -24,18 +24,18 @@ And by using the `isB256` and `toBech32` utilities:
2424

2525
## Converting a Contract ID
2626

27-
The Contract `id` property has the [`AbstractAddress`](../types/address#abstractaddress-class) type. Therefore, it can be converted using the `Address` class functions such as `toAddress` and `toB256`:
27+
The Contract `id` property has the [`AbstractAddress`](../types/address#abstractaddress-class) type. Therefore, it can be converted using the [`Address`](../../api/Address/Address.md) class functions such as `toAddress` and `toB256`:
2828

2929
<<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-2{ts:line-numbers}
3030

3131
## Converting a Wallet Address
3232

33-
Similarly, the Wallet `address` property is also of type [`AbstractAddress`](../types/address#abstractaddress-class) and can therefore use the same `Address` class functions for conversion:
33+
Similarly, the Wallet `address` property is also of type [`AbstractAddress`](../types/address#abstractaddress-class) and can therefore use the same [`Address`](../../api/Address/Address.md) class functions for conversion:
3434

3535
<<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-3{ts:line-numbers}
3636

3737
## Converting an Asset ID
3838

39-
[Asset IDs](../types/asset-id.md) are a wrapped [b256](../types/bits256.md) value. The following example shows how to create an `Address` from a `b256` type:
39+
[Asset IDs](../types/asset-id.md) are a wrapped [b256](../types/bits256.md) value. The following example shows how to create an [`Address`](../../api/Address/Address.md) from a `b256` type:
4040

4141
<<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-4{ts:line-numbers}

apps/docs/src/guide/contracts/calls-with-different-wallets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Making Calls with Different Wallets or Providers
22

3-
This guide demonstrates how to make contract calls using different wallets and providers by passing either an `Account` or a `Provider` to the contract on instantiation.
3+
This guide demonstrates how to make contract calls using different wallets and providers by passing either an [`Account`](../../api/Wallet/Account.md) or a [`Provider`](../../api/Providers/Provider.md) to the contract on instantiation.
44

55
## Changing Wallets
66

apps/docs/src/guide/contracts/contract-balance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Contract Balance
22

3-
When working with contracts, it's crucial to be aware of the available contract balance of an asset while paying for costly operations. This guide will explain the `getBalance` method in the `Contract` class, which allows you to check a contract's available balance.
3+
When working with contracts, it's crucial to be aware of the available contract balance of an asset while paying for costly operations. This guide will explain the `getBalance` method in the [Contract](../../api/Program/Contract.md) class, which allows you to check a contract's available balance.
44

55
## The `getBalance` Method
66

7-
The `Contract` class includes a method called `getBalance` that retrieves the available balance of a specific asset for a contract. This method is particularly useful for determining the remaining balance after sending assets to a contract and executing contract calls.
7+
The [`Contract`](../../api/Program/Contract.md) class includes a method called `getBalance` that retrieves the available balance of a specific asset for a contract. This method is particularly useful for determining the remaining balance after sending assets to a contract and executing contract calls.
88

99
<<< @/../../../packages/program/src/contract.ts#contract-balance-1{ts:line-numbers}
1010

apps/docs/src/guide/contracts/cost-estimation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Estimating Contract Call Cost
22

3-
The `getTransactionCost` function provided by the `provider` allows you to estimate the cost of a specific contract call. The return type, `TransactionCost`, is an object containing relevant information for the estimation:
3+
The `getTransactionCost` function provided by the [Provider](../../api/Providers/Provider.md) allows you to estimate the cost of a specific contract call. The return type, `TransactionCost`, is an object containing relevant information for the estimation:
44

55
<<< @/../../../packages/providers/src/provider.ts#cost-estimation-1{ts:line-numbers}
66

apps/docs/src/guide/contracts/deploying-contracts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Load the contract bytecode and JSON ABI, generated from the Sway source, into th
2727

2828
## 4. Deploying the Contract
2929

30-
Initialize a `ContractFactory` with the bytecode, ABI, and wallet. Deploy the contract and use its methods.
30+
Initialize a [`ContractFactory`](../../api/Contract/ContractFactory.md) with the bytecode, ABI, and wallet. Deploy the contract and use its methods.
3131

3232
<<< @/../../docs-snippets/src/guide/contracts/deploying-contracts.test.ts#contract-setup-3{ts:line-numbers}
3333

apps/docs/src/guide/contracts/managing-deployed-contracts.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ To interact with a deployed contract using the SDK without redeploying it, you o
44

55
## Contract ID
66

7-
The `contractId` property from the `Contract` class is of type `AbstractAddress`, an abstract class that is exclusively extended by the `Address` class.
7+
The `contractId` property from the [`Contract`](../../api/Program/Contract.md) class is of type [`AbstractAddress`](../../api/Interfaces/AbstractAddress.md), an abstract class that is exclusively extended by the [`Address`](../../api/Address/Address.md) class.
88

9-
The `Address` class wraps all methods from the `AbstractAddress` 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`.
9+
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`.
1010

1111
When you log the `contractId` property of an instantiated Contract using `console.log`, the output appears as follows:
1212

@@ -22,10 +22,10 @@ If you have already an instantiated and deployed contract in hands you can creat
2222

2323
<<< @/../../docs-snippets/src/guide/contracts/managing-deployed-contracts.test.ts#managing-deployed-contracts-1{ts:line-numbers}
2424

25-
The previous example assumes that you have a `Contract` instance at hand. However, some Fuel tools and Sway use the [`b256`](../types/bits256.md) type format, a hex-encoded string-like type, for contract IDs.
25+
The previous example assumes that you have a [`Contract`](../../api/Program/Contract.md) instance at hand. However, some Fuel tools and Sway use the [`b256`](../types/bits256.md) type format, a hex-encoded string-like type, for contract IDs.
2626

2727
You might have this format instead, for example, if you have deployed your contract with `forc deploy`.
2828

29-
The process of instantiating a `Contract` remains the same when using a contract ID of type `b256`:
29+
The process of instantiating a [`Contract`](../../api/Program/Contract.md) remains the same when using a contract ID of type `b256`:
3030

3131
<<< @/../../docs-snippets/src/guide/contracts/managing-deployed-contracts.test.ts#managing-deployed-contracts-2{ts:line-numbers}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Custom Transactions
22

3-
There may be scenarios where you need to build out transactions that involve multiple program types and assets; this can be done by instantiating a `ScriptTransactionRequest`. This class allows you to a append multiple program types and assets to a single transaction.
3+
There may be scenarios where you need to build out transactions that involve multiple program types and assets; this can be done by instantiating a [`ScriptTransactionRequest`](../../api/Providers/ScriptTransactionRequest.md). This class allows you to a append multiple program types and assets to a single transaction.
44

55
Consider the following script that transfers multiple assets to a contract:
66

77
<<< @/../../docs-snippets/test/fixtures/forc-projects/script-transfer-to-contract/src/main.sw#custom-transactions-1{ts:line-numbers}
88

9-
This script can be executed by creating a `ScriptTransactionRequest`, appending the resource and contract inputs/outputs and then sending the transaction, as follows:
9+
This script can be executed by creating a [`ScriptTransactionRequest`](../../api/Providers/ScriptTransactionRequest.md), appending the resource and contract inputs/outputs and then sending the transaction, as follows:
1010

1111
<<< @/../../docs-snippets/src/guide/scripts/script-custom-transaction.test.ts#custom-transactions-2{ts:line-numbers}

apps/docs/src/guide/predicates/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ After compiling, you will obtain the binary of the predicate and its JSON ABI (A
3131

3232
<<< @/../../docs-snippets/src/guide/predicates/index.test.ts#predicate-index-2{ts:line-numbers}
3333

34-
The created `Predicate` instance, among other things, has three important properties: the predicate `bytes` (byte code), the `chainId`, and the predicate `address`.
34+
The created [`Predicate`](../../api/Predicate/Predicate.md) instance, among other things, has three important properties: the predicate `bytes` (byte code), the `chainId`, and the predicate `address`.
3535

3636
This address, generated from the byte code, corresponds to the Pay-to-Script-Hash (P2SH) address used in Bitcoin.
3737

apps/docs/src/guide/predicates/send-and-spend-funds-from-predicates.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ With the predicate instantiated, we can transfer funds to its address. This requ
2626

2727
Now that our predicate holds funds, we can use it to validate a transaction.
2828

29-
First, we need to set its data. Note that the `main` function in our predicate example requires a parameter called `input_address` of type `b256`. We achieve this using the `Predicate` class method `setData`.
29+
First, we need to set its data. Note that the `main` function in our predicate example requires a parameter called `input_address` of type `b256`. We achieve this using the [`Predicate`](../../api/Predicate/Predicate.md) class method `setData`.
3030

3131
<<< @/../../docs-snippets/src/guide/predicates/send-and-spend-funds-from-predicates.test.ts#send-and-spend-funds-from-predicates-4{ts:line-numbers}
3232

@@ -40,7 +40,7 @@ Once the predicate resolves with a return value `true` based on its predefined c
4040

4141
---
4242

43-
In a similar approach, you can use the `createTransfer` method, which returns a `ScriptTransactionRequest`. Then, we can submit this transaction request by calling the `sendTransaction` method.
43+
In a similar approach, you can use the `createTransfer` method, which returns a [`ScriptTransactionRequest`](../../api/Providers/ScriptTransactionRequest.md). Then, we can submit this transaction request by calling the `sendTransaction` method.
4444

4545
This can be useful if you need the transaction ID before actually submitting it to the node.
4646

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Providers
22

3-
An instance of the `Provider` class lets you connect to a Fuel node. It provides read-only access to the blockchain state. You can use this provider as-is or through a `Wallet` instance.
3+
An instance of the [`Provider`](../../api/Providers/Provider.md) class lets you connect to a Fuel node. It provides read-only access to the blockchain state. You can use this provider as-is or through a [`Wallet`](../../api/Wallet/Wallet.md) instance.
44

55
<<< @/../../../packages/providers/test/provider.test.ts#provider-definition{ts:line-numbers}

apps/docs/src/guide/types/address.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
# Address
22

3-
In Sway, the `Address` type serves as a type-safe wrapper around the primitive `b256` type. The SDK takes a different approach and has its own abstraction for the `Address` type.
3+
In Sway, the [`Address`](../../api/Address/Address.md) type serves as a type-safe wrapper around the primitive `b256` type. The SDK takes a different approach and has its own abstraction for the [Address](../../api/Address/Address.md) type.
44

5-
## `AbstractAddress` Class
5+
## [`AbstractAddress`](../../api/Interfaces/AbstractAddress.md) Class
66

7-
The SDK defines the `AbstractAddress` class, which provides a set of utility functions for easy manipulation and conversion between address formats.
7+
The SDK defines the [AbstractAddress](../../api/Interfaces/AbstractAddress.md) class, which provides a set of utility functions for easy manipulation and conversion between address formats.
88

99
<<< @/../../../packages/interfaces/src/index.ts#address-1{ts:line-numbers}
1010

1111
## Address Class
1212

13-
Besides conforming to the interface of the `AbstractAddress`, the `Address` also defines one property; `bech32Address`, which is of the [`Bech32`](./bech32.md) type.
13+
Besides conforming to the interface of the [`AbstractAddress`](../../api/Interfaces/AbstractAddress.md), the [`Address`](../../api/Address/Address.md) class also defines one property; `bech32Address`, which is of the [`Bech32`](./bech32.md) type.
1414

1515
<<< @/../../../packages/address/src/address.ts#address-2{ts:line-numbers}
1616

1717
## Creating an Address
1818

19-
Thanks to the utility functions provided by the `AbstractAddress` class, there are several ways to create an `Address` instance:
19+
Thanks to the utility functions provided by the [`AbstractAddress`](../../api/Interfaces/AbstractAddress.md) class, there are several ways to create an [`Address`](../../api/Address/Address.md) instance:
2020

2121
### From a `Bech32` Address
2222

23-
To create an `Address` from a `Bech32` address, use the following code snippet:
23+
To create an [`Address`](../../api/Address/Address.md) from a `Bech32` address, use the following code snippet:
2424

2525
<<< @/../../docs-snippets/src/guide/types/address.test.ts#address-2{ts:line-numbers}
2626

2727
### From a Public Key
2828

29-
To create an `Address` from a public key, use the following code snippet:
29+
To create an [`Address`](../../api/Address/Address.md) from a public key, use the following code snippet:
3030

3131
<<< @/../../docs-snippets/src/guide/types/address.test.ts#address-3{ts:line-numbers}
3232

3333
### From a 256-bit Address
3434

35-
To create an `Address` from a 256-bit address, use the following code snippet:
35+
To create an [`Address`](../../api/Address/Address.md) from a 256-bit address, use the following code snippet:
3636

3737
<<< @/../../docs-snippets/src/guide/types/address.test.ts#address-4{ts:line-numbers}
3838

3939
## Utility Functions
4040

41-
The `Address` class also provides some practical utility functions:
41+
The [`Address`](../../api/Address/Address.md) class also provides some practical utility functions:
4242

43-
1. `fromString`: Create a new `Address` from an ambiguous source that may be a `Bech32` or `B256` address:
43+
1. `fromString`: Create a new [`Address`](../../api/Address/Address.md) from an ambiguous source that may be a `Bech32` or `B256` address:
4444

4545
<<< @/../../docs-snippets/src/guide/types/address.test.ts#address-5{ts:line-numbers}
4646

47-
2. `fromDynamicInput`: Create a new `Address` when the address source is unknown:
47+
2. `fromDynamicInput`: Create a new [`Address`](../../api/Address/Address.md) when the address source is unknown:
4848

4949
<<< @/../../docs-snippets/src/guide/types/address.test.ts#address-6{ts:line-numbers}
5050

apps/docs/src/guide/types/bech32.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# `Bech32`
22

3-
The SDK uses the `Bech32` type as the core property of the `Address` class, specifically through the `bech32Address` property.
3+
The SDK uses the `Bech32` type as the core property of the [`Address`](../../api/Address/Address.md) class, specifically through the `bech32Address` property.
44

5-
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` class is constructed around the `Bech32` type.
5+
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.
66

77
You can read more about the `Bech32` type [here](https://thebitcoinmanual.com/articles/btc-bech32-address/).
88

apps/docs/src/guide/types/bits256.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ To convert between a `b256` hexlified string and a `Uint8Array`, you can use the
1616

1717
## Support from `Address` Class
1818

19-
A `b256` value is also supported as part of the `Address` class, providing seamless integration with other components of your application. To create an `Address` instance from a b256 value, use the `Address.fromB256()` method:
19+
A `b256` value is also supported as part of the [`Address`](../../api/Address/Address.md) class, providing seamless integration with other components of your application. To create an [`Address`](../../api/Address/Address.md) instance from a b256 value, use the `Address.fromB256()` method:
2020

2121
<<< @/../../docs-snippets/src/guide/types/bits256.test.ts#bits256-3{ts:line-numbers}

0 commit comments

Comments
 (0)