Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: isolate API docs #3237

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7c5d2ff
chore: isolate api docs
danielbate Oct 2, 2024
a9f2dca
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into db…
danielbate Oct 15, 2024
4517d9e
chore: fuels as dep for api docs
danielbate Oct 15, 2024
ade32cb
docs: update API links
danielbate Oct 15, 2024
f19ad21
chore: extend typedoc packages
danielbate Oct 15, 2024
38cfcfd
chore: remove API doc CI
danielbate Oct 15, 2024
3ded3a4
Merge branch 'master' into db/chore/isolate-api-docs
Dhaiwat10 Oct 23, 2024
e3c9f8a
update lockfile
Dhaiwat10 Oct 23, 2024
5c6e194
fix depcheck error
Dhaiwat10 Oct 23, 2024
f141651
add changeset
Dhaiwat10 Oct 23, 2024
513b325
add docs-api to knip ignore
Dhaiwat10 Oct 23, 2024
339279f
fix api doc link
Dhaiwat10 Oct 24, 2024
3f60973
re-enable old api docs
Dhaiwat10 Oct 29, 2024
62d7993
Merge branch 'master' into db/chore/isolate-api-docs
Dhaiwat10 Oct 29, 2024
c979c5f
revert `release.yaml` changes
Dhaiwat10 Oct 29, 2024
4d4f159
Merge branch 'db/chore/isolate-api-docs' of https://github.com/FuelLa…
Dhaiwat10 Oct 29, 2024
fcccfee
ignroe docs api media in md link lint
Dhaiwat10 Oct 29, 2024
84b1cb5
Merge branch 'master' into db/chore/isolate-api-docs
Torres-ssf Nov 9, 2024
638a0cc
Merge branch 'master' into db/chore/isolate-api-docs
Torres-ssf Nov 9, 2024
6a6647b
update lockfile
Dhaiwat10 Nov 19, 2024
f35f56a
fix link
Dhaiwat10 Nov 19, 2024
1eae1f1
update lockfile
Dhaiwat10 Nov 19, 2024
48db4f5
fix browser tests CI
Dhaiwat10 Nov 19, 2024
c07d4cb
test: import random bytes from fuels
danielbate Nov 19, 2024
c54e59c
chore: regen lock
danielbate Nov 19, 2024
f9dcdb8
chore: rebuild
danielbate Nov 19, 2024
e0a106e
chore: rebuild
danielbate Nov 19, 2024
8d6858c
chore: rebuild
danielbate Nov 20, 2024
6b442dc
chore: rebuild
danielbate Nov 20, 2024
b32bc96
Merge branch 'db/chore/isolate-api-docs' of github.com:FuelLabs/fuels…
petertonysmith94 Nov 20, 2024
d4273af
Merge branch 'master' of github.com:FuelLabs/fuels-ts into db/chore/i…
petertonysmith94 Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"template-nextjs",
"create-fuels-counter-guide",
"demo-wallet-sdk-react",
"template-vite"
"template-vite",
"docs-api"
]
}
4 changes: 4 additions & 0 deletions .changeset/fluffy-lizards-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: isolate API docs
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
if: startsWith(env.LAST_COMMIT_MSG, 'ci(release):') && env.RELEASE_VERSION_HIGHER_THAN_LATEST == 'true'
run: echo SHOULD_DEPLOY_DOCS=true >> $GITHUB_ENV

