diff --git a/.changeset/calm-buttons-help.md b/.changeset/calm-buttons-help.md new file mode 100644 index 00000000000..00b00dff4cc --- /dev/null +++ b/.changeset/calm-buttons-help.md @@ -0,0 +1,4 @@ +--- +--- + +chore: remove legacy API docs diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f6ce152fa9a..98c20fa8953 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 diff --git a/apps/docs/.gitignore b/apps/docs/.gitignore index 4b48275e4c2..d539730da77 100644 --- a/apps/docs/.gitignore +++ b/apps/docs/.gitignore @@ -1,10 +1,6 @@ .vitepress/cache .vitepress/.temp -.typedoc/api-links.json - -src/api - src/typegend src/guide/**/*.test.ts -.fuels/ \ No newline at end of file +.fuels/ diff --git a/apps/docs/.typedoc/api-readme.md b/apps/docs/.typedoc/api-readme.md deleted file mode 100644 index ab179391bc0..00000000000 --- a/apps/docs/.typedoc/api-readme.md +++ /dev/null @@ -1,10 +0,0 @@ - - -# The Fuel TypeScript SDK API Documentation - -
- -#### Version Notice: Docs generated using Fuels `v{{fuels}}`, Fuel Core `v{{fuelCore}}`, Sway `v{{forc}}`, and Forc `v{{forc}}`. diff --git a/apps/docs/.vitepress/config.ts b/apps/docs/.vitepress/config.ts index 4efd373d2b1..406d3de6703 100644 --- a/apps/docs/.vitepress/config.ts +++ b/apps/docs/.vitepress/config.ts @@ -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', @@ -552,7 +551,6 @@ export default defineConfig({ collapsed: false, items: [], }, - apiLinks, ], }, ], diff --git a/apps/docs/package.json b/apps/docs/package.json index 64df8bd25c5..d57daee5f3b 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -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", @@ -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", @@ -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" diff --git a/apps/docs/scripts/typedoc-postbuild.ts b/apps/docs/scripts/typedoc-postbuild.ts deleted file mode 100644 index 3b6727a14e7..00000000000 --- a/apps/docs/scripts/typedoc-postbuild.ts +++ /dev/null @@ -1,211 +0,0 @@ -import { readdirSync, renameSync, rmdirSync, rmSync, statSync, writeFileSync } from 'fs'; -import { dirname, join } from 'path'; -import replace from 'replace'; -import { fileURLToPath } from 'url'; - -type Link = { - link: string; - text: string; - items: Link[]; - collapsed?: boolean; -}; - -type RegexReplacement = { - regex: string; - replacement: string; -}; - -/** - * Post build script to trim off undesired leftovers from Typedoc, restructure directories and generate json for links. - */ -const filename = fileURLToPath(import.meta.url); -const docsDir = join(dirname(filename), '../src/'); -const apiDocsDir = join(docsDir, '/api'); - -const filesToRemove = ['api/_media']; - -const filePathReplacements: RegexReplacement[] = []; -const secondaryEntryPoints = ['-index.md', '-test_utils.md', '-cli_utils.md']; -const toFlattern = ['classes', 'interfaces', 'enumerations']; - -const { log } = console; - -/** - * Removes unwanted files and dirs generated by typedoc. - */ -const removeUnwantedFiles = () => - filesToRemove.forEach((dirPath) => { - const fullDirPath = join(docsDir, dirPath); - rmSync(fullDirPath, { recursive: true, force: true }); - }); - -/** - * Generates a json file containing the links for the sidebar to be used by vitepress. - */ -const exportLinksJson = () => { - const links: Link = { link: '/api/', text: 'API', collapsed: true, items: [] }; - const directories = readdirSync(apiDocsDir); - directories - .filter((directory) => !directory.endsWith('.md')) - .forEach((directory) => { - links.items.push({ text: directory, link: `/api/${directory}/`, collapsed: true, items: [] }); - readdirSync(join(apiDocsDir, directory)) - .filter((file) => { - // Exclude index files and files related to secondary entry points - const isIndexFile = file.endsWith('index.md'); - const isSecondaryEntryPoint = secondaryEntryPoints.some((entryPoint) => - file.includes(entryPoint.replace('_', '-').replace('.md', '')) - ); - return !isIndexFile && !isSecondaryEntryPoint; - }) - .forEach((file) => { - const index = links.items.findIndex((item) => item.text === directory); - if (index !== -1) { - const name = file.split('.')[0]; - links.items[index].items.push({ - text: name, - link: `/api/${directory}/${name}`, - items: [], - }); - } - }); - }); - writeFileSync('.typedoc/api-links.json', JSON.stringify(links)); -}; - -const digRecursively = (startingPath: string, rootPackagePath: string, rootPackageName: string) => { - const subDirs = readdirSync(startingPath); - subDirs.forEach((dirName) => { - const secondaryDirPath = join(startingPath, dirName); - if (toFlattern.includes(dirName)) { - const secondaryDirFiles = readdirSync(secondaryDirPath); - - secondaryDirFiles.forEach((file) => { - renameSync(join(secondaryDirPath, file), join(rootPackagePath, file)); - const capitalRootPackageName = - rootPackageName.charAt(0).toUpperCase() + rootPackageName.slice(1); - const filePathToReplace = startingPath.replace(rootPackagePath, rootPackageName); - filePathReplacements.push({ - regex: `${filePathToReplace}/${dirName}/${file}`, - replacement: `${capitalRootPackageName}/${file}`, - }); - }); - - rmSync(secondaryDirPath, { recursive: true, force: true }); - } else { - if (statSync(secondaryDirPath).isDirectory()) { - digRecursively(secondaryDirPath, rootPackagePath, rootPackageName); - } - - if (dirName === 'index.md') { - const pathAfterRoot = secondaryDirPath.replace(`${rootPackagePath}/`, ''); - const pathSegments = pathAfterRoot.split('/'); - if (pathSegments.length - 1 > 0) { - const newIndexFileName = - pathSegments[pathSegments.length - 2] === 'index' - ? `src-index.md` - : `${pathSegments[pathSegments.length - 2]}-index.md`; - renameSync(secondaryDirPath, join(rootPackagePath, newIndexFileName)); - filePathReplacements.push({ - regex: `${pathAfterRoot}`, - replacement: `./${newIndexFileName}`, - }); - } - } - } - }); -}; - -/** - * Flattens the module files generated by typedoc. Only necessary where a package - * has multiple entry points. - */ -const flattenSecondaryModules = () => { - const primaryDirs = readdirSync(apiDocsDir); - primaryDirs.forEach((primaryDirName) => { - const primaryDirPath = join(apiDocsDir, primaryDirName); - if (statSync(primaryDirPath).isDirectory()) { - digRecursively(primaryDirPath, primaryDirPath, primaryDirName); - } - }); -}; - -/** - * Capitalise the Primary Directories - */ -const capitalisePrimaryDirs = () => { - const primaryDirs = readdirSync(apiDocsDir); - primaryDirs - .filter((directory) => !directory.includes('.md')) - .forEach((primaryDirName) => { - const capitalise = primaryDirName.charAt(0).toUpperCase() + primaryDirName.slice(1); - const primaryDirPath = join(apiDocsDir, primaryDirName); - renameSync(primaryDirPath, join(apiDocsDir, capitalise)); - filePathReplacements.push({ - regex: `${primaryDirName}/index.md`, - replacement: `${capitalise}/index.md`, - }); - }); -}; - -/** - * Remove empty directories - */ -const cleanupDirectories = (dirPath: string) => { - const primaryDirs = readdirSync(dirPath); - primaryDirs.forEach((dir) => { - const fullPath = join(dirPath, dir); - if (statSync(fullPath).isDirectory()) { - cleanupDirectories(fullPath); - } - }); - if (readdirSync(dirPath).length === 0) { - rmdirSync(dirPath); - } -}; - -/** - * Recreates the generated typedoc links - */ -const recreateInternalLinks = () => { - const topLevelDirs = readdirSync(apiDocsDir); - - const prefixReplacements: RegexReplacement[] = [ - // Prefix/Typedoc cleanups - { regex: 'classes/', replacement: './' }, - { regex: 'interfaces/', replacement: './' }, - { regex: 'enumerations/', replacement: './' }, - { regex: '../../../', replacement: '../' }, - { regex: '../../', replacement: '../' }, - { regex: 'index/index', replacement: 'index' }, - { regex: '.././', replacement: './' }, - // Resolves `[plugin:vite:vue] Element is missing end tag.` error - { regex: '<', replacement: '<' }, - ]; - - const internalLinksReplacement = [...filePathReplacements, ...prefixReplacements]; - - topLevelDirs.forEach((dir) => { - internalLinksReplacement.forEach(({ regex, replacement }) => { - replace({ - regex, - replacement, - paths: [join(apiDocsDir, dir)], - recursive: true, - silent: true, - }); - }); - }); -}; - -const main = () => { - log('Cleaning up API docs.'); - removeUnwantedFiles(); - flattenSecondaryModules(); - capitalisePrimaryDirs(); - cleanupDirectories(apiDocsDir); - exportLinksJson(); - recreateInternalLinks(); -}; - -main(); diff --git a/apps/docs/src/guide/contracts/contract-balance.md b/apps/docs/src/guide/contracts/contract-balance.md index 3f76dfb86d8..2aa3867ea16 100644 --- a/apps/docs/src/guide/contracts/contract-balance.md +++ b/apps/docs/src/guide/contracts/contract-balance.md @@ -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. diff --git a/apps/docs/src/guide/contracts/cost-estimation.md b/apps/docs/src/guide/contracts/cost-estimation.md index f4ec94ca0b9..0039de9d2cf 100644 --- a/apps/docs/src/guide/contracts/cost-estimation.md +++ b/apps/docs/src/guide/contracts/cost-estimation.md @@ -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} diff --git a/apps/docs/src/guide/contracts/dependency-estimation.md b/apps/docs/src/guide/contracts/dependency-estimation.md index 7b8213381af..718b1da118e 100644 --- a/apps/docs/src/guide/contracts/dependency-estimation.md +++ b/apps/docs/src/guide/contracts/dependency-estimation.md @@ -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. diff --git a/apps/docs/src/guide/contracts/deploying-contracts.md b/apps/docs/src/guide/contracts/deploying-contracts.md index 47120b7b87e..0a71cd61400 100644 --- a/apps/docs/src/guide/contracts/deploying-contracts.md +++ b/apps/docs/src/guide/contracts/deploying-contracts.md @@ -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} diff --git a/apps/docs/src/guide/contracts/managing-deployed-contracts.md b/apps/docs/src/guide/contracts/managing-deployed-contracts.md index 64f95283064..8fc177a3e1b 100644 --- a/apps/docs/src/guide/contracts/managing-deployed-contracts.md +++ b/apps/docs/src/guide/contracts/managing-deployed-contracts.md @@ -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). @@ -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} diff --git a/apps/docs/src/guide/contracts/using-different-wallets.md b/apps/docs/src/guide/contracts/using-different-wallets.md index 8044b0e0064..26c57b142ae 100644 --- a/apps/docs/src/guide/contracts/using-different-wallets.md +++ b/apps/docs/src/guide/contracts/using-different-wallets.md @@ -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 diff --git a/apps/docs/src/guide/cookbook/custom-transactions-from-contract-calls.md b/apps/docs/src/guide/cookbook/custom-transactions-from-contract-calls.md index dec0b2f6447..cc1245bc329 100644 --- a/apps/docs/src/guide/cookbook/custom-transactions-from-contract-calls.md +++ b/apps/docs/src/guide/cookbook/custom-transactions-from-contract-calls.md @@ -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. 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. 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. diff --git a/apps/docs/src/guide/cookbook/custom-transactions.md b/apps/docs/src/guide/cookbook/custom-transactions.md index 33c7fec99c3..a794879a64f 100644 --- a/apps/docs/src/guide/cookbook/custom-transactions.md +++ b/apps/docs/src/guide/cookbook/custom-transactions.md @@ -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). This class allows you to a append multiple program types and assets to a single transaction. Consider the following script that transfers multiple assets to a contract: <<< @/../../docs/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_account.ScriptTransactionRequest.html), appending the resource and contract inputs/outputs and then sending the transaction, as follows: <<< @/../../docs/src/guide/scripts/snippets/script-custom-transaction.ts#custom-transactions-2{ts:line-numbers} diff --git a/apps/docs/src/guide/errors/index.md b/apps/docs/src/guide/errors/index.md index 324e1c8b12f..77772baa983 100644 --- a/apps/docs/src/guide/errors/index.md +++ b/apps/docs/src/guide/errors/index.md @@ -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. This will usually be in the form of a [`Wallet`](../wallets/index.md). 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). @@ -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` @@ -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` diff --git a/apps/docs/src/guide/predicates/instantiating-a-predicate.md b/apps/docs/src/guide/predicates/instantiating-a-predicate.md index 12a4be5a9aa..e406d217bdd 100644 --- a/apps/docs/src/guide/predicates/instantiating-a-predicate.md +++ b/apps/docs/src/guide/predicates/instantiating-a-predicate.md @@ -12,7 +12,7 @@ After compiling, you will obtain the binary of the predicate and its JSON ABI (A <<< @./snippets/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. diff --git a/apps/docs/src/guide/predicates/send-and-spend-funds-from-predicates.md b/apps/docs/src/guide/predicates/send-and-spend-funds-from-predicates.md index e1e5fde32a2..3d1352a7ba2 100644 --- a/apps/docs/src/guide/predicates/send-and-spend-funds-from-predicates.md +++ b/apps/docs/src/guide/predicates/send-and-spend-funds-from-predicates.md @@ -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). Then, we can submit this transaction request by calling the `sendTransaction` method. The following example, we are pre-staging a transaction and therefore we are able to know the transaction ID without actually submitting the transaction. diff --git a/apps/docs/src/guide/provider/index.md b/apps/docs/src/guide/provider/index.md index 13987e042f6..6b004bf3d7b 100644 --- a/apps/docs/src/guide/provider/index.md +++ b/apps/docs/src/guide/provider/index.md @@ -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. diff --git a/apps/docs/src/guide/provider/provider-options.md b/apps/docs/src/guide/provider/provider-options.md index b0a96227e4f..1eb6bab5f55 100644 --- a/apps/docs/src/guide/provider/provider-options.md +++ b/apps/docs/src/guide/provider/provider-options.md @@ -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/modules/_fuel_ts_account.html#provideroptions) on `Provider` instantiation to modify its behavior. ### `retryOptions` diff --git a/apps/docs/src/guide/testing/launching-a-test-node.md b/apps/docs/src/guide/testing/launching-a-test-node.md index a5eb41d1ceb..118bd70bbd7 100644 --- a/apps/docs/src/guide/testing/launching-a-test-node.md +++ b/apps/docs/src/guide/testing/launching-a-test-node.md @@ -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/modules/_fuel_ts_contract.test_utils.html#launchtestnode). ## Explicit Resource Management diff --git a/apps/docs/src/guide/testing/test-node-options.md b/apps/docs/src/guide/testing/test-node-options.md index 73b2879ec84..cb8855b44ef 100644 --- a/apps/docs/src/guide/testing/test-node-options.md +++ b/apps/docs/src/guide/testing/test-node-options.md @@ -9,7 +9,7 @@ This reference describes all the options of the [`launchTestNode`](./launching-a <<< @./snippets/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` @@ -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` diff --git a/apps/docs/src/guide/types/address.md b/apps/docs/src/guide/types/address.md index 17dabf9f78e..68673999e68 100644 --- a/apps/docs/src/guide/types/address.md +++ b/apps/docs/src/guide/types/address.md @@ -1,26 +1,26 @@ # Address -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. +In Sway, the [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) 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](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) type. ## `AbstractAddress` Class -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. +The SDK defines the [AbstractAddress](https:https://fuels-ts-docs-api.vercel.app/interfaces/_fuel_ts_interfaces.AbstractAddress.html) class, which provides a set of utility functions for easy manipulation and conversion between address formats. <<< @/../../../packages/interfaces/src/index.ts#address-1{ts:line-numbers} ## Address Class -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. +Besides conforming to the interface of the [`AbstractAddress`](https:https://fuels-ts-docs-api.vercel.app/interfaces/_fuel_ts_interfaces.AbstractAddress.html), the [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) class also defines one property; `bech32Address`, which is of the [`Bech32`](./bech32.md) type. <<< @/../../../packages/address/src/address.ts#address-2{ts:line-numbers} ## Creating an Address -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: +Thanks to the utility functions provided by the [`AbstractAddress`](https:https://fuels-ts-docs-api.vercel.app/interfaces/_fuel_ts_interfaces.AbstractAddress.html) class, there are several ways to create an [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) instance: ### From a `Bech32` Address -To create an [`Address`](../../api/Address/Address.md) from a `Bech32` address, use the following code snippet: +To create an [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) from a `Bech32` address, use the following code snippet: <<< @./snippets/address/creating-an-address.ts#full{ts:line-numbers} @@ -29,25 +29,25 @@ To create an [`Address`](../../api/Address/Address.md) from a `Bech32` address, ### From a Public Key -To create an [`Address`](../../api/Address/Address.md) from a public key, use the following code snippet: +To create an [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) from a public key, use the following code snippet: <<< @./snippets/address/from-a-public-key.ts#full{ts:line-numbers} ### From a 256-bit Address -To create an [`Address`](../../api/Address/Address.md) from a 256-bit address, use the following code snippet: +To create an [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) from a 256-bit address, use the following code snippet: <<< @./snippets/address/from-a-b256.ts#full{ts:line-numbers} ## Utility Functions -The [`Address`](../../api/Address/Address.md) class also provides some practical utility functions: +The [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) class also provides some practical utility functions: -1. `fromString`: Create a new [`Address`](../../api/Address/Address.md) from an ambiguous source that may be a `Bech32` or `B256` address: +1. `fromString`: Create a new [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) from an ambiguous source that may be a `Bech32` or `B256` address: <<< @./snippets/address/utilities-function-1.ts#full{ts:line-numbers} -2. `fromDynamicInput`: Create a new [`Address`](../../api/Address/Address.md) when the address source is unknown: +2. `fromDynamicInput`: Create a new [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) when the address source is unknown: <<< @./snippets/address/utilities-function-2.ts#full{ts:line-numbers} diff --git a/apps/docs/src/guide/types/bech32.md b/apps/docs/src/guide/types/bech32.md index bd3c837f174..58e0d72e4a6 100644 --- a/apps/docs/src/guide/types/bech32.md +++ b/apps/docs/src/guide/types/bech32.md @@ -3,9 +3,9 @@ > [!NOTE] Note > `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. +The SDK uses the `Bech32` type as the core property of the [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) 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. +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`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) class is constructed around the `Bech32` type. You can read more about the `Bech32` type [here](https://thebitcoinmanual.com/articles/btc-bech32-address/). diff --git a/apps/docs/src/guide/types/bits256.md b/apps/docs/src/guide/types/bits256.md index 7cee4a51754..5cc9d26c021 100644 --- a/apps/docs/src/guide/types/bits256.md +++ b/apps/docs/src/guide/types/bits256.md @@ -16,6 +16,6 @@ To convert between a `b256` hexlified string and a `Uint8Array`, you can use the ## Support from `Address` Class -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: +A `b256` value is also supported as part of the [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) class, providing seamless integration with other components of your application. To create an [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) instance from a b256 value, use the `Address.fromB256()` method: <<< @./snippets/bits256/support-from-address-class.ts#full{ts:line-numbers} diff --git a/apps/docs/src/guide/utilities/address-conversion.md b/apps/docs/src/guide/utilities/address-conversion.md index 20e04319094..2bb1eaf8c82 100644 --- a/apps/docs/src/guide/utilities/address-conversion.md +++ b/apps/docs/src/guide/utilities/address-conversion.md @@ -28,7 +28,7 @@ This guide demonstrates how to convert between address formats and Sway Standard ## From `Bech32` to `b256` -By instantiating an [`Address`](../../api/Address/Address.md), we can validate a `Bech32` address and easily convert it to a `b256`: +By instantiating an [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html), we can validate a `Bech32` address and easily convert it to a `b256`: <<< @./snippets/address-conversion/bech32-to-b256.ts#conversion-5{ts:line-numbers} @@ -38,7 +38,7 @@ Or, if you'd prefer to use utility functions directly for validation and convers ## From `b256` to `Bech32` -In a similar fashion, we have both class functions on the [`Address`](../../api/Address/Address.md) and utilities available for `b256` validation and conversion: +In a similar fashion, we have both class functions on the [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) and utilities available for `b256` validation and conversion: <<< @./snippets/address-conversion/b256-to-bech32.ts#conversion-7{ts:line-numbers} @@ -48,18 +48,18 @@ 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`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) class functions such as `toAddress` and `toB256`: <<< @./snippets/address-conversion/contract.ts#conversion-2{ts:line-numbers} ## Converting a Wallet Address -Similarly, the Wallet `address` property is also of type [`AbstractAddress`](../types/address.md#abstractaddress-class) and can therefore use the same [`Address`](../../api/Address/Address.md) class functions for conversion: +Similarly, the Wallet `address` property is also of type [`AbstractAddress`](../types/address.md#abstractaddress-class) and can therefore use the same [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) class functions for conversion: <<< @./snippets/address-conversion/wallet.ts#conversion-3{ts:line-numbers} ## Converting an Asset ID -[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: +[Asset IDs](../types/asset-id.md) are a wrapped [b256](../types/bits256.md) value. The following example shows how to create an [`Address`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_address.Address.html) from a `b256` type: <<< @./snippets/address-conversion/asset-id.ts#conversion-4{ts:line-numbers} diff --git a/apps/docs/src/guide/utilities/using-assets.md b/apps/docs/src/guide/utilities/using-assets.md index 8a7d4845544..afe5ce152e6 100644 --- a/apps/docs/src/guide/utilities/using-assets.md +++ b/apps/docs/src/guide/utilities/using-assets.md @@ -9,6 +9,6 @@ Included assets such as: - USD Coin (USDC) - Wrapped ETH (WETH) -The helper functions `getAssetFuel` and `getAssetEth` can be used to get an asset's details relative to each network. These return a combination of the asset, and network information (the return types are [`AssetFuel`](../../api/Account/index.md#assetfuel) and [`AssetEth`](../../api/Account/index.md#asseteth) respectively). +The helper functions `getAssetFuel` and `getAssetEth` can be used to get an asset's details relative to each network. These return a combination of the asset, and network information (the return types are [`AssetFuel`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#assetfuel) and [`AssetEth`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#asseteth) respectively). <<< @./snippets/using-assets.ts#using-assets-1{ts:line-numbers} diff --git a/apps/docs/src/guide/wallets/checking-balances.md b/apps/docs/src/guide/wallets/checking-balances.md index 252ad8f4593..08d19d9f018 100644 --- a/apps/docs/src/guide/wallets/checking-balances.md +++ b/apps/docs/src/guide/wallets/checking-balances.md @@ -1,9 +1,9 @@ # Checking balances -To check the balance of a specific asset, you can use [`getBalance`](../../api/Account/Account.md#getbalance) method. This function aggregates the amounts of all unspent coins of the given asset in your wallet. +To check the balance of a specific asset, you can use [`getBalance`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Account.html#getbalance) method. This function aggregates the amounts of all unspent coins of the given asset in your wallet. <<< @./snippets/checking-balances.ts#checking-balances-1{ts:line-numbers} -To retrieve the balances of all assets in your wallet, use the [`getBalances`](../../api/Account/Account.md#getbalances) method, it returns an array of [`CoinQuantity`](../../api/Account/index.md#coinquantity). This is useful for getting a comprehensive view of your holdings. +To retrieve the balances of all assets in your wallet, use the [`getBalances`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Account.html#getbalances) method, it returns an array of [`CoinQuantity`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#coinquantity). This is useful for getting a comprehensive view of your holdings. <<< @./snippets/checking-balances-two.ts#checking-balances-2{ts:line-numbers} diff --git a/apps/docs/src/guide/wallets/connectors.md b/apps/docs/src/guide/wallets/connectors.md index 287c66ed736..29f921c470c 100644 --- a/apps/docs/src/guide/wallets/connectors.md +++ b/apps/docs/src/guide/wallets/connectors.md @@ -6,7 +6,7 @@ Fuel Wallet Connectors offer a standardized interface to integrate multiple wall `Fuel Connectors` are a set of standardized interfaces that provide a way to interact with various wallets and services. They offer a consistent way to interact with different wallets and services, allowing developers to focus on building their applications rather than worrying about wallet integration. -To build your own wallet integration, you can create a custom connector that extends the abstract [`FuelConnector`](../../api/Account/FuelConnector.md) class. This interface provides a set of methods and events that allow you to interact with the wallet and handle various operations such as connecting, disconnecting, signing messages, and sending transactions. +To build your own wallet integration, you can create a custom connector that extends the abstract [`FuelConnector`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.FuelConnector.html) class. This interface provides a set of methods and events that allow you to interact with the wallet and handle various operations such as connecting, disconnecting, signing messages, and sending transactions. <<< @./snippets/connectors.ts#fuel-connector-extends{ts:line-numbers} @@ -67,13 +67,13 @@ The `accounts` event is emitted every time a connector's accounts change. The ev #### `connectors` -The `connectors` event is emitted when the connectors are initialized. The event data is an array of [`FuelConnector`](../../api/Account/FuelConnector.md) objects available on the network. +The `connectors` event is emitted when the connectors are initialized. The event data is an array of [`FuelConnector`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.FuelConnector.html) objects available on the network. <<< @./snippets/connectors.ts#fuel-connector-events-connectors{ts:line-numbers} #### `currentConnector` -The `currentConnector` event is emitted every time the current connector changes. The event data is a [`FuelConnector`](../../api/Account/FuelConnector.md) object that is currently connected. +The `currentConnector` event is emitted every time the current connector changes. The event data is a [`FuelConnector`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.FuelConnector.html) object that is currently connected. <<< @./snippets/connectors.ts#fuel-connector-events-currentConnector{ts:line-numbers} @@ -91,25 +91,25 @@ The `connection` event is emitted every time the connection status changes. The #### `networks` -The `networks` event is emitted every time the network changes. The event data will be a [`Network`](../../api/Account/index.md#network) object containing the current network information. +The `networks` event is emitted every time the network changes. The event data will be a [`Network`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#network) object containing the current network information. <<< @./snippets/connectors.ts#fuel-connector-events-networks{ts:line-numbers} #### `currentNetwork` -The `currentNetwork` event is emitted every time the current network changes. The event data will be a [`Network`](../../api/Account/index.md#network) object containing the current network information. +The `currentNetwork` event is emitted every time the current network changes. The event data will be a [`Network`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#network) object containing the current network information. <<< @./snippets/connectors.ts#fuel-connector-events-currentNetwork{ts:line-numbers} #### `assets` -The `assets` event is emitted every time the assets change. The event data will be an array of [`Asset`](../../api/Account/index.md#asset) objects available on the network. +The `assets` event is emitted every time the assets change. The event data will be an array of [`Asset`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#asset) objects available on the network. <<< @./snippets/connectors.ts#fuel-connector-events-assets{ts:line-numbers} #### `abis` -The `abis` event is emitted every time an ABI is added to a connector. The event data will be an array of [`FuelABI`](../../api/Account/index.md#fuelabi) object. +The `abis` event is emitted every time an ABI is added to a connector. The event data will be an array of [`FuelABI`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#fuelabi) object. <<< @./snippets/connectors.ts#fuel-connector-events-assets{ts:line-numbers} @@ -197,7 +197,7 @@ The `signTransaction` method initiates the send transaction flow for the current It requires two arguments: - `address` (`string`) -- `transaction` ([`TransactionRequestLike`](../../api/Account/index.md#transactionrequestlike)) +- `transaction` ([`TransactionRequestLike`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#transactionrequestlike)) It will return the transaction signature (as a `string`) if it is successfully signed. @@ -207,7 +207,7 @@ It will return the transaction signature (as a `string`) if it is successfully s The `assets` method returns a list of all the assets available for the current connection. -It will return a promise that will resolve to an array of assets (see [`Asset`](../../api/Account/index.md#asset)) that are available on the network. +It will return a promise that will resolve to an array of assets (see [`Asset`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#asset)) that are available on the network. <<< @/../../../packages/account/src/connectors/fuel-connector.ts#fuel-connector-method-assets{ts:line-numbers} @@ -217,7 +217,7 @@ The `addAsset` method adds asset metadata to the connector. It requires a single argument: -- `asset` ([`Asset`](../../api/Account/index.md#asset)) +- `asset` ([`Asset`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#asset)) It returns a promise that resolves to `true` if the asset is successfully added; otherwise, it resolves to `false`. @@ -229,7 +229,7 @@ The `addAssets` method adds multiple asset metadata to the connector. It requires a single argument: -- `assets` (an Array of [`Asset`](../../api/Account/index.md#asset)). +- `assets` (an Array of [`Asset`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#asset)). Returns a promise that resolves to `true` if the assets are successfully added; otherwise, resolves to `false`. @@ -253,7 +253,7 @@ It should throw an error if the network is not available or the network already The `networks` method returns a list of all the networks available for the current connection. -Returns a promise that resolves to an array of available networks (see [`Network`](../../api/Account/index.md#network)). +Returns a promise that resolves to an array of available networks (see [`Network`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#network)). <<< @/../../../packages/account/src/connectors/fuel-connector.ts#fuel-connector-method-networks{ts:line-numbers} @@ -261,7 +261,7 @@ Returns a promise that resolves to an array of available networks (see [`Network The `currentNetwork` method will return the current network that is connected. -It will return a promise that will resolve to the current network (see [`Network`](../../api/Account/index.md#network)). +It will return a promise that will resolve to the current network (see [`Network`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#network)). <<< @/../../../packages/account/src/connectors/fuel-connector.ts#fuel-connector-method-currentNetwork{ts:line-numbers} @@ -271,7 +271,7 @@ The `selectNetwork` method requests the user to select a network for the current It requires a single argument: -- `network` ([`Network`](../../api/Account/index.md#network)) +- `network` ([`Network`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#network)) You call this method with either the `providerUrl` or `chainId` to select the network. @@ -288,7 +288,7 @@ The `addABI` method adds ABI information about a contract to the connector. This It requires two arguments: - `contractId` (`string`) -- `abi` ([`FuelABI`](../../api/Account/index.md#fuelabi)). +- `abi` ([`FuelABI`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#fuelabi)). It will return a promise that will resolve to `true` if the ABI is successfully added; otherwise `false`. @@ -302,7 +302,7 @@ It requires a single argument: - `contractId` (`string`) -Returns a promise that resolves to the ABI information (as a [`FuelABI`](../../api/Account/index.md#fuelabi)) or `null` if the data is unavailable. +Returns a promise that resolves to the ABI information (as a [`FuelABI`](https://fuels-ts-docs-api.vercel.app/modules/_fuel_ts_account.html#fuelabi)) or `null` if the data is unavailable. <<< @/../../../packages/account/src/connectors/fuel-connector.ts#fuel-connector-method-getABI{ts:line-numbers} diff --git a/apps/docs/src/guide/wallets/encrypting-and-decrypting.md b/apps/docs/src/guide/wallets/encrypting-and-decrypting.md index d446f63524d..22ee86d28a7 100644 --- a/apps/docs/src/guide/wallets/encrypting-and-decrypting.md +++ b/apps/docs/src/guide/wallets/encrypting-and-decrypting.md @@ -4,23 +4,23 @@ JSON wallets are a standardized way of storing wallets securely. They follow a s ## Encrypting a Wallet -We will be calling `encrypt` from the [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) instance which will take a password as the argument. It will encrypt the private key using a cipher and returns the JSON keystore wallet. You can then securely store this JSON wallet. +We will be calling `encrypt` from the [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) instance which will take a password as the argument. It will encrypt the private key using a cipher and returns the JSON keystore wallet. You can then securely store this JSON wallet. Here is an example of how you can accomplish this: <<< @./snippets/encrypting-and-decrypting-wallets.ts#encrypting-and-decrypting-json-wallets-1{ts:line-numbers} -Please note that `encrypt` must be called within an instance of [`WalletUnlocked`](../../api/Account/WalletUnlocked.md). This instance can only be achieved through passing a private key or mnemonic phrase to a locked wallet. +Please note that `encrypt` must be called within an instance of [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html). This instance can only be achieved through passing a private key or mnemonic phrase to a locked wallet. ## Decrypting a Wallet -To decrypt the JSON wallet and retrieve your private key, you can call `fromEncryptedJson` on a [Wallet](../../api/Account/Wallet.md) instance. It takes the encrypted JSON wallet and the password as its arguments, and returns the decrypted wallet. +To decrypt the JSON wallet and retrieve your private key, you can call `fromEncryptedJson` on a [Wallet](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Wallet.html) instance. It takes the encrypted JSON wallet and the password as its arguments, and returns the decrypted wallet. Here is an example: <<< @./snippets/encrypting-and-decrypting-json-wallets-two.ts#encrypting-and-decrypting-json-wallets-2{ts:line-numbers} -In this example, `decryptedWallet` is an instance of [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) class, now available for use. +In this example, `decryptedWallet` is an instance of [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) class, now available for use. ## Important diff --git a/apps/docs/src/guide/wallets/index.md b/apps/docs/src/guide/wallets/index.md index 24e20702a02..ac11239aea0 100644 --- a/apps/docs/src/guide/wallets/index.md +++ b/apps/docs/src/guide/wallets/index.md @@ -11,13 +11,13 @@ Wallets can be used for many important things, for instance: The SDK has multiple classes related to a Wallet instance: -- [Wallet](../../api/Account/Wallet.md): Works simply like a wrapper providing methods to create and instantiating `WalletUnlocked` and `WalletLocked` instances. +- [Wallet](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Wallet.html): Works simply like a wrapper providing methods to create and instantiating `WalletUnlocked` and `WalletLocked` instances. -- [WalletLocked](../../api/Account/WalletLocked.md): Provides the functionalities for a locked wallet. +- [WalletLocked](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html): Provides the functionalities for a locked wallet. -- [WalletUnlocked](../../api/Account/WalletUnlocked.md): Provides the functionalities for an unlocked wallet. +- [WalletUnlocked](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html): Provides the functionalities for an unlocked wallet. -- [Account](../../api/Account/Account.md): Provides an abstraction with basic functionalities for wallets or accounts to interact with the network. It is essential to notice that both `WalletLocked` and `WalletUnlocked` extend from the `Account` class. +- [Account](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Account.html): Provides an abstraction with basic functionalities for wallets or accounts to interact with the network. It is essential to notice that both `WalletLocked` and `WalletUnlocked` extend from the `Account` class. Let's explore these different approaches in the following sub-chapters. diff --git a/apps/docs/src/guide/wallets/instantiating-wallets.md b/apps/docs/src/guide/wallets/instantiating-wallets.md index 961cdc0da69..8c15954f6b5 100644 --- a/apps/docs/src/guide/wallets/instantiating-wallets.md +++ b/apps/docs/src/guide/wallets/instantiating-wallets.md @@ -4,13 +4,13 @@ Wallets can be instantiated in multiple ways within the SDK. ## Generating new wallets -To generate a new, unlocked wallet, use the [`generate`](../../api/Account/Wallet.md#generate) method. This method creates a new [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) instance, which is immediately ready for use. +To generate a new, unlocked wallet, use the [`generate`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Wallet.html#generate) method. This method creates a new [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) instance, which is immediately ready for use. <<< @./snippets/instantiating/generate.ts#instantiating-wallets-1{ts:line-numbers} ## Instantiating Unlocked Wallets -Creating [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) instances of your existing wallets is easy and can be done in several ways: +Creating [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) instances of your existing wallets is easy and can be done in several ways: From a private key: @@ -38,13 +38,13 @@ It's possible to instantiate a `WalletUnlocked` from a `WalletLocked`: ## Instantiating Locked Wallets -You can also instantiate [`WalletLocked`](../../api/Account/WalletLocked.md) instances using just the wallet address: +You can also instantiate [`WalletLocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html) instances using just the wallet address: <<< @./snippets/instantiating/from-bech32-address.ts#instantiating-wallets-8{ts:line-numbers} ## Connecting to a Provider -While wallets can be used independently of a [`Provider`](../../api/Account/Provider.md), operations requiring blockchain interaction will need one. +While wallets can be used independently of a [`Provider`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Provider.html), operations requiring blockchain interaction will need one. Connecting an existing wallet to a Provider: diff --git a/apps/docs/src/guide/wallets/locking-and-unlocking.md b/apps/docs/src/guide/wallets/locking-and-unlocking.md index 91e48fc527e..592784e3942 100644 --- a/apps/docs/src/guide/wallets/locking-and-unlocking.md +++ b/apps/docs/src/guide/wallets/locking-and-unlocking.md @@ -1,25 +1,25 @@ # Locking and Unlocking -The kinds of operations we can perform with a [`Wallet`](../../api/Account/Wallet.md) instance depend on +The kinds of operations we can perform with a [`Wallet`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Wallet.html) instance depend on whether or not we have access to the wallet's private key. -In order to differentiate between [`Wallet`](../../api/Account/Wallet.md) instances that know their private key -and those that do not, we use the [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) and [`WalletLocked`](../../api/Account/WalletLocked.md) types +In order to differentiate between [`Wallet`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.Wallet.html) instances that know their private key +and those that do not, we use the [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) and [`WalletLocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html) types respectively. ## Wallet States -The [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) type represents a wallet whose private key is known and -stored internally in memory. A wallet must be of type [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) in order +The [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) type represents a wallet whose private key is known and +stored internally in memory. A wallet must be of type [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) in order to perform operations that involve [signing messages or transactions](./signing.md). -The [`WalletLocked`](../../api/Account/WalletLocked.md) type represents a wallet whose private key is _not_ known or stored -in memory. Instead, [`WalletLocked`](../../api/Account/WalletLocked.md) only knows its public address. A [`WalletLocked`](../../api/Account/WalletLocked.md) cannot be +The [`WalletLocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html) type represents a wallet whose private key is _not_ known or stored +in memory. Instead, [`WalletLocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html) only knows its public address. A [`WalletLocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html) cannot be used to sign transactions, however it may still perform a whole suite of useful operations including listing transactions, assets, querying balances, and so on. -Note that the [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) type implements most methods available on the [`WalletLocked`](../../api/Account/WalletLocked.md) -type. In other words, [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) can be thought of as a thin wrapper around [`WalletLocked`](../../api/Account/WalletLocked.md) that +Note that the [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) type implements most methods available on the [`WalletLocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html) +type. In other words, [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) can be thought of as a thin wrapper around [`WalletLocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html) that provides greater access via its private key. ## Basic Example @@ -34,16 +34,16 @@ You can choose not to pass through a provider argument on `Wallet` construction: ## Transitioning States -A [`WalletLocked`](../../api/Account/WalletLocked.md) instance can be unlocked by providing the private key: +A [`WalletLocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletLocked.html) instance can be unlocked by providing the private key: <<< @./snippets/locked-to-unlocked.ts#wallet-locked-to-unlocked{ts:line-numbers} -A [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) instance can be locked using the `lock` method: +A [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) instance can be locked using the `lock` method: <<< @./snippets/unlocked-to-locked.ts#wallet-unlocked-to-locked{ts:line-numbers} Most wallet constructors that create or generate a new wallet are provided on -the [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) type. Consider locking the wallet with the `lock` method after the new private +the [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) type. Consider locking the wallet with the `lock` method after the new private key has been handled in order to reduce the scope in which the wallet's private key is stored in memory. @@ -51,7 +51,7 @@ key is stored in memory. When designing APIs that accept a wallet as an input, we should think carefully about the kind of access that we require. API developers should aim to minimise -their usage of [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) in order to ensure private keys are stored in +their usage of [`WalletUnlocked`](https://fuels-ts-docs-api.vercel.app/classes/_fuel_ts_account.WalletUnlocked.html) in order to ensure private keys are stored in memory no longer than necessary to reduce the surface area for attacks and vulnerabilities in downstream libraries and applications. diff --git a/apps/docs/typedoc.json b/apps/docs/typedoc.json deleted file mode 100644 index 64b3b7f0e6f..00000000000 --- a/apps/docs/typedoc.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - // ************** // - // TypeDoc Config - // ************** // - "$schema": "https://typedoc.org/schema.json", - "includeVersion": true, - "entryPointStrategy": "packages", - "entryPoints": [ - "../../packages/address", - "../../packages/interfaces", - "../../packages/predicate", - "../../packages/account", - "../../packages/program", - "../../packages/contract", - "../../packages/script", - "../../packages/utils" - ], - "out": "src/api", - "githubPages": false, - "readme": ".typedoc/api-readme.md", - "categorizeByGroup": true, - "cacheBust": true, - "hideGenerator": true, - "plugin": ["typedoc-plugin-markdown", "typedoc-plugin-merge-modules"], - // ********************** // - // Markdown Config - // ********************** // - "hideBreadcrumbs": true, - "membersWithOwnFile": ["Class", "Enum", "Interface"], - "excludeScopesInPaths": true, - "entryFileName": "index.md", - "modulesFileName": "index", - // ******************** // - // Merge Modules Config - // ******************** // - "mergeModulesMergeMode": "module" -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 361c7bf9133..a1e0269410b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -515,9 +515,6 @@ importers: fuels: specifier: workspace:* version: link:../../packages/fuels - typedoc-plugin-markdown: - specifier: ^4.2.9 - version: 4.2.9(typedoc@0.26.6(typescript@5.6.3)) devDependencies: '@types/markdown-it': specifier: ^14.1.2 @@ -540,12 +537,6 @@ importers: replace: specifier: ^1.2.2 version: 1.2.2 - typedoc: - specifier: ^0.26.3 - version: 0.26.6(typescript@5.6.3) - typedoc-plugin-merge-modules: - specifier: ^6.0.2 - version: 6.0.2(typedoc@0.26.6(typescript@5.6.3)) vitepress: specifier: 1.3.4 version: 1.3.4(@algolia/client-search@4.22.1)(@types/node@22.7.7)(@types/react@18.3.11)(axios@1.7.7)(idb-keyval@6.2.1)(postcss@8.4.49)(qrcode@1.5.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.11.0)(terser@5.36.0)(typescript@5.6.3) @@ -15153,17 +15144,6 @@ packages: typedarray@0.0.6: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} - typedoc-plugin-markdown@4.2.9: - resolution: {integrity: sha512-Wqmx+7ezKFgtTklEq/iUhQ5uFeBDhAT6wiS2na9cFLidIpl9jpDHJy/COYh8jUZXgIRIZVQ/bPNjyrnPFoDwzg==} - engines: {node: '>= 18'} - peerDependencies: - typedoc: 0.26.x - - typedoc-plugin-merge-modules@6.0.2: - resolution: {integrity: sha512-WdADOhOCZBi4wDjP82ua36YSmDaiRGb+o9qXGD9W01nE0hZqbGnogSmalj/zii/T9IaSIRVBPvdQD5urBh8NIw==} - peerDependencies: - typedoc: 0.26.x - typedoc@0.26.6: resolution: {integrity: sha512-SfEU3SH3wHNaxhFPjaZE2kNl/NFtLNW5c1oHsg7mti7GjmUj1Roq6osBQeMd+F4kL0BoRBBr8gQAuqBlfFu8LA==} engines: {node: '>= 18'} @@ -35799,14 +35779,6 @@ snapshots: typedarray@0.0.6: {} - typedoc-plugin-markdown@4.2.9(typedoc@0.26.6(typescript@5.6.3)): - dependencies: - typedoc: 0.26.6(typescript@5.6.3) - - typedoc-plugin-merge-modules@6.0.2(typedoc@0.26.6(typescript@5.6.3)): - dependencies: - typedoc: 0.26.6(typescript@5.6.3) - typedoc@0.26.6(typescript@5.6.3): dependencies: lunr: 2.3.9