Skip to content

Commit

Permalink
chore: remove legacy API docs (#3416)
Browse files Browse the repository at this point in the history
* chore: remove typedoc builds

* chore: move docs links

* chore: remove API release

* chore: changeset

* fix: reintroduce return type

* chore: test docs hub integration

* chore: fix gititgnore

* chore: rebuild

* chore: remove temp docs hub validation branch

* chore: linting

* chore: rebuild

* chore: remove docs branch
  • Loading branch information
danielbate authored Nov 26, 2024
1 parent 1f010a8 commit d29e884
Show file tree
Hide file tree
Showing 35 changed files with 94 additions and 408 deletions.
4 changes: 4 additions & 0 deletions .changeset/calm-buttons-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: remove legacy API docs
22 changes: 0 additions & 22 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,28 +122,6 @@ 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
if: env.SHOULD_DEPLOY_DOCS == 'true'
uses: actions/checkout@v4
with:
ref: docs
fetch-depth: 0

- name: Generate and Push API Docs
if: env.SHOULD_DEPLOY_DOCS == 'true'
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git merge origin/$GITHUB_REF_NAME --no-edit
pnpm install
pnpm build
rm -f apps/docs/.gitignore
git add apps/docs/src/api/
git add apps/docs/.typedoc/api-links.json
git commit -m "docs: API docs - ${{ env.RELEASE_VERSION }}"
git push
git restore apps/docs/.gitignore
- name: Update docs (nightly)
if: github.ref_name == 'master' && env.SHOULD_DEPLOY_DOCS == 'true'
uses: benc-uk/workflow-dispatch@v1
Expand Down
6 changes: 1 addition & 5 deletions apps/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
.vitepress/cache
.vitepress/.temp

.typedoc/api-links.json

src/api

src/typegend
src/guide/**/*.test.ts
.fuels/
.fuels/
10 changes: 0 additions & 10 deletions apps/docs/.typedoc/api-readme.md

This file was deleted.

2 changes: 0 additions & 2 deletions apps/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { defineConfig } from 'vitepress';
import { codeInContextPlugin } from './plugins/codeInContextPlugin';
import { snippetPlugin } from './plugins/snippetPlugin';
import apiLinks from '../.typedoc/api-links.json';

export default defineConfig({
title: 'Fuels-ts',
Expand Down Expand Up @@ -552,7 +551,6 @@ export default defineConfig({
collapsed: false,
items: [],
},
apiLinks,
],
},
],
Expand Down
12 changes: 4 additions & 8 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
"description": "",
"type": "module",
"scripts": {
"dev": "nodemon --config nodemon.config.json -x 'run-s build:snippets build:docs-api dev:docs'",
"build": "run-s build:snippets build:docs-api build:docs",
"preview": "run-s build:snippets build:docs-api preview:docs",
"dev": "nodemon --config nodemon.config.json -x 'run-s build:snippets dev:docs'",
"build": "run-s build:snippets build:docs",
"preview": "run-s build:snippets preview:docs",
"pretest": "./scripts/pretest.sh",
"test": "cd ../.. && pnpm run test:filter apps/docs",
"build:snippets": "run-s wrap:snippets build:forc",
"build:docs-api": "typedoc && tsx ./scripts/typedoc-postbuild.ts",
"build:docs": "vitepress build",
"preview:docs": "vitepress preview",
"dev:docs": "vitepress dev",
Expand All @@ -26,8 +25,7 @@
"@fuel-ts/errors": "workspace:*",
"@fuel-ts/versions": "workspace:*",
"fuels": "workspace:*",
"ethers": "^6.13.2",
"typedoc-plugin-markdown": "^4.2.9"
"ethers": "^6.13.2"
},
"devDependencies": {
"@types/markdown-it": "^14.1.2",
Expand All @@ -37,8 +35,6 @@
"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"
Expand Down
211 changes: 0 additions & 211 deletions apps/docs/scripts/typedoc-postbuild.ts

This file was deleted.

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#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.

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
2 changes: 1 addition & 1 deletion apps/docs/src/guide/contracts/dependency-estimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ In [variable outputs](./variable-outputs.md), we mention that a contract call mi

However, by default the SDK always automatically estimates these dependencies and double-checks if everything is in order whenever you invoke a contract function or attempt to send a transaction.

The SDK uses the [Provider.estimateTxDependencies](../../api/Account/Provider.md#estimatetxdependencies) method to set any missing dependencies identified during the estimation process. This requires simulating the transaction a few times in the background.
The SDK uses the [Provider.estimateTxDependencies](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Provider.html#estimatetxdependencies) method to set any missing dependencies identified during the estimation process. This requires simulating the transaction a few times in the background.

While relying on the SDK's automatic estimation is a decent default behavior, we recommend manually specifying the dependencies if they are known in advance to avoid the performance impact of the estimation process.
2 changes: 1 addition & 1 deletion apps/docs/src/guide/contracts/deploying-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Now that the contract is deployed, you can interact with it by submitting a cont

## Deploying a Large Contract as Blobs

In the above guide we use the recommended `deploy` method. If you are working with a contract that is too large to be deployed in a single transaction, then the SDK will chunk the contract for you and submit it as blobs, to then be accessed later by a create transaction. This process is handled by the [`ContractFactory.deployAsBlobTx`](../../api/Contract/ContractFactory.md#deployasblobtx) method.
In the above guide we use the recommended `deploy` method. If you are working with a contract that is too large to be deployed in a single transaction, then the SDK will chunk the contract for you and submit it as blobs, to then be accessed later by a create transaction. This process is handled by the [`ContractFactory.deployAsBlobTx`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_contract.index.ContractFactory.html#deployasblobtx) method.

<<< @./snippets/deploying-contracts/deployment.ts#blobs{ts:line-numbers}

Expand Down
8 changes: 4 additions & 4 deletions apps/docs/src/guide/contracts/managing-deployed-contracts.md
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:https://fuels-ts-docs-api.vercel.app/interfaces/_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:https://fuels-ts-docs-api.vercel.app/interfaces/_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`.

> [!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).
Expand All @@ -25,10 +25,10 @@ If you have already an instantiated and deployed contract in hands you can creat

<<< @./snippets/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`:

<<< @./snippets/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
Loading

0 comments on commit d29e884

Please sign in to comment.