- name: Checkout API Docs
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
- name: Checkout API docs
if: env.SHOULD_DEPLOY_DOCS == 'true'
uses: actions/checkout@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"templates/**",
"/apps/docs-snippets/**",
"/apps/docs-snippets2/**/*.test.ts",
"apps/create-fuels-counter-guide/**"
"apps/create-fuels-counter-guide/**",
"/apps/docs-api/*"
],
"ignoreDependencies": [
"autocannon",
Expand Down
1 change: 1 addition & 0 deletions apps/docs-api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/api
17 changes: 17 additions & 0 deletions apps/docs-api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"private": true,
"name": "docs-api",
"version": "0.0.1",
"description": "",
"type": "module",
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
"scripts": {
"build": "typedoc"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"fuels": "workspace:*",
"typedoc": "^0.26.3"
}
}
26 changes: 26 additions & 0 deletions apps/docs-api/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPointStrategy": "packages",
"entryPoints": [
"../../packages/abi-coder",
"../../packages/abi-typegen",
"../../packages/address",
"../../packages/interfaces",
"../../packages/predicate",
"../../packages/account",
"../../packages/program",
"../../packages/contract",
"../../packages/script",
"../../packages/utils",
"../../packages/crypto",
"../../packages/errors",
"../../packages/hasher",
"../../packages/math",
"../../packages/transactions"
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
],
"out": "src/api",
"navigationLinks": {
"Docs": "https://docs.fuel.network/docs/intro/what-is-fuel/",
"GitHub": "https://github.com/FuelLabs/fuels-ts"
}
}
6 changes: 3 additions & 3 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"markdown-it": "^14.1.0",
"nodemon": "^3.1.7",
"replace": "^1.2.2",
"typedoc": "^0.26.3",
"typedoc-plugin-merge-modules": "^6.0.2",
"vitepress-plugin-search": "1.0.4-alpha.22",
"vitepress": "1.3.4",
"vue": "^3.5.12"
"vue": "^3.5.12",
"typedoc": "^0.26.3",
"typedoc-plugin-merge-modules": "^6.0.2"
}
}
4 changes: 2 additions & 2 deletions apps/docs/src/guide/contracts/contract-balance.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Contract Balance

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.
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](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_program.Contract.html) class, which allows you to check a contract's available balance.

## The `getBalance` Method

