From c097bbc48dce0580c2e562b62450f1e8b1de0c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Fri, 11 Apr 2025 12:49:04 +0200 Subject: [PATCH 1/4] Add link format checker --- .github/scripts/checkLinksFormat.ts | 55 +++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100755 .github/scripts/checkLinksFormat.ts diff --git a/.github/scripts/checkLinksFormat.ts b/.github/scripts/checkLinksFormat.ts new file mode 100755 index 00000000..f808eabd --- /dev/null +++ b/.github/scripts/checkLinksFormat.ts @@ -0,0 +1,55 @@ +const fs = require('fs') +const path = require('path') + +const rootDir = ['./pages', './components', './examples'] +const allowedExtensions = ['.md', '.mdx'] + +// If links are not pointing to an external resource (http/https...) they MUST have a file extension to avoid problems in the future +const markdownLinkRegex = /\[.+?\]\(([^)]+)\)/g +const ignorePatterns = [ + /^\/$/, + /^#/, + /^http/, + /^mailto:/, + /\.png/, + /\.json/, + /\.md/, + /\.mdx/, + /\.gif/, +] + +let hasIssues = false + +function checkDir(dir: string) { + const entries = fs.readdirSync(dir, { withFileTypes: true }) + + for (const entry of entries) { + const fullPath = path.join(dir, entry.name) + if (entry.isDirectory()) { + checkDir(fullPath) + } else if (entry.isFile() && allowedExtensions.includes(path.extname(entry.name))) { + checkFile(fullPath) + } + } +} + +function checkFile(filePath: string) { + const content = fs.readFileSync(filePath, 'utf8') + const matches = [...content.matchAll(markdownLinkRegex)] + matches.forEach(match => { + const link = match[1] + const isIgnored = ignorePatterns.some(pattern => pattern.test(link)) + if (!isIgnored) { + console.log(`${filePath}: ${match[0]}`) + hasIssues = true + } + }) +} + +rootDir.map(dir => checkDir(dir)) + +if (hasIssues) { + process.exit(1) +} else { + console.log('All links formatted correctly') +} diff --git a/package.json b/package.json index bd55af3c..04958424 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "generate-supported-networks": "pnpm ts-node --project tsconfig.json .github/scripts/generateSupportedNetworks.ts", "get-resources-og": "node .github/scripts/getResourcesOg.js", "validate-resources": "node .github/scripts/validateResources.js", - "linkcheck": "find ./pages -name '*.md*' -print0 | xargs -0 -n1 pnpm markdown-link-check --quiet --progress --config linkchecker-config.json", + "linkcheck": "pnpm ts-node --project tsconfig.json .github/scripts/checkLinksFormat.ts && find ./pages -name '*.md*' -print0 | xargs -0 -n1 pnpm markdown-link-check --progress --config linkchecker-config.json", "lint": "eslint . && vale pages/ --minAlertLevel=error", "start": "serve out", "test": "env-cmd cypress run --headless", From 0af2427b88d7c40c83632490273bf17dace9a806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Fri, 11 Apr 2025 12:52:37 +0200 Subject: [PATCH 2/4] Update redirects --- redirects.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/redirects.json b/redirects.json index 5bbb1f86..7992f535 100644 --- a/redirects.json +++ b/redirects.json @@ -694,16 +694,6 @@ "destination": "/advanced/api-supported-networks", "permanent": true }, - { - "source": "/api-supported-networks", - "destination": "/core-api/transaction-service-supported-networks", - "permanent": true - }, - { - "source": "/advanced/api-supported-networks", - "destination": "/core-api/transaction-service-supported-networks", - "permanent": true - }, { "source": "/advanced/api-new-networks", "destination": "/core-api/safe-installation-overview", @@ -819,6 +809,16 @@ "destination": "https://github.com/5afe/safe-core-protocol", "permanent": true }, + { + "source": "/api-supported-networks", + "destination": "/advanced/smart-account-supported-networks?service=Transaction+Service", + "permanent": true + }, + { + "source": "/advanced/api-supported-networks", + "destination": "/advanced/smart-account-supported-networks?service=Transaction+Service", + "permanent": true + }, { "source": "/core-api/transaction-service-supported-networks", "destination": "/advanced/smart-account-supported-networks?service=Transaction+Service", From ffd67ead3bb65f8d8661a2c59c9c841e3e917d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Fri, 11 Apr 2025 12:53:50 +0200 Subject: [PATCH 3/4] Update links --- pages/advanced/passkeys/passkeys-safe.mdx | 2 +- pages/advanced/passkeys/tutorials/react-native.mdx | 4 ++-- pages/advanced/smart-account-concepts.mdx | 14 +++++++------- pages/advanced/smart-account-modules.mdx | 2 +- pages/advanced/smart-account-overview.mdx | 4 ++-- .../add-or-edit-chain.mdx | 2 +- pages/config-service-configuration/overview.mdx | 4 ++-- pages/core-api/transaction-service-overview.mdx | 4 ++-- pages/home/glossary.md | 2 +- pages/reference-sdk-react-hooks/overview.mdx | 2 +- pages/reference-sdk-starter-kit/overview.mdx | 2 +- .../safe-client/extend.mdx | 6 +++--- pages/sdk/overview.mdx | 8 ++++---- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pages/advanced/passkeys/passkeys-safe.mdx b/pages/advanced/passkeys/passkeys-safe.mdx index e8ec63df..ef66b5a9 100644 --- a/pages/advanced/passkeys/passkeys-safe.mdx +++ b/pages/advanced/passkeys/passkeys-safe.mdx @@ -13,7 +13,7 @@ These contracts can utilize EIP-7212 precompiles for signature verification on s ## Passkey contracts - This section covers implementation details of the passkeys with Safe. If you'd rather get straight to building, head over to our [guides](./passkeys-guides/safe-sdk) and [tutorials](./passkeys-tutorials/safe-passkeys-tutorial) sections. + This section covers implementation details of the passkeys with Safe. If you'd rather get straight to building, head over to our [guide](../../sdk/signers/passkeys.mdx) and [tutorials](./tutorials/react.mdx) sections. ### `SafeWebAuthnSignerProxy` diff --git a/pages/advanced/passkeys/tutorials/react-native.mdx b/pages/advanced/passkeys/tutorials/react-native.mdx index 0cb70303..72126ea7 100644 --- a/pages/advanced/passkeys/tutorials/react-native.mdx +++ b/pages/advanced/passkeys/tutorials/react-native.mdx @@ -1,5 +1,5 @@ -import { Callout } from 'nextra/components' import { Bleed, Tabs } from 'nextra-theme-docs' +import { Callout } from 'nextra/components' # How to build a React Native app with Safe and passkeys @@ -244,7 +244,7 @@ Delete the `/ios` and `/android` folders and restart the app (`npx expo run:ios` We learned how to use passkeys (create them, store them, and use them securely) and how they can interact with a Safe (deploy it and send transactions). We hope you enjoyed this tutorial and that the combination of passkeys and the ERC-4337 will unlock new forms of ownership for your project and users. -You can now integrate passkeys with more transactions and functionalities of the Safe ecosystem. You can read more about passkeys in our [overview](/advanced/passkeys/overview) or in the [WebAuthn API documentation](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API). +You can now integrate passkeys with more transactions and functionalities of the Safe ecosystem. You can read more about passkeys in the [overview](../overview.mdx) page or in the [WebAuthn API documentation](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API). Did you encounter any difficulties? Let us know by opening [an issue](https://github.com/5afe/react-native-passkeys-tutorial/issues/new) or asking a question on [Stack Exchange](https://ethereum.stackexchange.com/questions/tagged/safe-core) with the `safe-core` tag. diff --git a/pages/advanced/smart-account-concepts.mdx b/pages/advanced/smart-account-concepts.mdx index 5bd6fe72..8def7a81 100644 --- a/pages/advanced/smart-account-concepts.mdx +++ b/pages/advanced/smart-account-concepts.mdx @@ -2,16 +2,16 @@ #### Owners -Each Safe account maintains its own list of [owners](/home/glossary#owner) in the storage in the form of Ethereum addresses. Owners can be added or removed by other owners. +Each Safe account maintains its own list of [owners](../home/glossary.md#owner) in the storage in the form of Ethereum addresses. Owners can be added or removed by other owners. #### Threshold -Safe Smart Account maintains a [threshold](/home/glossary#threshold), the minimum number of owners required to confirm a transaction before it gets executed. The threshold of owners required to confirm a transaction is also stored in the storage. Owners of a Safe account can change the threshold value as well. A Safe account can have any number of owners, and the threshold value can be set between one and the total number of owners. +Safe Smart Account maintains a [threshold](../home/glossary.md#threshold), the minimum number of owners required to confirm a transaction before it gets executed. The threshold of owners required to confirm a transaction is also stored in the storage. Owners of a Safe account can change the threshold value as well. A Safe account can have any number of owners, and the threshold value can be set between one and the total number of owners. #### Signature verification Safe Smart Account, being a contract account, does not have a private key to sign transactions, and EVM cannot verify incoming transactions to a contract account. Hence, a contract account has to do the authentication and authorization in its code. When a transaction is submitted to a Safe account, it is first verified by the Safe account to ensure that the transaction is valid. If the required number of owners has signed the transaction, the transaction is allowed to be executed. If the required number of owners has not signed the transaction, the transaction reverts to the signature validation step. -A Safe Smart Account verifies if each signer is an owner of the Safe account and verifies the signature based on the signature type. To learn more about the signature types supported by Safe and encoding, refer to the [Signatures](/smart-account-signatures) page. +A Safe Smart Account verifies if each signer is an owner of the Safe account and verifies the signature based on the signature type. To learn more about the signature types supported by Safe and encoding, refer to the [Signatures](../advanced/smart-account-signatures.md) page. #### Transaction flow @@ -47,15 +47,15 @@ Here are some core components of a Safe Smart Account that you will learn about: #### Safe Modules -[Safe Modules](/home/glossary#safe-module) are smart contracts that extend Safe's functionality with added custom features while the module logic remains separate from Safe's core contracts. +[Safe Modules](../home/glossary.md#safe-module) are smart contracts that extend Safe's functionality with added custom features while the module logic remains separate from Safe's core contracts. -More information is available in the [Safe Modules ](smart-account-modules.mdx) page. +More information is available in the [Safe Modules](./smart-account-modules.mdx) page. #### Safe Guards -[Safe Guards](/home/glossary#safe-guard) make checks before and after a Safe transaction. +[Safe Guards](../home/glossary.md#safe-guard) make checks before and after a Safe transaction. -More information is available in the [Safe Guards](smart-account-guards.mdx) page. +More information is available in the [Safe Guards](./smart-account-guards.mdx) page. #### Signatures diff --git a/pages/advanced/smart-account-modules.mdx b/pages/advanced/smart-account-modules.mdx index f52297f1..c3c07d32 100644 --- a/pages/advanced/smart-account-modules.mdx +++ b/pages/advanced/smart-account-modules.mdx @@ -49,4 +49,4 @@ A great way to understand how Safe Modules work is by creating one. An excellent ## Reference -- [Safe Module Reference](/reference-smart-account/modules/enableModule) +- [Safe Module Reference](../reference-smart-account/modules/enableModule.mdx) diff --git a/pages/advanced/smart-account-overview.mdx b/pages/advanced/smart-account-overview.mdx index fb173a55..d351de81 100644 --- a/pages/advanced/smart-account-overview.mdx +++ b/pages/advanced/smart-account-overview.mdx @@ -4,11 +4,11 @@ import SafeSmartAccount from '../../assets/svg/ic-smart-account.svg' ## EOAs -[EOAs](/home/glossary#externally-owned-account), for short, are Ethereum accounts that use traditional key pairs. That is, they consist of a single private key that can be used to make transactions and sign messages. If you gain access to that private key, you gain complete control of the account. This means that your private key is a single point of failure between you and your funds being lost. +[EOAs](../home/glossary.md#externally-owned-account), for short, are Ethereum accounts that use traditional key pairs. That is, they consist of a single private key that can be used to make transactions and sign messages. If you gain access to that private key, you gain complete control of the account. This means that your private key is a single point of failure between you and your funds being lost. ## Smart Accounts -The other type of Ethereum account is a [Smart Account](/home/glossary#smart-account), also sometimes called Smart Contract Account. Like EOAs, smart contract accounts each have a unique public Ethereum address, and it is impossible to tell them apart from EOAs by looking at an Ethereum address. Smart contract accounts, too, can receive funds and make transactions like EOAs but cannot initiate them. Generally, the key difference is that no single private key is used to verify transactions. Instead, the smart contract code defines the logic behind how the account completes transactions. Smart contracts are programs that run on the Ethereum blockchain and execute when specific conditions are met. Their functionality within contract accounts means that such accounts, in contrast to EOAs, can, for example, implement access rights that specify by whom, how, and under which conditions transactions can be executed, as well as more complex logic. +The other type of Ethereum account is a [Smart Account](../home/glossary.md#smart-account), also sometimes called Smart Contract Account. Like EOAs, smart contract accounts each have a unique public Ethereum address, and it is impossible to tell them apart from EOAs by looking at an Ethereum address. Smart contract accounts, too, can receive funds and make transactions like EOAs but cannot initiate them. Generally, the key difference is that no single private key is used to verify transactions. Instead, the smart contract code defines the logic behind how the account completes transactions. Smart contracts are programs that run on the Ethereum blockchain and execute when specific conditions are met. Their functionality within contract accounts means that such accounts, in contrast to EOAs, can, for example, implement access rights that specify by whom, how, and under which conditions transactions can be executed, as well as more complex logic. # Difference between EOAs and Contract Accounts diff --git a/pages/config-service-configuration/add-or-edit-chain.mdx b/pages/config-service-configuration/add-or-edit-chain.mdx index 51f2aea8..d9cb0b3e 100644 --- a/pages/config-service-configuration/add-or-edit-chain.mdx +++ b/pages/config-service-configuration/add-or-edit-chain.mdx @@ -100,7 +100,7 @@ The chain's native currency logo to upload. This will be displayed in the UI. ### `Transaction service uri` -The URI of the chain's [Transaction Service](/core-api/api-safe-transaction-service). This will be used to fetch transaction data from the chain. You will need to deploy one Transaction Service per chain, as well as `txs-db`, `amqp` and `celery` instances. +The URI of the chain's [Transaction Service](../core-api/api-safe-transaction-service.mdx). This will be used to fetch transaction data from the chain. You will need to deploy one Transaction Service per chain, as well as `txs-db`, `amqp` and `celery` instances. ### `Vpc transaction service uri` diff --git a/pages/config-service-configuration/overview.mdx b/pages/config-service-configuration/overview.mdx index 191b1409..db24dca4 100644 --- a/pages/config-service-configuration/overview.mdx +++ b/pages/config-service-configuration/overview.mdx @@ -6,6 +6,6 @@ This document describes how to configure the Config Service through the Django a The Config Service is a Django application that allows you to manage configurations for your clients. It provides a web interface where you can create, update, and delete configurations, as well as manage groups of permissions to control who can access the configurations. -It assumes you have already set up your [Safe instance](https://github.com/safe-global/safe-infrastructure). If you haven't, please refer to the [Safe Infrastructure Deployment](/core-api/safe-infrastructure-deployment) guide. +It assumes you have already set up your [Safe Insfrastructure](https://github.com/safe-global/safe-infrastructure) instance. If you haven't, please refer to the [Safe\{Core\} Infrastructure Deployment](../core-api/safe-infrastructure-deployment.mdx) guide. -The following document concerns only the Safe Config Service. For other services of Safe infrastructure, please refer to the [Safe API documentation](/core-api). \ No newline at end of file +The following document concerns only the Safe Config Service. For other services of Safe\{Core\} Infrastructure, please refer to the [Safe\{Core\} Infrastructure](../core-api/api-overview.mdx) documentation. \ No newline at end of file diff --git a/pages/core-api/transaction-service-overview.mdx b/pages/core-api/transaction-service-overview.mdx index 22ec0cc5..f146f322 100644 --- a/pages/core-api/transaction-service-overview.mdx +++ b/pages/core-api/transaction-service-overview.mdx @@ -1,4 +1,4 @@ -import { Cards, Card } from 'nextra/components' +import { Card, Cards } from 'nextra/components' import Guides from '../../assets/svg/guides.svg' import Reference from '../../assets/svg/reference.svg' @@ -6,7 +6,7 @@ import Reference from '../../assets/svg/reference.svg' The Safe Transaction Service offers a REST API to track transactions sent via the Safe Smart Account. It also provides endpoints to send transactions, allow off-chain collecting of signatures, or informing the owners about a pending transaction to be sent to the blockchain. -Additionally, the Safe\{Core\} SDK provides the [API Kit](../sdk/api-kit), a TypeScript client for the Safe Transaction Service API. +Additionally, the Safe\{Core\} SDK provides the [API Kit](../sdk/api-kit.mdx), a TypeScript client for the Safe Transaction Service API. } title="Guides" href="./transaction-service-guides/transactions" /> diff --git a/pages/home/glossary.md b/pages/home/glossary.md index 7ca29dbc..c8f2b7f7 100644 --- a/pages/home/glossary.md +++ b/pages/home/glossary.md @@ -61,7 +61,7 @@ See also: Gasless transactions (also known as meta-transactions) are Ethereum transactions that are executed by a third party called [relayer](#relayer) on behalf of a [smart account](#smart-account) to abstract the use of gas. Users must sign a message (instead of the transaction itself) with information about the transaction they want to execute. A relayer will create the Ethereum transaction, sign and execute it, and pay for the gas costs. The main benefit is that users can interact with the blockchain without holding the native token in their account. See also: -- [Relay Kit documentation](../sdk/relay-kit) on docs.safe.global +- [Relay Kit documentation](../sdk/relay-kit.mdx) on docs.safe.global ## Multi-signature diff --git a/pages/reference-sdk-react-hooks/overview.mdx b/pages/reference-sdk-react-hooks/overview.mdx index bb71bcaf..acaf31ab 100644 --- a/pages/reference-sdk-react-hooks/overview.mdx +++ b/pages/reference-sdk-react-hooks/overview.mdx @@ -1,6 +1,6 @@ # Safe React Hooks Reference -[Safe React Hooks](../sdk/react-hooks) is a collection of React hooks written in TypeScript that simplify the usage of the Safe\{Core\} SDK for React developers. +[Safe React Hooks](../sdk/react-hooks.mdx) is a collection of React hooks written in TypeScript that simplify the usage of the Safe\{Core\} SDK for React developers. ## Install dependencies diff --git a/pages/reference-sdk-starter-kit/overview.mdx b/pages/reference-sdk-starter-kit/overview.mdx index 4fe6eeb9..6d9673e5 100644 --- a/pages/reference-sdk-starter-kit/overview.mdx +++ b/pages/reference-sdk-starter-kit/overview.mdx @@ -1,6 +1,6 @@ # Starter Kit Reference -The [Starter Kit](../sdk/starter-kit) is the starting point for integrating the Safe account in the front-end, as it provides the most simplified way to handle the Safe transaction flow in its different forms: +The [Starter Kit](../sdk/starter-kit.mdx) is the starting point for integrating the Safe account in the front-end, as it provides the most simplified way to handle the Safe transaction flow in its different forms: - User operations - Multi-signature transactions diff --git a/pages/reference-sdk-starter-kit/safe-client/extend.mdx b/pages/reference-sdk-starter-kit/safe-client/extend.mdx index 5a0d2bf7..2bfe254b 100644 --- a/pages/reference-sdk-starter-kit/safe-client/extend.mdx +++ b/pages/reference-sdk-starter-kit/safe-client/extend.mdx @@ -6,9 +6,9 @@ Extends the functionality of the `SafeClient` class. The Starter Kit offers some extensions that allow this, but you can also implement your own. -- [`onChainMessages`](../onchain-messages): Enables the use of on-chain messages. -- [`offChainMessages`](../offchain-messages): Enables the use of off-chain messages. -- [`safeOperations`](../safe-operations): Enables using a bundler and paymaster to submit ERC-4337 user operations. +- [`onChainMessages`](../onchain-messages/sendonchainmessage.mdx): Enables the use of on-chain messages. +- [`offChainMessages`](../offchain-messages/sendoffchainmessage.mdx): Enables the use of off-chain messages. +- [`safeOperations`](../safe-operations/sendsafeoperation.mdx): Enables using a bundler and paymaster to submit ERC-4337 user operations. ## Usage diff --git a/pages/sdk/overview.mdx b/pages/sdk/overview.mdx index 341fff93..c2b91c35 100644 --- a/pages/sdk/overview.mdx +++ b/pages/sdk/overview.mdx @@ -1,9 +1,9 @@ -import { Callout } from 'nextra/components' import { Grid } from '@mui/material' -import CustomCard from '../../components/CustomCard' +import { Callout } from 'nextra/components' +import SafeCoreAPI from '../../assets/svg/ic-api.svg' import SafeCoreSDK from '../../assets/svg/ic-sdk.svg' import SafeSmartAccount from '../../assets/svg/ic-smart-account.svg' -import SafeCoreAPI from '../../assets/svg/ic-api.svg' +import CustomCard from '../../components/CustomCard' # Safe\{Core\} SDK @@ -13,7 +13,7 @@ The Safe\{Core\} SDK groups its functionality into four different kits: ## Starter Kit -The [Starter Kit](../sdk/starter-kit) is the starting point for interacting with the Safe smart account. It leverages and abstracts the complex logic from other kits while being modular and customizable, offering the most simplified way to deploy new accounts and handle the Safe transaction flow in all its different forms: +The [Starter Kit](../sdk/starter-kit.mdx) is the starting point for interacting with the Safe smart account. It leverages and abstracts the complex logic from other kits while being modular and customizable, offering the most simplified way to deploy new accounts and handle the Safe transaction flow in all its different forms: - User operations - Multi-signature transactions From addb723e264e1d89f91d1584698a26c6f5861720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Mon, 14 Apr 2025 12:26:45 +0200 Subject: [PATCH 4/4] Fix typo --- pages/config-service-configuration/overview.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/config-service-configuration/overview.mdx b/pages/config-service-configuration/overview.mdx index db24dca4..9067247f 100644 --- a/pages/config-service-configuration/overview.mdx +++ b/pages/config-service-configuration/overview.mdx @@ -6,6 +6,6 @@ This document describes how to configure the Config Service through the Django a The Config Service is a Django application that allows you to manage configurations for your clients. It provides a web interface where you can create, update, and delete configurations, as well as manage groups of permissions to control who can access the configurations. -It assumes you have already set up your [Safe Insfrastructure](https://github.com/safe-global/safe-infrastructure) instance. If you haven't, please refer to the [Safe\{Core\} Infrastructure Deployment](../core-api/safe-infrastructure-deployment.mdx) guide. +It assumes you have already set up your [Safe Infrastructure](https://github.com/safe-global/safe-infrastructure) instance. If you haven't, please refer to the [Safe\{Core\} Infrastructure Deployment](../core-api/safe-infrastructure-deployment.mdx) guide. The following document concerns only the Safe Config Service. For other services of Safe\{Core\} Infrastructure, please refer to the [Safe\{Core\} Infrastructure](../core-api/api-overview.mdx) documentation. \ No newline at end of file