The [`Contract.getBalance`](../../api/Program/Contract.md#getbalance) method retrieves the available balance of a specific asset on your contract. This method is particularly useful for determining the remaining balance after sending assets to a contract and executing contract calls.
The [`Contract.getBalance`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_program.Contract.html) method retrieves the available balance of a specific asset on your contract. This method is particularly useful for determining the remaining balance after sending assets to a contract and executing contract calls.

It is important to note that this method returns the total available contract balance, regardless of how often assets have been sent to it or spent.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/guide/contracts/cost-estimation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Estimating Contract Call Cost

The [`FunctionInvocationScope.getTransactionCost`](../../api/Program/FunctionInvocationScope.md#gettransactioncost) method allows you to estimate the cost of a specific contract call. The return type, `TransactionCost`, is an object containing relevant information for the estimation:
The [`FunctionInvocationScope.getTransactionCost`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_program.FunctionInvocationScope.html#getTransactionCost) method allows you to estimate the cost of a specific contract call. The return type, `TransactionCost`, is an object containing relevant information for the estimation:

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ To interact with a deployed contract using the SDK without redeploying it, you o

## Contract ID

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.
The `contractId` property from the [`Contract`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_program.Contract.html) class is of type [`AbstractAddress`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_interfaces.AbstractAddress.html), an abstract class that is exclusively extended by the [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) class.

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`.
The [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) class wraps all methods from the [`AbstractAddress`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_interfaces.AbstractAddress.html) 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`.

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

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

<<< @/../../docs-snippets2/src/contracts/managing-deployed-contracts.ts#with-contractId{ts:line-numbers}

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.
The previous example assumes that you have a [`Contract`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_program.Contract.html) 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.

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

The process of instantiating a [`Contract`](../../api/Program/Contract.md) remains the same when using a contract ID of type `b256`:
The process of instantiating a [`Contract`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_program.Contract.html) remains the same when using a contract ID of type `b256`:

<<< @/../../docs-snippets2/src/contracts/managing-deployed-contracts.ts#with-b256{ts:line-numbers}
2 changes: 1 addition & 1 deletion apps/docs/src/guide/contracts/using-different-wallets.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Making Calls with Different Wallets or Providers

This guide demonstrates how to make contract calls using different wallets and providers by passing either an [`Account`](../../api/Account/Account.md) or a [`Provider`](../../api/Account/Provider.md) to the contract on instantiation.
This guide demonstrates how to make contract calls using different wallets and providers by passing either an [`Account`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Account.html) or a [`Provider`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Provider.html) to the contract on instantiation.

## Changing Wallets

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Custom Transactions From Contract Calls

In the previous example we demonstrated how you can instantiate a [`ScriptTransactionRequest`](../../api/Account/ScriptTransactionRequest.md) to customize and build out a more complex transaction via a script. The same can be done using contracts, but this allows us to utilize functions available in the contract and access on-chain state. Allowing us to harness all of the power from an invocation scope and a transaction request.
In the previous example we demonstrated how you can instantiate a [`ScriptTransactionRequest`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.ScriptTransactionRequest.html) to customize and build out a more complex transaction via a script.

This cookbook demonstrates how we can utilize a contract call to build out a custom transaction, allowing us to update on-chain state and transfer assets to a recipient address.

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/guide/cookbook/custom-transactions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Custom Transactions

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/Account/ScriptTransactionRequest.md). This class allows you to a append multiple program types and assets to a single transaction.
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`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.ScriptTransactionRequest.html).

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

<<< @/../../docs-snippets2/sway/script-transfer-to-contract/src/main.sw#custom-transactions-1{rust:line-numbers}

This script can be executed by creating a [`ScriptTransactionRequest`](../../api/Account/ScriptTransactionRequest.md), appending the resource and contract inputs/outputs and then sending the transaction, as follows:
This script can be executed by creating a [`ScriptTransactionRequest`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_), appending the resource and contract inputs/outputs and then sending the transaction, as follows:

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

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/src/guide/errors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Check that the arguments supplied to the function match the required type.

### `ACCOUNT_REQUIRED`

When an [`Account`](../../api/Account/Account.md) is required for an operation. This will usually be in the form of a [`Wallet`](../wallets/index.md).
When an [`Account`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Account.html) is required for an operation.

It could be caused during the deployments of contracts when an account is required to sign the transaction. This can be resolved by following the deployment guide [here](../contracts/deploying-contracts.md).

Expand Down Expand Up @@ -214,7 +214,7 @@ Check the status received is within `TransactionStatus`.

When the transaction type from the Fuel Node is _not_ supported.

The type is within [`TransactionType`](../../api/Account/TransactionType.md).
The type is within [`TransactionType`](https://fuels-ts-docs-api.vercel.app/enums/_fuel_ts_account.TransactionType.html).

### `INVALID_TTL`

Expand Down Expand Up @@ -256,7 +256,7 @@ Ensure that a connector has been supplied to the `Account` or `Wallet`.

A provider is missing when it's required for a given operation.

It could be caused by the provider not being set for either an [`Account`](../../api/Account/index.md) or a [`Wallet`](../wallets/index.md) - use the `connect` method to attach a provider.
It could be caused by the provider not being set for either an [`Account`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html) or a [`Wallet`](../wallets/index.md) - use the `connect` method to attach a provider.

### `MISSING_REQUIRED_PARAMETER`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ After compiling, you will obtain the binary of the predicate and its JSON ABI (A

<<< @/../../docs-snippets2/src/predicates/instantiation/simple.ts#predicate-simple-2{ts:line-numbers}

The created [`Predicate`](../../api/Account/Predicate.md) instance, among other things, has three important properties: the predicate `bytes` (byte code), the `chainId`, and the predicate `address`.
The created [`Predicate`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Predicate.html) instance, among other things, has three important properties: the predicate `bytes` (byte code), the `chainId`, and the predicate `address`.

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Once the predicate resolves with a return value `true` based on its predefined c

---

In a similar approach, you can use the `createTransfer` method, which returns a [`ScriptTransactionRequest`](../../api/Account/ScriptTransactionRequest.md). Then, we can submit this transaction request by calling the `sendTransaction` method.
In a similar approach, you can use the `createTransfer` method, which returns a [`ScriptTransactionRequest`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.ScriptTransactionRequest.html).

The following example, we are pre-staging a transaction and therefore we are able to know the transaction ID without actually submitting the transaction.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/guide/provider/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Provider

The [`Provider`](../../api/Account/Provider.md) lets you connect to a Fuel node ([_*local*_](../getting-started/connecting-to-a-local-node.md) or [_*external*_](../getting-started/connecting-to-testnet.md)) and interact with it, encapsulating common client operations in the SDK. Those operations include querying the blockchain for network, block, and transaction-related info (and [more](../../api/Account/Provider.md)), as well as sending [transactions](../transactions/index.md) to the blockchain.
The [`Provider`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Provider.html) lets you connect to a Fuel node ([_*local*_](../getting-started/connecting-to-a-local-node.md) or [_*external*_](../getting-started/connecting-to-testnet.md)) and interact with it, encapsulating common client operations in the SDK. Those operations include querying the blockchain for network, block, and transaction-related info (and [more](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Provider.html)), as well as sending [transactions](../transactions/index.md) to the blockchain.

All higher-level abstractions (e.g. [`Wallet`](../wallets/index.md), [`Contract`](../contracts/index.md)) that interact with the blockchain go through the `Provider`, so it's used for various actions like getting a wallet's balance, deploying contracts, querying their state, etc.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/guide/provider/provider-options.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Provider Options

You can provide various [options](../../api/Account/index.md#provideroptions) on `Provider` instantiation to modify its behavior.
You can provide various [options](https://fuels-ts-docs-api.vercel.app/types/_fuel_ts_account.ProviderOptions.html) on `Provider` instantiation to modify its behavior.

### `retryOptions`

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/guide/testing/launching-a-test-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ To simplify testing in isolation, we provide a utility called `launchTestNode`.

It allows you to spin up a short-lived `fuel-core` node, set up a custom provider, wallets, deploy contracts, and much more in one go.

For usage information for `launchTestNode` including it's inputs, outputs and options, please check the [API reference](../../api/Contract/test-utils-index.md#launchtestnode).
For usage information for `launchTestNode` including it's inputs, outputs and options, please check the [API reference](https://fuels-ts-docs-api.vercel.app/functions/_fuel_ts_contract.test_utils.launchTestNode.html).

## Explicit Resource Management

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/guide/testing/test-node-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This reference describes all the options of the [`launchTestNode`](./launching-a

<<< @/../../docs-snippets2/src/testing/launching-a-test-node.ts#options{ts:line-numbers}

Check out the [API reference](../../api/Contract/LaunchTestNodeOptions.md) for usage information on the Test Node Options.
Check out the [API reference](https://fuels-ts-docs-api.vercel.app/interfaces/_fuel_ts_contract.test_utils.LaunchTestNodeOptions.html) for usage information on the Test Node Options.

## `walletsConfig`

Expand Down Expand Up @@ -44,7 +44,7 @@ Used to deploy contracts on the node the `launchTestNode` utility launches. It's

- `factory`: contract factory class outputted by `pnpm fuels typegen`.
- `walletIndex`: the index of the wallets generated by [`walletsConfig`](./test-node-options.md#walletsconfig) that you want to deploy the contract with.
- `options`: options for [contract deployment](../contracts/deploying-contracts.md#2-contract-deployment) that get passed to the [`ContractFactory.deploy`](../../api/Contract/ContractFactory.md#deploy) method.
- `options`: options for [contract deployment](../contracts/deploying-contracts.md#2-contract-deployment) that get passed to the [`ContractFactory.deploy`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_contract.index.ContractFactory.html#deploy) method.

## `nodeOptions`

Expand Down
Loading
Loading